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

30 lines
1.1 KiB
JavaScript
Raw Normal View History

2018-09-12 18:42:15 +02:00
import { connect } from 'react-redux';
import { doFetchInviteStatus } from 'redux/actions/user';
2022-05-13 14:04:26 +02:00
import { selectClaimForUri, selectTitleForUri } from 'redux/selectors/claims';
2018-09-12 18:42:15 +02:00
import SocialShare from './view';
import { selectUserInviteReferralCode, selectUser, selectUserInviteStatusFetched } from 'redux/selectors/user';
import { selectContentPositionForUri } from 'redux/selectors/content';
2022-05-13 14:04:26 +02:00
import { selectActiveLivestreamForChannel } from 'redux/selectors/livestream';
2018-09-12 18:42:15 +02:00
2022-05-13 14:04:26 +02:00
const select = (state, props) => {
const { uri } = props;
const claim = selectClaimForUri(state, uri);
const { claim_id: claimId } = claim || {};
return {
claim,
inviteStatusFetched: selectUserInviteStatusFetched(state),
referralCode: selectUserInviteReferralCode(state),
user: selectUser(state),
title: selectTitleForUri(state, uri),
position: selectContentPositionForUri(state, uri),
hasActiveLivestream: Boolean(selectActiveLivestreamForChannel(state, claimId)),
};
};
2018-09-12 18:42:15 +02:00
const perform = {
doFetchInviteStatus,
};
export default connect(select, perform)(SocialShare);