diff --git a/src/renderer/component/socialShare/view.jsx b/src/renderer/component/socialShare/view.jsx index ac68bdfc2..3bc26b76a 100644 --- a/src/renderer/component/socialShare/view.jsx +++ b/src/renderer/component/socialShare/view.jsx @@ -10,9 +10,14 @@ type Props = { claim: Claim, onDone: () => void, speechShareable: boolean, + isChannel: boolean, }; class SocialShare extends React.PureComponent { + static defaultProps = { + isChannel: false, + }; + constructor(props: Props) { super(props); @@ -22,27 +27,33 @@ class SocialShare extends React.PureComponent { input: ?HTMLInputElement; render() { - const { - claim_id: claimId, - name: claimName, - channel_name: channelName, - value, - } = this.props.claim; + const { claim, isChannel } = this.props; + const { claim_id: claimId, name: claimName, channel_name: channelName, value } = claim; + const { speechShareable, onDone } = this.props; const channelClaimId = value && value.publisherSignature && value.publisherSignature.certificateId; const speechPrefix = 'https://spee.ch/'; const lbryPrefix = 'https://open.lbry.io/'; - const speechURL = - channelName && channelClaimId - ? `${speechPrefix}${channelName}:${channelClaimId}/${claimName}` - : `${speechPrefix}${claimId}/${claimName}`; + let speechURL; + let lbryURL; + if (isChannel) { + // For channel claims, the channel name (@something) is in `claim.name` + speechURL = `${speechPrefix}${claimName}:${claimId}`; + lbryURL = `${lbryPrefix}${claimName}#${claimId}`; + } else { + // If it's for a regular claim, check if it has an associated channel + speechURL = + channelName && channelClaimId + ? `${speechPrefix}${channelName}:${channelClaimId}/${claimName}` + : `${speechPrefix}${claimId}/${claimName}`; - const lbryURL = - channelName && channelClaimId - ? `${lbryPrefix}${channelName}#${channelClaimId}/${claimName}` - : `${lbryPrefix}${claimName}#${claimId}`; + lbryURL = + channelName && channelClaimId + ? `${lbryPrefix}${channelName}#${channelClaimId}/${claimName}` + : `${lbryPrefix}${claimName}#${claimId}`; + } return (
diff --git a/src/renderer/modal/modalSocialShare/view.jsx b/src/renderer/modal/modalSocialShare/view.jsx index 89e22174a..9543e27c2 100644 --- a/src/renderer/modal/modalSocialShare/view.jsx +++ b/src/renderer/modal/modalSocialShare/view.jsx @@ -7,14 +7,20 @@ type Props = { closeModal: () => void, uri: string, speechShareable: boolean, + isChannel: boolean, }; class ModalSocialShare extends React.PureComponent { render() { - const { closeModal, uri, speechShareable } = this.props; + const { closeModal, uri, speechShareable, isChannel } = this.props; return ( - + ); } diff --git a/src/renderer/page/channel/view.jsx b/src/renderer/page/channel/view.jsx index 641a91680..023ad2c1e 100644 --- a/src/renderer/page/channel/view.jsx +++ b/src/renderer/page/channel/view.jsx @@ -103,7 +103,12 @@ class ChannelPage extends React.PureComponent { button="alt" icon={icons.GLOBE} label={__('Share Channel')} - onClick={() => openModal({ id: MODALS.SOCIAL_SHARE }, { uri, speechShareable: true })} + onClick={() => + openModal( + { id: MODALS.SOCIAL_SHARE }, + { uri, speechShareable: true, isChannel: true } + ) + } />
{contentList}