X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/bccb9ca5151f041d8c8b73098a3e1874023e3efa..9bad01c91c6c67d5067419ab709129ff1d1e6b18:/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..ac14c35534 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"; export interface ContextMenuState { + open: boolean; position: ContextMenuPosition; resource?: ContextMenuResource; } @@ -18,16 +18,19 @@ export interface ContextMenuPosition { export interface ContextMenuResource { uuid: string; kind: string; + name: string; + description?: 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 }) });