Merge branch '13494-collection-version-browser'
[arvados-workbench2.git] / src / store / details-panel / details-panel-reducer.ts
index f22add3d49b08810a2c5cf248ca4f90503dc0a1d..6c32551cbf6926f9975e4bca40d1728295c54d05 100644 (file)
@@ -3,21 +3,23 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import { detailsPanelActions, DetailsPanelAction } from "./details-panel-action";
-import { Resource } from "~/models/resource";
 
 export interface DetailsPanelState {
-    item: Resource | null;
+    resourceUuid: string;
     isOpened: boolean;
+    tabNr: number;
 }
 
 const initialState = {
-    item: null,
-    isOpened: false
+    resourceUuid: '',
+    isOpened: false,
+    tabNr: 0
 };
 
 export const detailsPanelReducer = (state: DetailsPanelState = initialState, action: DetailsPanelAction) =>
     detailsPanelActions.match(action, {
         default: () => state,
-        LOAD_DETAILS_SUCCESS: ({ item }) => ({ ...state, item }),
-        TOGGLE_DETAILS_PANEL: () => ({ ...state, isOpened: !state.isOpened })
+        LOAD_DETAILS_PANEL: resourceUuid => ({ ...state, resourceUuid }),
+        OPEN_DETAILS_PANEL: tabNr => ({ ...state, isOpened: true, tabNr }),
+        TOGGLE_DETAILS_PANEL: () => ({ ...state, isOpened: !state.isOpened }),
     });