Files
pastilhasandClaude Opus 5 5fb447cf21 the panels stop explaining themselves
"The About page, in the order it is shown: a header, the text about you, the product, and the
manifesto." above four bands headed Header, About us, Product and Manifesto. "The photograph at the top,
and the line over it" above a photograph at the top and a line over it. "Who you are" above a box headed
About us.

Every one was a caption for something already visible, and together they were most of the vertical
space before any content — so the actual work started below the fold on a laptop.

The person using this is not a developer and is not a child. A heading names a thing; a sentence
underneath saying what the thing is says it twice and trusts them less each time.

Removed from About, Home, Galleries and the record sections. What stays is anything reporting STATE
rather than describing furniture — a count of photographs, a loading line, an error, a save
confirmation — because those say something the screen does not.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-31 00:12:08 +01:00

78 lines
3.2 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* Gallery pieces, drops and collabs, as configurations of one panel.
*
* ── Why a configuration and not three screens ──
*
* The site's API already made this decision. `src/servers/api/admin/records.ts` is a factory and
* these three sections are configurations of it, because each is a titled record with an ordered list
* of media hanging off it and the only real differences are what the title is called and which extra
* fields the record carries.
*
* The htmx admin did have three screens — `src/apps/admin/{gallery,drops,collabs}/routes.tsx` are
* three copies of one file with the words changed — and that was defensible there, because each also
* carried its own markup. There is no markup to differ here either, so three panels would be three
* places to fix the same ordering bug.
*
* ── `fields` mirrors the server's allowlist, and only mirrors it ──
*
* What may actually be written is decided by `valuesFrom` in the site's `sections.ts`, per section,
* as an allowlist. This list is the FORM for those fields, not a second authority over them: adding a
* key here that the server does not accept produces an input that silently saves nothing. When they
* disagree, the server is right.
*/
export type FieldSpec = {
/** The wire name, snake_case, exactly as the server's allowlist spells it. */
key: string;
label: string;
/** A textarea rather than a single line. For prose that runs to a paragraph. */
long?: boolean;
/** Placeholder text, where the label alone leaves the intent unclear. */
hint?: string;
};
export type RecordsConfig = {
/** The plugin route, which the catch-all forwards to the site's `/api/admin/<same>`. */
path: string;
/** "piece", used in buttons and empty states. Lower case; the UI capitalises where it needs to. */
singular: string;
/** What this section calls its title. Collabs say "Project name" and that is the client's word. */
titleLabel: string;
fields: FieldSpec[];
};
export const GALLERY_CONFIG: RecordsConfig = {
path: '/fofos-admin/gallery',
singular: 'piece',
titleLabel: 'Title',
fields: [
{ key: 'descriptive_text', label: 'Description', long: true },
{ key: 'measurement', label: 'Measurements', hint: '120 × 80 cm' },
{ key: 'material', label: 'Material', hint: 'Wool, cotton backing' },
{ key: 'colors', label: 'Colours' },
{ key: 'production_notes', label: 'Production notes', long: true },
{ key: 'shipping_notes', label: 'Shipping notes', long: true },
],
};
export const DROPS_CONFIG: RecordsConfig = {
path: '/fofos-admin/drops',
singular: 'drop',
titleLabel: 'Title',
fields: [{ key: 'description', label: 'Description', long: true }],
};
/**
* Collabs call their title `project_name`, and it stays that way.
*
* The server publishes it under `title` as well so a generic client can read one field, and accepts
* `title` as an alias when creating. So this panel writes `title` like the other two and the column
* written is still project_name — see the note in the site's sections.ts.
*/
export const COLLABS_CONFIG: RecordsConfig = {
path: '/fofos-admin/collabs',
singular: 'collab',
titleLabel: 'Project name',
fields: [{ key: 'project_description', label: 'Description', long: true }],
};