X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/0be34acc576c9552f4c669062defe51c36888866..1baec2d74e64375ce1b410f6a66fc8c8c9848307:/src/store/details-panel/details-panel-reducer.ts diff --git a/src/store/details-panel/details-panel-reducer.ts b/src/store/details-panel/details-panel-reducer.ts index f57b9f1c..091b2fa2 100644 --- a/src/store/details-panel/details-panel-reducer.ts +++ b/src/store/details-panel/details-panel-reducer.ts @@ -2,25 +2,21 @@ // // SPDX-License-Identifier: AGPL-3.0 -import actions, { DetailsPanelAction } from "./details-panel-action"; -import { Resource } from "../../models/resource"; +import { detailsPanelActions, DetailsPanelAction } from "./details-panel-action"; export interface DetailsPanelState { - item: Resource | null; + resourceUuid: string; isOpened: boolean; } const initialState = { - item: null, + resourceUuid: '', isOpened: false }; -const reducer = (state: DetailsPanelState = initialState, action: DetailsPanelAction) => - actions.match(action, { +export const detailsPanelReducer = (state: DetailsPanelState = initialState, action: DetailsPanelAction) => + detailsPanelActions.match(action, { default: () => state, - LOAD_DETAILS: () => state, - LOAD_DETAILS_SUCCESS: ({ item }) => ({ ...state, item }), + LOAD_DETAILS_PANEL: resourceUuid => ({ ...state, resourceUuid }), TOGGLE_DETAILS_PANEL: () => ({ ...state, isOpened: !state.isOpened }) }); - -export default reducer;