2020-10-28 20:18:58 +01:00
|
|
|
import { connect } from 'react-redux';
|
2022-07-11 16:12:37 +02:00
|
|
|
// import { doClearPublish, doPrepareEdit } from 'redux/actions/publish';
|
|
|
|
import { doClearPublish } from 'redux/actions/publish';
|
2021-10-17 10:36:14 +02:00
|
|
|
import { doResolveUris } from 'redux/actions/claims';
|
2022-02-27 01:52:14 +01:00
|
|
|
import { doOpenModal } from 'redux/actions/app';
|
2021-10-17 10:36:14 +02:00
|
|
|
import { selectPendingIds, makeSelectClaimForUri } from 'redux/selectors/claims';
|
2021-11-16 05:43:28 +01:00
|
|
|
import { makeSelectWinningUriForQuery, selectIsResolvingWinningUri } from 'redux/selectors/search';
|
2020-10-28 20:18:58 +01:00
|
|
|
import SearchTopClaim from './view';
|
2020-12-04 01:10:23 +01:00
|
|
|
import { push } from 'connected-react-router';
|
|
|
|
import * as PAGES from 'constants/pages';
|
2020-10-28 20:18:58 +01:00
|
|
|
|
2020-12-16 19:31:07 +01:00
|
|
|
const select = (state, props) => {
|
|
|
|
const winningUri = makeSelectWinningUriForQuery(props.query)(state);
|
|
|
|
|
|
|
|
return {
|
|
|
|
winningUri,
|
|
|
|
winningClaim: winningUri ? makeSelectClaimForUri(winningUri)(state) : undefined,
|
2021-11-16 05:43:28 +01:00
|
|
|
isResolvingWinningUri: props.query ? selectIsResolvingWinningUri(state, props.query) : false,
|
2020-12-16 19:31:07 +01:00
|
|
|
pendingIds: selectPendingIds(state),
|
|
|
|
};
|
|
|
|
};
|
2020-10-28 20:18:58 +01:00
|
|
|
|
2021-10-17 10:36:14 +02:00
|
|
|
const perform = (dispatch) => ({
|
|
|
|
beginPublish: (name) => {
|
2020-12-04 01:10:23 +01:00
|
|
|
dispatch(doClearPublish());
|
2022-07-11 16:12:37 +02:00
|
|
|
// dispatch(doPrepareEdit({ name }));
|
2020-12-04 01:10:23 +01:00
|
|
|
dispatch(push(`/$/${PAGES.UPLOAD}`));
|
|
|
|
},
|
2021-10-17 10:36:14 +02:00
|
|
|
doResolveUris: (uris) => dispatch(doResolveUris(uris)),
|
2022-02-27 01:52:14 +01:00
|
|
|
doOpenModal: (id, props) => dispatch(doOpenModal(id, props)),
|
2020-12-04 01:10:23 +01:00
|
|
|
});
|
|
|
|
|
|
|
|
export default connect(select, perform)(SearchTopClaim);
|