'use client'; import { Photo, altTextForPhoto, doesPhotoNeedBlurCompatibility, shouldShowCameraDataForPhoto, shouldShowExifDataForPhoto, titleForPhoto, } from '.'; import SiteGrid from '@/components/SiteGrid'; import ImageLarge from '@/components/image/ImageLarge'; import { clsx } from 'clsx/lite'; import Link from 'next/link'; import { pathForFocalLength, pathForPhoto, } from '@/site/paths'; import PhotoTags from '@/tag/PhotoTags'; import ShareButton from '@/share/ShareButton'; import DownloadButton from '@/components/DownloadButton'; import PhotoCamera from '../camera/PhotoCamera'; import { cameraFromPhoto } from '@/camera'; import PhotoFilmSimulation from '@/simulation/PhotoFilmSimulation'; import { sortTags } from '@/tag'; import DivDebugBaselineGrid from '@/components/DivDebugBaselineGrid'; import PhotoLink from './PhotoLink'; import { SHOULD_PREFETCH_ALL_LINKS, ALLOW_PUBLIC_DOWNLOADS, } from '@/site/config'; import AdminPhotoMenuClient from '@/admin/AdminPhotoMenuClient'; import { RevalidatePhoto } from './InfinitePhotoScroll'; import { useRef } from 'react'; import useOnVisible from '@/utility/useOnVisible'; import PhotoDate from './PhotoDate'; import { useAppState } from '@/state/AppState'; export default function PhotoLarge({ photo, className, primaryTag, priority, prefetch = SHOULD_PREFETCH_ALL_LINKS, prefetchRelatedLinks = SHOULD_PREFETCH_ALL_LINKS, revalidatePhoto, showTitle = true, showTitleAsH1, showCamera = true, showSimulation = true, shouldShare = true, shouldShareTag, shouldShareCamera, shouldShareSimulation, shouldShareFocalLength, includeFavoriteInAdminMenu, onVisible, }: { photo: Photo className?: string primaryTag?: string priority?: boolean prefetch?: boolean prefetchRelatedLinks?: boolean revalidatePhoto?: RevalidatePhoto showTitle?: boolean showTitleAsH1?: boolean showCamera?: boolean showSimulation?: boolean shouldShare?: boolean shouldShareTag?: boolean shouldShareCamera?: boolean shouldShareSimulation?: boolean shouldShareFocalLength?: boolean shouldScrollOnShare?: boolean includeFavoriteInAdminMenu?: boolean onVisible?: () => void }) { const ref = useRef(null); const tags = sortTags(photo.tags, primaryTag); const camera = cameraFromPhoto(photo); const showCameraContent = showCamera && shouldShowCameraDataForPhoto(photo); const showTagsContent = tags.length > 0; const showExifContent = shouldShowExifDataForPhoto(photo); useOnVisible(ref, onVisible); const { arePhotosMatted, isUserSignedIn } = useAppState(); const hasTitle = showTitle && Boolean(photo.title); const hasTitleContent = hasTitle || Boolean(photo.caption); const hasMetaContent = showCameraContent || showTagsContent || showExifContent; const hasNonDateContent = hasTitleContent || hasMetaContent; const renderPhotoLink = () => ; return (
= 1 ? 'h-[80%]' : 'h-[90%]', )}>
} contentSide={ {/* Meta */}
{hasTitle && (showTitleAsH1 ?

{renderPhotoLink()}

: renderPhotoLink())}
{photo.caption &&
{photo.caption}
} {(showCameraContent || showTagsContent) &&
{showCameraContent && } {showTagsContent && }
}
{/* EXIF Data */}
{showExifContent && <>
  • {photo.focalLength && {photo.focalLengthFormatted} } {photo.focalLengthIn35MmFormatFormatted && <> {' '} {photo.focalLengthIn35MmFormatFormatted} }
  • {photo.fNumberFormatted}
  • {photo.exposureTimeFormatted}
  • {photo.isoFormatted}
  • {photo.exposureCompensationFormatted ?? '0ev'}
{showSimulation && photo.filmSimulation && } }
{shouldShare && } {ALLOW_PUBLIC_DOWNLOADS && }
} /> ); };