Resolve merge conflicts
[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 { Resource } from "../../common/api/common-resource-service";
6 import actions, { DetailsPanelAction } from "./details-panel-action";
7
8 export interface DetailsPanelState {
9     item: Resource | null;
10     isOpened: boolean;
11 }
12
13 const initialState = {
14     item: null,
15     isOpened: false
16 };
17
18 const reducer = (state: DetailsPanelState = initialState, action: DetailsPanelAction) =>
19     actions.match(action, {
20         default: () => state,
21         LOAD_DETAILS: () => state,
22         LOAD_DETAILS_SUCCESS: ({ item }) => ({ ...state, item }),
23         TOGGLE_DETAILS_PANEL: () => ({ ...state, isOpened: !state.isOpened })
24     });
25
26 export default reducer;