diff --git a/package.json b/package.json index 6ef76fc96..0df198b15 100644 --- a/package.json +++ b/package.json @@ -143,7 +143,7 @@ "imagesloaded": "^4.1.4", "json-loader": "^0.5.4", "lbry-format": "https://github.com/lbryio/lbry-format.git", - "lbry-redux": "lbryio/lbry-redux#609f13991fa2dfd5b7d4357189bb05e3e172c3a4", + "lbry-redux": "lbryio/lbry-redux#4dfc4689c61f46e4133929a1cce3161b65724e07", "lbryinc": "lbryio/lbryinc#8f9a58bfc8312a65614fd7327661cdcc502c4e59", "lint-staged": "^7.0.2", "localforage": "^1.7.1", diff --git a/ui/component/fileActions/view.jsx b/ui/component/fileActions/view.jsx index b2c7394e3..afbfc8966 100644 --- a/ui/component/fileActions/view.jsx +++ b/ui/component/fileActions/view.jsx @@ -6,7 +6,7 @@ import * as ICONS from 'constants/icons'; import React from 'react'; import Button from 'component/button'; import FileDownloadLink from 'component/fileDownloadLink'; -import { buildURI } from 'lbry-redux'; +import { buildURI, COLLECTIONS_CONSTS } from 'lbry-redux'; import * as RENDER_MODES from 'constants/file_render_modes'; import { useIsMobile } from 'effects/use-screensize'; import ClaimSupportButton from 'component/claimSupportButton'; @@ -50,7 +50,7 @@ function FileActions(props: Props) { } = props; const { push, - location: { pathname }, + location: { pathname, search }, } = useHistory(); const isMobile = useIsMobile(); const webShareable = costInfo && costInfo.cost === 0 && RENDER_MODES.WEB_SHAREABLE_MODES.includes(renderMode); @@ -75,6 +75,9 @@ function FileActions(props: Props) { editUri = buildURI(uriObject); } + const urlParams = new URLSearchParams(search); + const collectionId = urlParams.get(COLLECTIONS_CONSTS.COLLECTION_ID); + function handleRepostClick() { if (!hasChannels) { clearPlayingUri(); @@ -106,7 +109,7 @@ function FileActions(props: Props) { icon={ICONS.SHARE} label={__('Share')} title={__('Share')} - onClick={() => openModal(MODALS.SOCIAL_SHARE, { uri, webShareable })} + onClick={() => openModal(MODALS.SOCIAL_SHARE, { uri, webShareable, collectionId })} /> ); diff --git a/ui/component/socialShare/view.jsx b/ui/component/socialShare/view.jsx index 91d6ed8ee..55c04a347 100644 --- a/ui/component/socialShare/view.jsx +++ b/ui/component/socialShare/view.jsx @@ -22,11 +22,13 @@ type Props = { referralCode: string, user: any, position: number, + collectionId?: number, }; function SocialShare(props: Props) { - const { claim, title, referralCode, user, webShareable, position } = props; + const { claim, title, referralCode, user, webShareable, position, collectionId } = props; const [showEmbed, setShowEmbed] = React.useState(false); + const [includeCollectionId, setIncludeCollectionId] = React.useState(Boolean(collectionId)); // unless it *is* a collection? const [showClaimLinks, setShowClaimLinks] = React.useState(false); const [includeStartTime, setincludeStartTime]: [boolean, any] = React.useState(false); const [startTime, setStartTime]: [string, any] = React.useState(secondsToHms(position)); @@ -46,14 +48,22 @@ function SocialShare(props: Props) { const rewardsApproved = user && user.is_reward_approved; const lbryUrl: string = generateLbryContentUrl(canonicalUrl, permanentUrl); const lbryWebUrl: string = generateLbryWebUrl(lbryUrl); - const encodedLbryURL: string = generateEncodedLbryURL(SHARE_DOMAIN, lbryWebUrl, includeStartTime, startTimeSeconds); + const includedCollectionId = collectionId && includeCollectionId ? collectionId : null; + const encodedLbryURL: string = generateEncodedLbryURL( + SHARE_DOMAIN, + lbryWebUrl, + includeStartTime, + startTimeSeconds, + includedCollectionId + ); const shareUrl: string = generateShareUrl( SHARE_DOMAIN, lbryUrl, referralCode, rewardsApproved, includeStartTime, - startTimeSeconds + startTimeSeconds, + includedCollectionId ); const downloadUrl = `${generateDownloadUrl(name, claimId)}`; @@ -70,7 +80,7 @@ function SocialShare(props: Props) { {showStartAt && ( -
+
)} + {Boolean(collectionId) && ( +
+ setIncludeCollectionId(!includeCollectionId)} + checked={includeCollectionId} + label={__('Include List ID')} + /> +
+ )}