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

@@ -37,7 +37,7 @@ Each chip is an edit unit: pencil per chip (inline text edit), `×` on hover to
### 2.4 Record settings popover (E2)
Gear icon on cards/entries opens a small popover anchored to the record:
- project card: `featured` toggle, sections list (type picker, move, delete — add lives inline at §2.3);
- project card: `featured` toggle, `category` select (added 2026-10-24: the options are the label map of `ui/projects.json`, i.e. the vocabulary rule 7 checks a project against — a category with no label in both languages cannot be chosen, and a brand-new one needs its labels added in the repository first, since UI documents stay read-only in v4), sections list (type picker, move, delete — add lives inline at §2.3);
- timeline entry: `variant` select (none / current / gap), `logo` path text input;
- nothing else needs a popover — every other field has an inline home.
@@ -75,7 +75,7 @@ Page manifests (`spec-v4-data-organization.md` §5) are **read-only in the app**
|---|---|---|
| Upgrade | `EditableText.tsx` | wrapper zone + pencil trigger (icon-only editing), inline error display, provenance tooltip + chip (E7) |
| New | `TagListEditor.tsx` | per-chip edit/delete/move + ghost add; emphasis toggle for tagline |
| New | `RecordSettings.tsx` | popover form: featured, variant, logo, section list |
| New | `RecordSettings.tsx` | popover form: featured, variant, logo, section list — plus the project `category` select (follow-up 11) |
| New | `AddRecord.tsx` | ghost affordance + template trigger + (sections) type picker |
| New | move controls | ↑/↓ buttons shared by `TagListEditor` and record cards |
| Delete | `JsonPanel.tsx` | removed outright — no fallback drawer, no advanced mode |
@@ -116,3 +116,5 @@ Page manifests (`spec-v4-data-organization.md` §5) are **read-only in the app**
| 8 | Remove `JsonPanel` + panel labels | ✅ Done 2026-10-23 — `JsonPanel.tsx` deleted (already orphaned by the inline wiring; no imports remained); panel labels removed from both UI documents: `openPanel`, `closePanel`, `handMerge`, the whole `edit.panel.*` namespace |
| 9 | Docs superseded notes | ✅ Done 2026-10-23 — superseded notes at live-edit §5.1 (panel shape) and §12 row 14; AGENTS.md "Live Edit Mode" + "Component Structure" rewritten for the inline surface |
| — | Acceptance §6 | 🟡 Partial — `pnpm build`, `pnpm validate:content`, `pnpm lint` (no new warnings), `pnpm tsx scripts/smoke-draft.ts`, `pnpm build:resume-all` pass 2026-10-23; browser verification of the edit surfaces pending (user verifies in a real browser) |
| 10 | Fix (owner-reported 2026-10-24): clicking "add technology" on a project card opened the project instead of adding a tag | ✅ Done 2026-10-24 (automated) — root cause: the card body IS a link (`MotionLink` at `Projects.tsx:49`, `ProjectsListPage.tsx:39`), and the add chip was the one edit control inside it without a guard. The chips themselves are safe because they render through `EditableText`, whose edit-mode `onClick` does `preventDefault + stopPropagation` (`EditableText.tsx:239-242`) — that is why ↑/↓/🗑 worked — and the pencil suppresses its own mousedown. `TagListEditor`'s add button now carries both guards (`TagListEditor.tsx:126-138`): mousedown stopped, then `preventDefault + stopPropagation` on click before `write([...items, s.edit.newTag])`. Covers the technologies *and* the metrics add on both card surfaces; the same control in `Hero.tsx` (tagline), `Expertise.tsx`, `AboutPage`, `ExperiencePage`, `PhilosophyPage`, `ProjectDetailPage` and the settings popovers sits outside any anchor and is untouched. Verified: `pnpm build` ✓, `pnpm lint` (only the five pre-existing warnings). ⬜ Browser: `?edit` → add a technology on a card → a new chip appears, no navigation |
| 11 | Fix (owner-reported 2026-10-24): a project's `category` had no edit control at all — the settings popover covered `featured` + sections only, the badge is display-only, and a new project silently gets `category: 'experiment'` (`draft.ts:546`) | ✅ Done 2026-10-24 (automated) — `ProjectSettingsPanel` now renders a `category` `<select>` (`RecordSettings.tsx:59-90`): options = the label map of `ui/projects.json` (`new Map(Object.entries(s.projects.categories))`) with the current value appended, so the panel never rewrites a project whose label is missing; the write is `edit.setStructured('projects', '[i].category', value)` — the exact call `smoke-draft.ts` check 11 already gates (a labeled value is accepted, a label-less one is rejected naming both `ui/projects.json` files). `ui.edit.category` label added to both languages (`ui/edit.json:15`). CSS: `.record-settings-field select` joins the field-control rule (`App.css:2487-2488`) — the timeline `variant` select, which had no rule of its own, is now styled too. Vocabulary measured from the shipped dictionaries: 6 labeled categories (`software-engineering, logistics, ai-ml, computer-vision, architecture, experiment`), 2 in use, 4 assignable that were unreachable before, none used-but-unlabeled, en/vi key sets identical. Verified: `pnpm build`, `pnpm validate:content`, `pnpm lint` (the 5 pre-existing warnings only), `pnpm tsx scripts/smoke-draft.ts` 11/11. Out of scope by design: creating a category with no labels — UI documents stay read-only in v4, so its labels are a repository edit. ⬜ Browser: ⚙ on a project card → the select shows the current category, switching it updates the badge and the EditBar diff |