Contact form and Partners, placed in one click

Both hold nothing, so adding one opens no editor: a dialog with no field on it is a step that exists
only to be got past. The picker itself answers the opposite way for the kinds that DO have a choice
to make, which is the distinction worth keeping.

The canvas draws no Edit button for them either — an Edit that opens nothing is worse than no Edit.
It asks the panel rather than holding a list of kinds, because which kinds are editable is the same
knowledge that decides which editor opens, and that already lives there. Absent means editable, so a
caller that has never thought about it gets what it had.

The Spacing dialog's label became a map. It was two kinds and readable as a ternary, then three and
not.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-31 07:08:30 +01:00
co-authored by Claude Opus 5
parent 48c744372b
commit a4dfb3c81a
3 changed files with 85 additions and 9 deletions
+11 -2
View File
@@ -1,4 +1,4 @@
import { Images, Type, Video, type LucideIcon } from 'lucide-react';
import { Handshake, Images, Mail, Type, Video, type LucideIcon } from 'lucide-react';
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog';
/**
@@ -23,7 +23,7 @@ import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/u
* A kind the server would accept and this has never heard of is not creatable anyway.
*/
export type ComponentKind = 'free-text' | 'video' | 'gallery';
export type ComponentKind = 'free-text' | 'video' | 'gallery' | 'contact-form' | 'partners';
type Choice = {
kind: ComponentKind | null;
@@ -45,6 +45,15 @@ const CHOICES: Choice[] = [
{ kind: null, label: 'Image', hint: 'One picture from the media store', Icon: Images },
{ kind: 'video', label: 'Video', hint: 'No controls, a poster, autoplay and loop', Icon: Video },
{ kind: 'gallery', label: 'Gallery', hint: 'A named set of media', Icon: Images },
/*
Two that place something the site already draws.
Nothing to choose and nothing to type, so adding one is a single click and there is no editor
behind it. They are here rather than hidden because a page is built by picking blocks, and a block
somebody cannot find is a block that does not exist.
*/
{ kind: 'contact-form', label: 'Contact form', hint: 'The site\'s form, as it is', Icon: Mail },
{ kind: 'partners', label: 'Partners', hint: 'The partner logos, from Site', Icon: Handshake },
];
export const AddComponentDialog = ({