lbry-desktop/ui/component/wunderbarSuggestions/index.js

31 lines
1.3 KiB
JavaScript
Raw Permalink Normal View History

2020-12-11 19:33:27 +01:00
import * as MODALS from 'constants/modal_types';
import { connect } from 'react-redux';
import { selectLanguage, makeSelectClientSetting } from 'redux/selectors/settings';
import { doToast } from 'redux/actions/notifications';
import { doSearch } from 'redux/actions/search';
2020-12-30 23:16:06 +01:00
import { doOpenModal, doHideModal } from 'redux/actions/app';
2020-12-11 19:33:27 +01:00
import { withRouter } from 'react-router';
import { doResolveUris, SETTINGS } from 'lbry-redux';
import analytics from 'analytics';
import Wunderbar from './view';
const select = (state, props) => ({
language: selectLanguage(state),
showMature: makeSelectClientSetting(SETTINGS.SHOW_MATURE)(state),
});
const perform = (dispatch, ownProps) => ({
doResolveUris: uris => dispatch(doResolveUris(uris)),
doSearch: (query, options) => dispatch(doSearch(query, options)),
navigateToSearchPage: query => {
let encodedQuery = encodeURIComponent(query);
ownProps.history.push({ pathname: `/$/search`, search: `?q=${encodedQuery}` });
analytics.apiLogSearch();
},
doShowSnackBar: message => dispatch(doToast({ isError: true, message })),
doOpenMobileSearch: () => dispatch(doOpenModal(MODALS.MOBILE_SEARCH)),
2020-12-30 23:16:06 +01:00
doCloseMobileSearch: () => dispatch(doHideModal()),
2020-12-11 19:33:27 +01:00
});
export default withRouter(connect(select, perform)(Wunderbar));