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