201a826381
- Memo not required. `resolvingUris` is very dynamic and is a short array anyways. - Changeg from using `indexOf` to `includes`, which is more concise.
30 lines
1.1 KiB
JavaScript
30 lines
1.1 KiB
JavaScript
import { connect } from 'react-redux';
|
|
import { doClearPublish, doPrepareEdit } from 'redux/actions/publish';
|
|
import { doResolveUris } from 'redux/actions/claims';
|
|
import { selectPendingIds, makeSelectClaimForUri } from 'redux/selectors/claims';
|
|
import { makeSelectWinningUriForQuery, selectIsResolvingWinningUri } from 'redux/selectors/search';
|
|
import SearchTopClaim from './view';
|
|
import { push } from 'connected-react-router';
|
|
import * as PAGES from 'constants/pages';
|
|
|
|
const select = (state, props) => {
|
|
const winningUri = makeSelectWinningUriForQuery(props.query)(state);
|
|
|
|
return {
|
|
winningUri,
|
|
winningClaim: winningUri ? makeSelectClaimForUri(winningUri)(state) : undefined,
|
|
isResolvingWinningUri: props.query ? selectIsResolvingWinningUri(state, props.query) : false,
|
|
pendingIds: selectPendingIds(state),
|
|
};
|
|
};
|
|
|
|
const perform = (dispatch) => ({
|
|
beginPublish: (name) => {
|
|
dispatch(doClearPublish());
|
|
dispatch(doPrepareEdit({ name }));
|
|
dispatch(push(`/$/${PAGES.UPLOAD}`));
|
|
},
|
|
doResolveUris: (uris) => dispatch(doResolveUris(uris)),
|
|
});
|
|
|
|
export default connect(select, perform)(SearchTopClaim);
|