1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { searchBarActions, SearchBarActions } from '~/store/search-bar/search-bar-actions';
12 export enum SearchView {
14 ADVANCED = 'advanced',
15 AUTOCOMPLETE = 'autocomplete'
18 const initialState: SearchBar = {
19 currentView: SearchView.BASIC,
23 export const searchBarReducer = (state = initialState, action: SearchBarActions): SearchBar =>
24 searchBarActions.match(action, {
25 SET_CURRENT_VIEW: currentView => ({ ...state, currentView }),
26 OPEN_SEARCH_VIEW: () => ({ ...state, open: true }),
27 CLOSE_SEARCH_VIEW: () => ({ ...state, open: false }),