feat(i18n): per-entity content, per-group UI, page manifests (spec-v4-data-organization)

- split content.json -> content/{profile,skills,experience,projects}.json and
  ui.json -> 14 feature-group files (vi+en); index.ts merges both trees and
  asserts the merge against the group lists; merged CONTENT verified
  byte-identical against pre-split baseline dumps
- src/data/pages/*.json: 8 per-route manifests + pages.ts loader +
  PageId/PageManifestClaim/PageManifest types; validate.ts rules 1-4 (unknown
  entity, unknown ui group, unresolvable field path, orphan text field,
  missing manifest) - all five rejects verified by a throwaway harness
- draft.ts: data-driven registry of the 12 writable documents (4 structure +
  8 text); describeField() names the per-entity file; smoke-draft fixtures
  follow the new registry (8/8)
- EditBar: 'appears on' page annotations computed from the manifests
- remove JsonPanel.tsx + panel labels (inline-editing task 8); docs: AGENTS.md
  Data Layer / Live Edit Mode / Component Structure, v4 spec progress tables
This commit is contained in:
dong.nguyen committed 2026-10-23 10:55:29 +07:00
1 parent dad5f3edd7
commit 939260e4fb
69 files changed
+1816 -1596

No files matched your search

+11 -15
View File
@@ -6,7 +6,6 @@ import { TagListEditor } from '@/components/ui/TagListEditor'
import { RecordControls, AddGhost } from '@/components/ui/RecordControls'
import { useEdit } from '@/hooks/useEdit'
import { useI18n } from '@/i18n/provider'
import { setPath, parsePath } from '@/i18n/draft'
// philosophyQuotes are text-only records: they live in the language document
// being edited, so add and delete go through the plain document primitives.
@@ -44,14 +43,11 @@ export function PhilosophyPage() {
label={quote.title}
canUp={i > 0}
canDown={i < c.profile.philosophyQuotes.length - 1}
onUp={() => edit.moveItem(edit.textDoc, quotesPath, i, i - 1)}
onDown={() => edit.moveItem(edit.textDoc, quotesPath, i, i + 1)}
onDelete={() => {
const doc = edit.dataOf(edit.textDoc) as Record<string, any>
const next = setPath(doc, parsePath(quotesPath),
(doc.profile.philosophyQuotes as unknown[]).filter((_, j) => j !== i))
edit.apply(edit.textDoc, next)
}}
onUp={() => edit.moveText(quotesPath, i, i - 1)}
onDown={() => edit.moveText(quotesPath, i, i + 1)}
onDelete={() =>
edit.deleteText(`profile.philosophyQuotes[${i}]`)
}
/>
)}
<EditableText
@@ -75,12 +71,12 @@ export function PhilosophyPage() {
{edit && (
<AddGhost
label={s.edit.addQuote}
onClick={() => {
const doc = edit.dataOf(edit.textDoc) as Record<string, any>
const next = setPath(doc, parsePath(quotesPath),
[...(doc.profile.philosophyQuotes as unknown[]), { title: 'New quote', details: ['Write the quote here.'] }])
edit.apply(edit.textDoc, next)
}}
onClick={() =>
edit.setText(quotesPath, [
...c.profile.philosophyQuotes,
{ title: 'New quote', details: ['Write the quote here.'] },
])
}
/>
)}
</div>