lbry-desktop/ui/page/search/index.js

37 lines
1,014 B
JavaScript
Raw Normal View History

import { connect } from 'react-redux';
2019-06-11 20:10:58 +02:00
import { doSearch, selectIsSearching, makeSelectSearchUris, makeSelectQueryWithOptions, doToast } from 'lbry-redux';
import analytics from 'analytics';
import SearchPage from './view';
2017-05-05 10:01:16 +02:00
2017-06-06 06:21:55 +02:00
const select = state => ({
2017-05-05 10:01:16 +02:00
isSearching: selectIsSearching(state),
2019-06-11 20:10:58 +02:00
uris: makeSelectSearchUris(makeSelectQueryWithOptions()(state))(state),
2017-06-06 06:21:55 +02:00
});
2017-05-05 10:01:16 +02:00
2019-06-11 20:10:58 +02:00
const perform = dispatch => ({
2019-06-20 02:57:51 +02:00
search: query => dispatch(doSearch(query)),
2019-06-11 20:10:58 +02:00
onFeedbackPositive: query => {
analytics.apiSearchFeedback(query, 1);
dispatch(
doToast({
message: __('Thanks for the feedback! You help make the app better for everyone.'),
})
);
},
onFeedbackNegative: query => {
analytics.apiSearchFeedback(query, 0);
dispatch(
doToast({
message: __(
'Thanks for the feedback. Mark has been notified and is currently walking over to his computer to work on this.'
),
})
);
},
});
2017-05-05 10:01:16 +02:00
export default connect(
select,
perform
)(SearchPage);