import { Link } from 'react-router-dom'; import type { SitePhoto } from '../lib/types'; import { PlayerAvatar } from './PlayerAvatar'; import { num, relativeTime } from '../lib/format'; // Single-photo tile for the masonry feed. The outer block is a Link // to the photo-detail route; the avatar inside is its OWN Link to the // uploader profile — the inner Link wins click-precedence because // React Router stops event propagation. event.stopPropagation on the // inner anchor preserves that even on touch devices where iOS // occasionally fires both handlers. export function PhotoCard({ photo }: { photo: SitePhoto }) { const tagged = photo.taggedPlayers ?? []; return (
{photo.caption { (e.currentTarget as HTMLImageElement).style.display = 'none'; }} className="w-full h-auto bg-ink-800 object-cover" />
e.stopPropagation()} className="flex items-center gap-2 group" > {photo.uploaderDisplayName} {photo.caption && (

{photo.caption}

)} {tagged.length > 0 && (
With
{tagged.slice(0, 3).map(p => ( e.stopPropagation()} className="inline-flex max-w-[8rem] items-center gap-1 rounded-md bg-ink-800/70 px-1.5 py-0.5 text-ink-200 hover:text-ink-50" > {p.displayName || p.username} ))} {tagged.length > 3 && +{tagged.length - 3}}
)}
♥ {num(photo.cheerCount)} {photo.roomName && ( ^{photo.roomName} )} {photo.roomName && · } {relativeTime(photo.createdAt)}
); }