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

28 lines
1 KiB
JavaScript
Raw Permalink Normal View History

2020-08-21 17:49:13 +02:00
import * as CS from 'constants/claim_search';
import { connect } from 'react-redux';
import { doResolveUri } from 'redux/actions/claims';
import { selectClaimForUri } from 'redux/selectors/claims';
import * as SETTINGS from 'constants/settings';
import { selectFollowedTags } from 'redux/selectors/tags';
import { doToggleTagFollowDesktop } from 'redux/actions/tags';
2020-08-21 17:49:13 +02:00
import { makeSelectClientSetting } from 'redux/selectors/settings';
import Tags from './view';
2017-04-23 11:56:50 +02:00
const select = (state, props) => {
const urlParams = new URLSearchParams(props.location.search);
const repostedUriInUrl = urlParams.get(CS.REPOSTED_URI_KEY);
const repostedUri = repostedUriInUrl ? decodeURIComponent(repostedUriInUrl) : undefined;
2017-04-23 11:56:50 +02:00
return {
followedTags: selectFollowedTags(state),
repostedUri: repostedUri,
repostedClaim: repostedUri ? selectClaimForUri(state, repostedUri) : null,
2020-08-21 17:49:13 +02:00
tileLayout: makeSelectClientSetting(SETTINGS.TILE_LAYOUT)(state),
};
};
export default connect(select, {
doToggleTagFollowDesktop,
doResolveUri,
})(Tags);