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

28 lines
1.1 KiB
JavaScript
Raw Normal View History

2020-08-21 17:49:13 +02:00
import * as CS from 'constants/claim_search';
import { connect } from 'react-redux';
import { makeSelectClaimForUri, doResolveUri, SETTINGS } from 'lbry-redux';
import { selectUserVerifiedEmail } from 'redux/selectors/user';
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 ? makeSelectClaimForUri(repostedUri)(state) : null,
2020-03-26 22:47:07 +01:00
isAuthenticated: selectUserVerifiedEmail(state),
2020-08-21 17:49:13 +02:00
tileLayout: makeSelectClientSetting(SETTINGS.TILE_LAYOUT)(state),
};
};
export default connect(select, {
doToggleTagFollowDesktop,
doResolveUri,
})(Tags);