Clean process-logs-panel code
[arvados.git] / src / store / details-panel / details-panel-reducer.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { detailsPanelActions, DetailsPanelAction } from "./details-panel-action";
6
7 export interface DetailsPanelState {
8     resourceUuid: string;
9     isOpened: boolean;
10 }
11
12 const initialState = {
13     resourceUuid: '',
14     isOpened: false
15 };
16
17 export const detailsPanelReducer = (state: DetailsPanelState = initialState, action: DetailsPanelAction) =>
18     detailsPanelActions.match(action, {
19         default: () => state,
20         LOAD_DETAILS_PANEL: resourceUuid => ({ ...state, resourceUuid }),
21         TOGGLE_DETAILS_PANEL: () => ({ ...state, isOpened: !state.isOpened })
22     });