import { Link } from 'react-router'; import { Copy, ImageOff, Link2 } from 'lucide-react'; import { toast } from 'sonner'; import { Button } from '@/components/ui/button'; import { useClient } from 'hooks/useClient'; import { ALBUM_PARAM, formatShortDate, photosSectionPath, thumbUrl } from './shared'; import { useAlbums, useSharedLinks } from './usePhotosData'; import { copyToClipboard } from 'helpers/clipboard'; // Sharing: shared albums and shared links, read-mostly. // // The link URL is Immich's own public URL, not an Officer route — a shared link is meant to be opened by // someone who has no Officer account, so it must point at the Immich instance directly. The proxy deliberately // never learns that public URL, so this copies the key and the owner pairs it with their own instance address. export const SharingSection = () => { const { token } = useClient(); const { data: links, isLoading } = useSharedLinks(); const { data: albums } = useAlbums(); const sharedAlbums = (albums ?? []).filter((album) => album.shared || album.hasSharedLink); return (

Sharing

Shared albums

{sharedAlbums.length === 0 ? (

No shared albums.

) : (
{sharedAlbums.map((album) => (
{album.albumThumbnailAssetId ? ( ) : (
)}

{album.albumName}

{album.assetCount} items · {album.albumUsers.length} people

))}
)}

Shared links

{isLoading &&

Loading…

} {!isLoading && (links ?? []).length === 0 && (

No shared links.

)}
    {(links ?? []).map((link) => (
  • {link.album?.albumName ?? link.description ?? `${link.assets.length} items`}

    {link.expiresAt ? `Expires ${formatShortDate(link.expiresAt)}` : 'No expiry'} {link.allowDownload ? ' · download' : ''} {link.allowUpload ? ' · upload' : ''}

  • ))}
); };