feat(edit): pick a project's category in the record settings

category had no edit control anywhere: the settings popover covered featured + sections only, the badge is display-only, and a new project silently got category 'experiment' from the draft template. ProjectSettingsPanel now renders a category select whose options are the label map of ui/projects.json (the vocabulary rule 7 checks a project against) with the project's current value appended, so opening the panel never rewrites a project whose label is missing; the write goes through setStructured('projects', '[i].category', ...), the path smoke-draft check 11 already gates.

ui.edit.label added to both languages. .record-settings-field select joins the field-control rule in App.css, which also styles the timeline variant select that had none. Out of scope by design: a category with no labels - UI documents stay read-only in v4, so its labels are a repository edit.

Docs: inline-editing spec 2.4 + component inventory + progress rows 10 (the add-button fix) and 11; spec-v5 5.4 links the picker to rule 7; AGENTS.md editable-surface bullet corrected (category is a single structure value, not a chip list). Verified: pnpm build, pnpm validate:content, pnpm lint (5 pre-existing warnings only), smoke-draft 11/11.
This commit is contained in:
dong.nguyen committed 2026-10-24 13:37:42 +07:00
1 parent 8776247176
commit 1bc12d23a6
7 files changed
+34 -6

No files matched your search

@@ -150,6 +150,8 @@ export type { ProjectCategory, ExperienceId, PhilosophyId, ProjectId, SkillGroup
In `collectContentIssues` (`src/i18n/validate.ts:69-168`), after rule 6: for each unique category in `structures.projects`, require `ui[lang].projects.categories[value]` to be a non-empty string for `vi` and `en`; issue path `src/i18n/locales/<lang>/ui/projects.json: categories.<value>`.
The same label map is the **category vocabulary in the editing UI**: `ProjectSettingsPanel`'s category select (`spec-v4-inline-editing.md` §2.4, follow-up 11, added 2026-10-24) offers `Object.entries(ui.<lang>.projects.categories)` plus the project's current value and writes through `setStructured('projects', '[i].category', …)`. A value chosen from that list has a label in the bundle by construction; when the branch's copy of `ui/projects.json` lacks it, the write is rejected with exactly this rule-7 issue naming both files. Rule 7 therefore stays the gate for a category written straight into `src/data/projects.json` — the editor cannot bypass it, only pre-fill it.
**Plumbing — corrected by the self-review.** The draft store does **not** hold UI documents: `DRAFT_DOCS` (`draft.ts:48-61`) is exactly the 12 writable content documents, and `DraftStore.validate()` (`draft.ts:585-588`) calls `collectContentIssues` with structures and content texts only. The rule therefore needs a UI source at each call site, and `collectContentIssues` / `validateContent` gain a `ui` argument:
- `src/i18n/index.ts` (load-time): both UI trees are already built there — pass them.