X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/10ce16c28de952f6533ca3cc9df909269e3d2a53..2a7fd99c212c33a1ec9911f8529fa5afc59a7bb2:/src/store/context-menu/context-menu-reducer.ts diff --git a/src/store/context-menu/context-menu-reducer.ts b/src/store/context-menu/context-menu-reducer.ts index b20ad723f2..03d9cc7843 100644 --- a/src/store/context-menu/context-menu-reducer.ts +++ b/src/store/context-menu/context-menu-reducer.ts @@ -2,10 +2,10 @@ // // SPDX-License-Identifier: AGPL-3.0 -import { ResourceKind } from "../../models/resource"; -import { contextMenuActions, ContextMenuAction } from "./context-menu-actions"; +import { contextMenuActions, ContextMenuAction, ContextMenuResource } from "./context-menu-actions"; export interface ContextMenuState { + open: boolean; position: ContextMenuPosition; resource?: ContextMenuResource; } @@ -15,19 +15,15 @@ export interface ContextMenuPosition { y: number; } -export interface ContextMenuResource { - uuid: string; - kind: string; -} - const initialState = { + open: false, position: { x: 0, y: 0 } }; export const contextMenuReducer = (state: ContextMenuState = initialState, action: ContextMenuAction) => contextMenuActions.match(action, { default: () => state, - OPEN_CONTEXT_MENU: ({resource, position}) => ({ resource, position }), - CLOSE_CONTEXT_MENU: () => ({ position: state.position }) + OPEN_CONTEXT_MENU: ({ resource, position }) => ({ open: true, resource, position }), + CLOSE_CONTEXT_MENU: () => ({ ...state, open: false }) });