21846: applied select to context menu open
[arvados.git] / services / workbench2 / src / store / collection-panel / collection-panel-reducer.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { collectionPanelActions, CollectionPanelAction } from "./collection-panel-action";
6 import { CollectionResource } from "models/collection";
7
8 export interface CollectionPanelState {
9     item: CollectionResource | null;
10 }
11
12 const initialState = {
13     item: null,
14 };
15
16 export const collectionPanelReducer = (state: CollectionPanelState = initialState, action: CollectionPanelAction) =>
17     collectionPanelActions.match(action, {
18         default: () => state,
19         SET_COLLECTION: (item) => ({
20              ...state,
21              item,
22         }),
23     });