feat(events): show every photo on the event page without folders
CI / build (push) Has been cancelled

Folders were an implementation detail leaking into the event workflow: every
upload needed a folder first and photos were split across pages. Uploads now
land in a single implicit "Photos" folder and the event page renders one
gallery with the uploader and an edited-only download.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
2026-11-21 14:37:57 +00:00
parent ebe0c77f7e
commit fac9b96cca
13 changed files with 416 additions and 459 deletions
+13 -12
View File
@@ -45,6 +45,8 @@ function GalleryImage({ src, alt }: { src: string; alt: string }) {
export interface GalleryPhoto {
id: string;
/** Storage folder the photo lives in; photos are shown as one event gallery. */
folderId: string;
filename: string;
sizeBytes: number;
kind: "raw" | "image";
@@ -112,13 +114,13 @@ function extensionOf(filename: string): string {
}
/**
* Folder gallery + uploader. Files upload one at a time as raw request bodies,
* which keeps a 100 MB RAW frame out of memory and gives usable per-file
* progress on a phone. RAW files show a file tile; JPEG/PNG/WebP preview.
* The event's photo gallery + uploader. Files upload one at a time as raw
* request bodies, which keeps a 100 MB RAW frame out of memory and gives usable
* per-file progress on a phone. RAW files show a file tile; JPEG/PNG/WebP
* preview.
*/
export function PhotoGallery({
eventId,
folderId,
photos,
canContribute,
canManage,
@@ -127,7 +129,6 @@ export function PhotoGallery({
storageMessage,
}: {
eventId: string;
folderId: string;
photos: GalleryPhoto[];
canContribute: boolean;
canManage: boolean;
@@ -169,7 +170,7 @@ export function PhotoGallery({
setProgress({ done: index, total: files.length, current: file.name });
try {
const res = await fetch(
`/api/events/${eventId}/folders/${folderId}/photos?name=${encodeURIComponent(file.name)}`,
`/api/events/${eventId}/photos?name=${encodeURIComponent(file.name)}`,
{
method: "POST",
headers: {
@@ -209,7 +210,7 @@ export function PhotoGallery({
setNotice(
[
uploaded > 0 ? `${uploaded} uploaded` : null,
duplicates > 0 ? `${duplicates} already in this folder` : null,
duplicates > 0 ? `${duplicates} already on this event` : null,
]
.filter(Boolean)
.join(" · ") || null,
@@ -225,7 +226,7 @@ export function PhotoGallery({
setError(null);
try {
const res = await fetch(
`/api/events/${eventId}/folders/${folderId}/photos/${photo.id}`,
`/api/events/${eventId}/folders/${photo.folderId}/photos/${photo.id}`,
{ method: "DELETE" },
);
const data = (await res.json().catch(() => ({}))) as { error?: string };
@@ -252,7 +253,7 @@ export function PhotoGallery({
{canContribute && (
<div className="space-y-2 rounded-md border border-border p-3">
<p className="text-sm font-medium">Upload photos to this folder</p>
<p className="text-sm font-medium">Upload photos to this event</p>
<div className="flex flex-wrap items-center gap-2">
<Input
ref={inputRef}
@@ -310,12 +311,12 @@ export function PhotoGallery({
{photos.length === 0 ? (
<p className="py-10 text-center text-sm text-muted-foreground">
This folder is empty.
No photos yet. Upload the first frame for this event.
</p>
) : (
<ul className="grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4">
{photos.map((photo) => {
const src = `/api/events/${eventId}/folders/${folderId}/photos/${photo.id}`;
const src = `/api/events/${eventId}/folders/${photo.folderId}/photos/${photo.id}`;
const editable = photo.editable && storageReady;
const canRemove = canManage || photo.uploaderId === currentUserId;
const version = photo.editedAt ? Date.parse(photo.editedAt) : 0;
@@ -440,7 +441,7 @@ export function PhotoGallery({
<PhotoViewer
key={viewing.id}
eventId={eventId}
folderId={folderId}
folderId={viewing.folderId}
photo={{
id: viewing.id,
filename: viewing.filename,