From 916040eb70eafa31088371d03f8434e0410ca438 Mon Sep 17 00:00:00 2001 From: Z8MB1E Date: Sun, 22 Nov 2026 23:34:12 -0500 Subject: [PATCH] fix(npc-dialogue): style the draft dialog for the admin panel The admin bundle never loads src/app/(frontend)/styles.css, so the shadcn theme variables (--background, --popover, --border-input) do not exist inside a custom admin field. The brief dialog rendered transparent, and its portaled Radix Select could not take pointer events, so the dropdowns were keyboard only. - describe every surface explicitly in zinc, as NodeEditDialog already does - replace the four Radix Selects with native selects, which need no theme scope and work with mouse and keyboard - scroll the form body at 62vh instead of letting it collide with the footer - note the rule in src/lib/npc-dialogue/AGENTS.md and correct the root AGENTS.md shadcn sentence, which claimed the admin panel handles styling --- AGENTS.md | 4 +- .../npc-dialogue/GenerateDraftDialog.tsx | 210 ++++++++++-------- src/lib/npc-dialogue/AGENTS.md | 14 ++ 3 files changed, 137 insertions(+), 91 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 9acce4a9..0fe358b3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -188,7 +188,9 @@ In development, `postgresAdapter` uses `push: false` — run `bun run payload mi shadcn/ui components live in `src/components/ui/`. Use `bunx shadcn@latest add ` to add new ones. Frontend components in `src/components/frontend/`. Payload admin custom components referenced in `payload.config.ts` under `admin.components`. -**Rule**: always prefer shadcn/ui components (Dialog, Button, Input, Textarea, Select, etc.) over raw HTML elements or custom-built alternatives. Only build new components when no existing shadcn component fits the need. Do not override shadcn's default dark theme classes with custom `bg-*` `border-*` overrides — the admin panel's theme handles styling. +**Rule**: always prefer shadcn/ui components (Dialog, Button, Input, Textarea, Select, etc.) over raw HTML elements or custom-built alternatives. Only build new components when no existing shadcn component fits the need. Do not override shadcn's default dark theme classes with custom `bg-*` `border-*` overrides on the **frontend**; the site theme handles styling. + +**Exception, custom admin field components**: the admin bundle never loads `src/app/(frontend)/styles.css`, so `--background`, `--popover`, `--border-input` and friends do not exist there. Inside the admin panel, style every surface explicitly in zinc (`bg-zinc-800`/`bg-zinc-900`, `border-white/20`, `text-white`) as `src/components/admin/npc-dialogue/NodeEditDialog.tsx` does. A portaled Radix `Select` is worse than unstyled there: it renders transparent and swallows pointer events, so it can only be driven with the keyboard. Use a native ` + Purpose + + + {BRIEF_PURPOSES.map((purpose) => ( + + ))} +
- - + +
- +