the connection form — where fofos is, and the token — was reached through `?config=1` and a link in the detail header, because it was not one of the nine sections. it is now the tenth, called Administration, last in the nav. that removes the overlay and the second route to it. the two could disagree: the form covered whatever section was selected underneath, so the nav highlighted one thing while the panel showed another, and an unconfigured plugin rendered the form with no header at all — which reads as the selected section being broken rather than as one setup step not done yet. unconfigured now goes to Administration and the header says so. `site` and `administration` are deliberately separate and the file says why. Site settings is the CLIENT's — partners, social links, contact details, all of it public copy. Administration is Officer's end: how this plugin reaches fofos, and whatever else it will need to know. nothing in it ever appears on the site, and the people who touch the two are not the same people. `path: null`, alone among the sections: it reads nothing from fofos, which is why it keeps working when fofos is unreachable and the others do not. the header's settings link is replaced by the section's own hint, so the row still says what it is once you are in it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
149 lines
4.3 KiB
TypeScript
149 lines
4.3 KiB
TypeScript
import type { LucideIcon } from 'lucide-react';
|
|
import { Home, Info, Layers, Images, Handshake, Sparkles, Wrench, Settings, Mail, Cog } from 'lucide-react';
|
|
|
|
/**
|
|
* The sections of the fofos admin, in nav order.
|
|
*
|
|
* ── The order is the client's site, not the database's ──
|
|
*
|
|
* It follows the sitemap: the pages someone edits most, first. Site settings, Messages and
|
|
* Administration sit at the bottom because they are not pages — the site's settings, an inbox, and the
|
|
* plugin's own machinery.
|
|
*
|
|
* ── `site` and `administration` are different things ──
|
|
*
|
|
* "Site settings" is the CLIENT's — partners, social links, contact details, all of it public copy that
|
|
* whoever edits the site edits. "Administration" is OFFICER's end: where fofos is, how to reach it, and
|
|
* whatever else this plugin needs to know to do its job. One is content, the other is plumbing, and the
|
|
* people who touch them are not the same people. Nothing in Administration ever appears on the site.
|
|
*
|
|
* ── `built` ──
|
|
*
|
|
* The panels arrive one section at a time, each verified against the live site before the next is
|
|
* started. A section that is not built yet says so, plainly, with what it will do — which is a better
|
|
* answer than a nav that hides most of itself and gives no sense of what is coming.
|
|
*
|
|
* It mirrors `built` in fofos's own `src/apps/web/site-map.ts`, and for the same reason: one list, so
|
|
* the nav and what actually renders cannot disagree.
|
|
*/
|
|
|
|
export type SectionKey =
|
|
| 'administration'
|
|
| 'messages'
|
|
| 'site'
|
|
| 'about'
|
|
| 'home'
|
|
| 'gallery'
|
|
| 'drops'
|
|
| 'collabs'
|
|
| 'collections'
|
|
| 'services';
|
|
|
|
export type Section = {
|
|
key: SectionKey;
|
|
label: string;
|
|
icon: LucideIcon;
|
|
/** One line under the label in the nav — what this section is, for somebody who has not opened it. */
|
|
hint: string;
|
|
/** The fofos path this reads, relative to the plugin's mount. Null when nothing is built. */
|
|
path: string | null;
|
|
built: boolean;
|
|
};
|
|
|
|
export const SECTIONS: Section[] = [
|
|
{
|
|
key: 'home',
|
|
label: 'Home',
|
|
icon: Home,
|
|
hint: 'The hero, the intro, and the gallery',
|
|
path: '/fofos-admin/home',
|
|
built: false,
|
|
},
|
|
{
|
|
key: 'about',
|
|
label: 'About Us',
|
|
icon: Info,
|
|
hint: 'The header photograph and the copy',
|
|
path: '/fofos-admin/about',
|
|
built: false,
|
|
},
|
|
{
|
|
key: 'collections',
|
|
label: 'Collections',
|
|
icon: Layers,
|
|
hint: 'Collections, and the items in them',
|
|
path: '/fofos-admin/collections',
|
|
built: false,
|
|
},
|
|
{
|
|
key: 'gallery',
|
|
label: 'Gallery',
|
|
icon: Images,
|
|
hint: 'Standalone pieces',
|
|
path: '/fofos-admin/gallery',
|
|
built: false,
|
|
},
|
|
{
|
|
key: 'collabs',
|
|
label: 'Collabs',
|
|
icon: Handshake,
|
|
hint: 'Projects with other people',
|
|
path: '/fofos-admin/collabs',
|
|
built: false,
|
|
},
|
|
{
|
|
key: 'drops',
|
|
label: 'Drops',
|
|
icon: Sparkles,
|
|
hint: 'Releases',
|
|
path: '/fofos-admin/drops',
|
|
built: false,
|
|
},
|
|
{
|
|
key: 'services',
|
|
label: 'Services',
|
|
icon: Wrench,
|
|
hint: 'A fixed tree — the words, not the shape',
|
|
path: '/fofos-admin/services',
|
|
built: false,
|
|
},
|
|
{
|
|
key: 'site',
|
|
label: 'Site settings',
|
|
icon: Settings,
|
|
hint: 'Partners, social links, contact details',
|
|
path: '/fofos-admin/site',
|
|
built: false,
|
|
},
|
|
{
|
|
key: 'messages',
|
|
label: 'Messages',
|
|
icon: Mail,
|
|
hint: 'What people sent through the contact form',
|
|
path: '/fofos-admin/messages',
|
|
built: true,
|
|
},
|
|
{
|
|
/*
|
|
Last, and `path: null` — it reads nothing from fofos. Every other section is a window onto the
|
|
client's site; this one is the window onto the connection itself, which is why it keeps working
|
|
when fofos is unreachable and the others do not.
|
|
*/
|
|
key: 'administration',
|
|
label: 'Administration',
|
|
icon: Cog,
|
|
hint: 'Where fofos is, and the token to reach it',
|
|
path: null,
|
|
built: true,
|
|
},
|
|
];
|
|
|
|
/** Where the detail panel goes when the URL says nothing, or says something it does not recognise. */
|
|
export const DEFAULT_SECTION: SectionKey = 'messages';
|
|
|
|
export const isSectionKey = (value: string | null): value is SectionKey =>
|
|
SECTIONS.some((section) => section.key === value);
|
|
|
|
export const sectionFor = (key: SectionKey): Section =>
|
|
SECTIONS.find((section) => section.key === key) ?? SECTIONS[SECTIONS.length - 1]!;
|