-// const reducer = (state: DetailsPanelState = initialState, action: DetailsPanelAction) =>
-// actions.match(action, {
-// default: () => state,
-// LOAD_DETAILS: () => state,
-// LOAD_DETAILS_SUCCESS: ({ item }) => ({ ...state, item }),
-// TOGGLE_DETAILS_PANEL: () => ({ ...state, isOpened: !state.isOpened })
-// });
+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 }) => ({ open: true, resource, position }),
+ CLOSE_CONTEXT_MENU: () => ({ ...state, open: false })
+ });