From 15042ccc761510ca35bf751ae74646568d2761bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Padez?= Date: Fri, 4 Sep 2026 18:01:15 +0100 Subject: [PATCH] a gallery is a carousel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It always rendered as one — data-carousel, a snap track, two arrows, driven by carousel.client.js. The entity was the last thing still calling it something else, and that collided with the site's own Gallery section: two nav rows reading Gallery and Galleries, meaning a list of objects and a list of photograph sets. GalleriesPanel, GalleryPicker and GalleryItems become Carousels*, the endpoint becomes /fofos-admin/carousels, the block kind becomes carousel and subject-gallery becomes subject-carousel. The publish allowlist follows the renamed tables. What did NOT move: GALLERY_CONFIG at /fofos-admin/gallery, subjects.ts's base '/gallery', and home_gallery_media. Those are the Gallery section and the legacy rows, and both are correct. Co-Authored-By: Claude Opus 5 (1M context) --- api/publish.ts | 6 +- web/{GalleryPicker.tsx => CarouselPicker.tsx} | 48 +++++++-------- web/DetailPanel.tsx | 4 +- web/EditorPanel.tsx | 2 +- web/canvas.ts | 4 +- web/file-actions.ts | 10 ++-- web/routes.ts | 4 +- web/sections.ts | 24 ++++---- web/sections/AddComponentDialog.tsx | 12 ++-- web/sections/BandBlocks.tsx | 2 +- .../{GalleryItems.tsx => CarouselItems.tsx} | 26 ++++----- ...{GalleriesPanel.tsx => CarouselsPanel.tsx} | 38 ++++++------ web/sections/HomePanel.tsx | 24 ++++---- web/sections/PageBuilderPanel.tsx | 58 +++++++++---------- web/sections/PartnersEditor.tsx | 4 +- web/sections/RecordsPanel.tsx | 2 +- web/sections/SubjectPanel.tsx | 24 ++++---- web/sections/subjects.ts | 2 +- web/thumbnail.ts | 2 +- 19 files changed, 148 insertions(+), 148 deletions(-) rename web/{GalleryPicker.tsx => CarouselPicker.tsx} (71%) rename web/sections/{GalleryItems.tsx => CarouselItems.tsx} (88%) rename web/sections/{GalleriesPanel.tsx => CarouselsPanel.tsx} (90%) diff --git a/api/publish.ts b/api/publish.ts index 970f792..df9d9ce 100644 --- a/api/publish.ts +++ b/api/publish.ts @@ -41,7 +41,7 @@ const CONTENT_TABLES = [ /* The page builder's own tables, and the reason they are FIRST. - Parents before children: a section belongs to a page and a component to a section. `galleries` sits + Parents before children: a section belongs to a page and a component to a section. `carousels` sits below them because a gallery block names a set by id — carried in JSON rather than as a foreign key, so nothing enforces the order, which is exactly why it is written down. @@ -60,8 +60,8 @@ const CONTENT_TABLES = [ 'home_content', 'home_gallery_media', 'about_content', - 'galleries', - 'gallery_items', + 'carousels', + 'carousel_items', 'collections', 'collection_items', 'collection_item_media', diff --git a/web/GalleryPicker.tsx b/web/CarouselPicker.tsx similarity index 71% rename from web/GalleryPicker.tsx rename to web/CarouselPicker.tsx index 2937dda..e5881d0 100644 --- a/web/GalleryPicker.tsx +++ b/web/CarouselPicker.tsx @@ -5,17 +5,17 @@ import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/u import { readableError } from './errors'; /** - * Choose WHICH gallery a block shows. + * Choose WHICH carousel a block shows. * * ── A reference, not a copy ── * - * `galleries` is a named, ordered set built to be shown in more than one place — the old home carousel - * already read one by id. So a gallery block stores that id and owns nothing else: reordering the set + * `carousels` is a named, ordered set built to be shown in more than one place — the old home carousel + * already read one by id. So a carousel block stores that id and owns nothing else: reordering the set * reorders every block pointing at it, and a photograph swapped there is swapped everywhere. That is * the whole reason the set has a name instead of being a list of files on a page. * * It follows that this picker chooses a SET, and editing what is IN the set happens where the set - * lives — under Galleries. A block that could also rearrange its own pictures would be a second place + * lives — under Carousels. A block that could also rearrange its own pictures would be a second place * to do the same job, and the two would disagree. * * ── No thumbnails, deliberately ── @@ -23,17 +23,17 @@ import { readableError } from './errors'; * The plugin has no way to address a rendition: `MediaPicker` hands that job to the platform's file * browser, and every path stored here names an ORIGINAL that a browser cannot display. Rather than * build a second, worse image pipeline for a dialog, this shows the name and the count — which is what - * tells two galleries apart, since the name is the thing somebody chose. + * tells two carousels apart, since the name is the thing somebody chose. */ -export type GallerySummary = { +export type CarouselSummary = { id: number; name: string; slug: string; items: unknown[]; }; -export const GalleryPicker = ({ +export const CarouselPicker = ({ open, onClose, onPick, @@ -41,7 +41,7 @@ export const GalleryPicker = ({ }: { open: boolean; onClose: () => void; - onPick: (galleryId: number) => void; + onPick: (carouselId: number) => void; /** The one this block already shows, so reopening the picker says where it stands. */ selected?: number | null; }) => { @@ -49,19 +49,19 @@ export const GalleryPicker = ({ const clientRef = useRef(client); clientRef.current = client; - const [galleries, setGalleries] = useState(null); + const [carousels, setCarousels] = useState(null); const [error, setError] = useState(null); - // Re-read on every open rather than once. A gallery created in the other panel while this session + // Re-read on every open rather than once. A carousel created in the other panel while this session // has been running would otherwise be missing from a list that looks complete. useEffect(() => { if (!open) return; - setGalleries(null); + setCarousels(null); setError(null); void (async () => { try { - const response = await clientRef.current.get<{ data: GallerySummary[] }>('/fofos-admin/galleries'); - setGalleries(response.data); + const response = await clientRef.current.get<{ data: CarouselSummary[] }>('/fofos-admin/carousels'); + setCarousels(response.data); } catch (failure) { setError(readableError(failure)); } @@ -72,12 +72,12 @@ export const GalleryPicker = ({ !next && onClose()}> - Choose a gallery + Choose a carousel {error &&

{error}

} - {!galleries && !error && ( + {!carousels && !error && (

Loading… @@ -85,29 +85,29 @@ export const GalleryPicker = ({ )} {/* Nothing to choose is a real state and says what to do about it, rather than an empty box. - Creating one belongs under Galleries — see the note above about one place per job. */} - {galleries?.length === 0 && ( + Creating one belongs under Carousels — see the note above about one place per job. */} + {carousels?.length === 0 && (

- No galleries yet. Make one under Galleries, then come back. + No carousels yet. Make one under Carousels, then come back.

)}
- {galleries?.map((gallery) => { - const count = Array.isArray(gallery.items) ? gallery.items.length : 0; - const current = gallery.id === selected; + {carousels?.map((carousel) => { + const count = Array.isArray(carousel.items) ? carousel.items.length : 0; + const current = carousel.id === selected; return (