1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { connect } from 'react-redux';
6 import { RootState } from '~/store/store';
7 import { Dispatch } from 'redux';
8 import { goToView, searchBarActions } from '~/store/search-bar/search-bar-actions';
9 import { SearchBarView } from '~/views-components/search-bar/search-bar-view';
10 import { saveRecentQuery, loadRecentQueries } from '~/store/search-bar/search-bar-actions';
12 const mapStateToProps = ({ searchBar }: RootState) => {
14 currentView: searchBar.currentView,
19 const mapDispatchToProps = (dispatch: Dispatch) => ({
20 onSetView: (currentView: string) => dispatch(goToView(currentView)),
21 openView: () => dispatch<any>(searchBarActions.OPEN_SEARCH_VIEW()),
22 closeView: () => dispatch<any>(searchBarActions.CLOSE_SEARCH_VIEW()),
23 saveQuery: (query: string) => dispatch<any>(saveRecentQuery(query)),
24 loadQueries: () => dispatch<any>(loadRecentQueries())
27 export const SearchBar = connect(mapStateToProps, mapDispatchToProps)(SearchBarView);