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

29 lines
1 KiB
JavaScript
Raw Permalink Normal View History

import { connect } from 'react-redux';
2020-12-16 19:31:07 +01:00
import { doResolveUris, doClearPublish, doPrepareEdit, selectPendingIds, makeSelectClaimForUri } from 'lbry-redux';
import { makeSelectWinningUriForQuery, makeSelectIsResolvingWinningUri } from 'redux/selectors/search';
import SearchTopClaim from './view';
import { push } from 'connected-react-router';
import * as PAGES from 'constants/pages';
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,
isResolvingWinningUri: props.query ? makeSelectIsResolvingWinningUri(props.query)(state) : 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);