X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/10ce16c28de952f6533ca3cc9df909269e3d2a53..378c6a3a18cd9849bf4233e130a9ffdf250de35e:/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..8b51478d2b 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,18 @@ export interface ContextMenuPosition { export interface ContextMenuResource { uuid: string; kind: string; + name: 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 }) });