{
- navigator.clipboard.writeText(shareUrl);
+ navigator.clipboard.writeText(pathShare);
toast(
'Link to photo copied',
{ icon: },
diff --git a/src/photo/PhotoGrid.tsx b/src/photo/PhotoGrid.tsx
index c627b1e3..3ebb0f8f 100644
--- a/src/photo/PhotoGrid.tsx
+++ b/src/photo/PhotoGrid.tsx
@@ -13,6 +13,7 @@ export default function PhotoGrid({
tag,
offset = 0,
fast,
+ animate = true,
animateOnFirstLoadOnly,
staggerOnFirstLoadOnly = true,
showMore,
@@ -35,6 +36,7 @@ export default function PhotoGrid({
'grid-cols-2 sm:grid-cols-4 md:grid-cols-3 lg:grid-cols-4',
'items-center',
)}
+ type={animate === false ? 'none' : undefined}
duration={fast ? 0.3 : undefined}
staggerDelay={0.075}
distanceOffset={40}
diff --git a/src/photo/PhotoLarge.tsx b/src/photo/PhotoLarge.tsx
index e0202e2c..1510411c 100644
--- a/src/photo/PhotoLarge.tsx
+++ b/src/photo/PhotoLarge.tsx
@@ -3,9 +3,9 @@ import SiteGrid from '@/components/SiteGrid';
import ImageLarge from '@/components/ImageLarge';
import { cc } from '@/utility/css';
import Link from 'next/link';
-import { pathForPhoto } from '@/site/paths';
-import SharePhotoButton from './SharePhotoButton';
+import { pathForPhoto, pathForPhotoShare } from '@/site/paths';
import PhotoTags from '@/tag/PhotoTags';
+import ShareButton from '@/components/ShareButton';
export default function PhotoLarge({
photo,
@@ -99,9 +99,8 @@ export default function PhotoLarge({
{photo.takenAtNaiveFormatted}
-
diff --git a/src/photo/PhotoOGTile.tsx b/src/photo/PhotoOGTile.tsx
index 20c39525..2dd8ce87 100644
--- a/src/photo/PhotoOGTile.tsx
+++ b/src/photo/PhotoOGTile.tsx
@@ -1,17 +1,10 @@
-'use client';
-
-import { useEffect, useState } from 'react';
import {
Photo,
- ogImageDescriptionForPhoto,
+ descriptionForPhoto,
titleForPhoto,
} from '@/photo';
-import { cc } from '@/utility/css';
-import Link from 'next/link';
-import { BiError } from 'react-icons/bi';
import { absolutePathForPhotoImage, pathForPhoto } from '@/site/paths';
-import Spinner from '@/components/Spinner';
-import { IMAGE_OG_SIZE } from './image-response';
+import OGTile from '@/components/OGTile';
export type OGLoadingState = 'unloaded' | 'loading' | 'loaded' | 'failed';
@@ -30,102 +23,17 @@ export default function PhotoOGTile({
riseOnHover?: boolean
retryTime?: number
}) {
- const [loadingStateInternal, setLoadingStateInternal] =
- useState(loadingStateExternal ?? 'unloaded');
-
- const loadingState = loadingStateExternal ?? loadingStateInternal;
-
- useEffect(() => {
- if (
- !loadingStateExternal &&
- loadingStateInternal === 'unloaded'
- ) {
- setLoadingStateInternal('loading');
- }
- }, [loadingStateExternal, loadingStateInternal]);
-
- const { width, height, ratio } = IMAGE_OG_SIZE;
-
return (
-
-
- {loadingState === 'loading' &&
-
-
-
}
- {loadingState === 'failed' &&
-
-
-
}
- {(loadingState === 'loading' || loadingState === 'loaded') &&
-
})
{
- if (onLoad) {
- onLoad();
- } else {
- setLoadingStateInternal('loaded');
- }
- }}
- onError={() => {
- if (onFail) {
- onFail();
- } else {
- setLoadingStateInternal('failed');
- }
- if (retryTime !== undefined) {
- setTimeout(() => {
- setLoadingStateInternal('loading');
- }, retryTime);
- }
- }}
- />}
-
-
-
- {titleForPhoto(photo)}
-
-
- {ogImageDescriptionForPhoto(photo)}
-
-
-
+
);
};
diff --git a/src/photo/PhotoShareModal.tsx b/src/photo/PhotoShareModal.tsx
new file mode 100644
index 00000000..a78c5cb7
--- /dev/null
+++ b/src/photo/PhotoShareModal.tsx
@@ -0,0 +1,22 @@
+import PhotoOGTile from '@/photo/PhotoOGTile';
+import { absolutePathForPhoto, pathForPhoto } from '@/site/paths';
+import { Photo } from '.';
+import ShareModal from '@/components/ShareModal';
+
+export default function PhotoShareModal({
+ photo,
+ tag,
+}: {
+ photo: Photo
+ tag?: string
+}) {
+ return (
+
+
+
+ );
+};
diff --git a/src/photo/index.ts b/src/photo/index.ts
index 31407a19..31457165 100644
--- a/src/photo/index.ts
+++ b/src/photo/index.ts
@@ -115,7 +115,7 @@ export const photoStatsAsString = (photo: Photo) => [
photo.isoFormatted,
].join(' ');
-export const ogImageDescriptionForPhoto = (photo: Photo) =>
+export const descriptionForPhoto = (photo: Photo) =>
photo.takenAtNaiveFormatted?.toUpperCase();
export const getPreviousPhoto = (photo: Photo, photos: Photo[]) => {
diff --git a/src/site/paths.ts b/src/site/paths.ts
index 9d5a69ee..b286f04e 100644
--- a/src/site/paths.ts
+++ b/src/site/paths.ts
@@ -5,6 +5,8 @@ const PREFIX_PHOTO = '/p';
const PREFIX_TAG = '/t';
const PREFIX_ADMIN = '/admin';
+const SHARE = 'share';
+
export const PATH_ADMIN_PHOTOS = `${PREFIX_ADMIN}/photos`;
export const PATH_ADMIN_UPLOAD = `${PREFIX_ADMIN}/uploads`;
export const PATH_ADMIN_UPLOAD_BLOB_HANDLER = `${PATH_ADMIN_UPLOAD}/blob`;
@@ -17,13 +19,16 @@ export const pathForPhoto = (photo: Photo, tag?: string) =>
: `${PREFIX_PHOTO}/${photo.id}`;
export const pathForPhotoShare = (photo: Photo, tag?: string) =>
- `${pathForPhoto(photo, tag)}/share`;
+ `${pathForPhoto(photo, tag)}/${SHARE}`;
export const pathForPhotoEdit = (photo: Photo) =>
`${PATH_ADMIN_PHOTOS}/${photo.id}/edit`;
export const pathForTag = (tag: string) => `${PREFIX_TAG}/${tag}`;
+export const pathForTagShare = (tag: string) =>
+ `${pathForTag(tag)}/${SHARE}`;
+
export const absolutePathForPhoto = (photo: Photo, tag?: string) =>
`${BASE_URL}${pathForPhoto(photo, tag)}`;
diff --git a/src/tag/TagHeader.tsx b/src/tag/TagHeader.tsx
index 4790a1b1..0f25aa49 100644
--- a/src/tag/TagHeader.tsx
+++ b/src/tag/TagHeader.tsx
@@ -2,6 +2,8 @@ import { Photo, dateRangeForPhotos } from '@/photo';
import { cc } from '@/utility/css';
import PhotoTag from './PhotoTag';
import { descriptionForTaggedPhotos } from '.';
+import ShareButton from '@/components/ShareButton';
+import { pathForTagShare } from '@/site/paths';
export default function TagHeader({
tag,
@@ -25,12 +27,15 @@ export default function TagHeader({
)}>
{selectedPhotoIndex !== undefined
? `Tagged ${selectedPhotoIndex + 1} of ${photos.length}`
: descriptionForTaggedPhotos(photos)}
+ {selectedPhotoIndex === undefined &&
+ }
void
+ onFail?: () => void
+ riseOnHover?: boolean
+ retryTime?: number
+}) {
+ return (
+
+ );
+};
diff --git a/src/tag/TagShareModal.tsx b/src/tag/TagShareModal.tsx
new file mode 100644
index 00000000..55bff1cf
--- /dev/null
+++ b/src/tag/TagShareModal.tsx
@@ -0,0 +1,22 @@
+import { absolutePathForTag, pathForTag } from '@/site/paths';
+import { Photo } from '../photo';
+import ShareModal from '@/components/ShareModal';
+import TagOGTile from './TagOGTile';
+
+export default function TagShareModal({
+ tag,
+ photos,
+}: {
+ tag: string
+ photos: Photo[]
+}) {
+ return (
+
+
+
+ );
+};