Fix contextual sharing links

This commit is contained in:
Sam Becker 2023-11-08 20:37:08 -06:00
parent a1a1ff6f3a
commit 89f18602f6
2 changed files with 20 additions and 14 deletions

View File

@ -75,13 +75,15 @@ export default function PhotoDetailPage({
<PhotoLarge <PhotoLarge
key={photo.id} key={photo.id}
photo={photo} photo={photo}
tag={tag} primaryTag={tag}
priority priority
prefetchShare prefetchShare
shareCamera={camera !== undefined}
shouldScrollOnShare={false}
showCamera={!camera} showCamera={!camera}
showSimulation={!simulation} showSimulation={!simulation}
shouldShareTag={tag !== undefined}
shouldShareCamera={camera !== undefined}
shouldShareSimulation={simulation !== undefined}
shouldScrollOnShare={false}
/>, />,
]} ]}
/> />

View File

@ -13,24 +13,28 @@ import PhotoFilmSimulation from
export default function PhotoLarge({ export default function PhotoLarge({
photo, photo,
tag, primaryTag,
priority, priority,
prefetchShare, prefetchShare,
shouldScrollOnShare,
showCamera = true, showCamera = true,
showSimulation = true, showSimulation = true,
shareCamera, shouldShareTag,
shouldShareCamera,
shouldShareSimulation,
shouldScrollOnShare,
}: { }: {
photo: Photo photo: Photo
tag?: string primaryTag?: string
priority?: boolean priority?: boolean
prefetchShare?: boolean prefetchShare?: boolean
shouldScrollOnShare?: boolean
showCamera?: boolean showCamera?: boolean
showSimulation?: boolean showSimulation?: boolean
shareCamera?: boolean shouldShareTag?: boolean
shouldShareCamera?: boolean
shouldShareSimulation?: boolean
shouldScrollOnShare?: boolean
}) { }) {
const tagsToShow = photo.tags.filter(t => t !== tag); const tagsToShow = photo.tags.filter(t => t !== primaryTag);
const camera = cameraFromPhoto(photo); const camera = cameraFromPhoto(photo);
@ -50,7 +54,7 @@ export default function PhotoLarge({
<ImageLarge <ImageLarge
className="w-full" className="w-full"
alt={titleForPhoto(photo)} alt={titleForPhoto(photo)}
href={pathForPhoto(photo, tag)} href={pathForPhoto(photo, primaryTag)}
src={photo.url} src={photo.url}
aspectRatio={photo.aspectRatio} aspectRatio={photo.aspectRatio}
blurData={photo.blurData} blurData={photo.blurData}
@ -124,9 +128,9 @@ export default function PhotoLarge({
<ShareButton <ShareButton
path={pathForPhotoShare( path={pathForPhotoShare(
photo, photo,
tag, shouldShareTag ? primaryTag : undefined,
shareCamera ? camera : undefined, shouldShareCamera ? camera : undefined,
photo.filmSimulation, shouldShareSimulation ? photo.filmSimulation : undefined,
)} )}
prefetch={prefetchShare} prefetch={prefetchShare}
shouldScroll={shouldScrollOnShare} shouldScroll={shouldScrollOnShare}