Files
DorkNet/DorkNet.Server/site/src/components/PhotoCard.tsx
T
Alexa d471b418b9 Import march-2020-03-10 from private repo (scrubbed 2026-05-27)
Targets Rec Room 2020.03.10 client (also serves 2020.03.06).

Re-import after adding:
- DorkNet.ClientMod/dorknet-clientmod.json.template — config schema
  the launcher's manifest-driven patcher renders into UserData/.
- tools/build-patcher-zip.ps1 — produces dorknet-clientpatch-{key}.zip
  for v1-march-* Release uploads.
- .github/workflows/release.yml — on tag push publishes both
  dorknet-server-march_2020_03_10-win-x64.zip and
  dorknet-clientpatch-march_2020_03_10.zip as Release assets.

Same scrub rules as december; tools/build-patcher-zip.ps1 added to
the maintainer-side allow-list so it survives.
2026-05-27 01:06:12 +03:00

56 lines
2.2 KiB
TypeScript

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 }) {
return (
<Link
to={`/photo/${photo.id}`}
className="card overflow-hidden block transition-transform hover:-translate-y-0.5 hover:shadow-lg"
>
<div className="relative">
<img
src={photo.imageUrl}
alt={photo.caption || `Photo by ${photo.uploaderDisplayName}`}
loading="lazy"
onError={(e) => { (e.currentTarget as HTMLImageElement).style.display = 'none'; }}
className="w-full h-auto bg-ink-800 object-cover"
/>
</div>
<div className="p-2.5">
<Link
to={`/players/${photo.uploaderPlayerId}`}
onClick={e => e.stopPropagation()}
className="flex items-center gap-2 group"
>
<PlayerAvatar
name={photo.uploaderProfileImageName}
displayName={photo.uploaderDisplayName}
size={24}
/>
<span className="text-xs text-ink-200 group-hover:text-ink-50 truncate">
{photo.uploaderDisplayName}
</span>
</Link>
{photo.caption && (
<p className="mt-2 text-xs text-ink-300 line-clamp-2">{photo.caption}</p>
)}
<div className="mt-2 flex items-center justify-between text-[11px] text-ink-400">
<span title="cheers">♥ {num(photo.cheerCount)}</span>
{photo.roomName
? <span className="font-mono truncate ml-2" title={`Room: ${photo.roomName}`}>^{photo.roomName}</span>
: <span>{relativeTime(photo.createdAt)}</span>
}
</div>
</div>
</Link>
);
}