1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { contextMenuActions, ContextMenuAction } from "./context-menu-actions";
7 export interface ContextMenuState {
9 position: ContextMenuPosition;
10 resource?: ContextMenuResource;
13 export interface ContextMenuPosition {
18 export interface ContextMenuResource {
25 const initialState = {
27 position: { x: 0, y: 0 }
30 export const contextMenuReducer = (state: ContextMenuState = initialState, action: ContextMenuAction) =>
31 contextMenuActions.match(action, {
33 OPEN_CONTEXT_MENU: ({ resource, position }) => ({ open: true, resource, position }),
34 CLOSE_CONTEXT_MENU: () => ({ ...state, open: false })