mirror of
https://github.com/dong-nz/cv.git
synced 2026-11-23 00:20:40 +07:00
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:
1 parent
dad5f3edd7
commit
939260e4fb
69 files changed
+1816
-1596
No files matched your search
@@ -26,7 +26,7 @@ Personal engineering portfolio — multi-page SPA built with React + TypeScript
|
||||
| `pnpm build:resume` | Generate resume PDF (default EN) via Playwright |
|
||||
| `pnpm build:resume-all` | Generate bilingual resume PDFs (EN + VI) |
|
||||
| `pnpm lint` | Run Oxlint |
|
||||
| `pnpm validate:content` | Validate the content dictionaries against the structure documents (also run by the loader at module load) |
|
||||
| `pnpm validate:content` | Validate the content dictionaries against the structure documents and the page manifests (also run by the loader at module load) |
|
||||
| `pnpm sitemap` | Regenerate `dist/sitemap.xml` on its own (also run by `pnpm build`) |
|
||||
| `pnpm preview` | Preview production build locally |
|
||||
|
||||
@@ -67,14 +67,15 @@ Personal engineering portfolio — multi-page SPA built with React + TypeScript
|
||||
|
||||
## Data Layer
|
||||
|
||||
Content is split once, at authoring time, into language-neutral **structure documents** and per-language **text/UI dictionaries**, joined once at load (spec: `docs/design/specs/v4/spec-v4-live-edit.md`).
|
||||
Content is split once, at authoring time, into language-neutral **structure documents**, per-language **text/UI dictionaries** — one file per entity (`content/{entity}.json`) and per feature group (`ui/{group}.json`) — and per-route **field manifests** (`src/data/pages/`), joined once at load (spec: `docs/design/specs/v4/spec-v4-live-edit.md` + `spec-v4-data-organization.md`).
|
||||
|
||||
- `src/data/profile.json` + `profile.ts` loader — links, social handles (`githubHandle`, `linkedinHandle`, `telegramHandle`), messaging URLs (`telegramUrl`), `firstName`/`lastName`, the ordered philosophy id list — the Contact cards render `@{c.profile.githubHandle}`, never a literal; name / title / tagline / bio / about-subtitle / career TL;DR / interests / roles / philosophy quotes + keywords are text, so they live in the content dictionaries
|
||||
- `src/data/skills.json` + `skills.ts` loader — skill groups: `{id, skills}`; group titles are text
|
||||
- `src/data/experience.json` + `experience.ts` loader — work history: id / location / logo / optional `variant: 'current' | 'gap'` (timeline decoration: live node / career break); company, duration, titles and responsibilities are text — the VI document carries localized dates ("11/2026 – nay") and company labels, en overrides with the originals, proper nouns identical per language
|
||||
- `src/data/projects.json` + `projects.ts` loader — cards: category / technologies / featured / `sections[].{id, type}`; titles, summaries, role, metrics and section prose are text (role follows the owner's EN title convention; metrics are localized)
|
||||
- `src/i18n/locales/{vi,en}/content.json` — all content text, keyed by the structure ids; the `profile` record is fixed-keyed (`name`, `title`, `bio`, `subtitle`, `tldr`, `tagline`, `currentInterests`, `roles`, `philosophyQuotes`, `philosophy.<id>.{title, description, keywords}`); `src/i18n/locales/{vi,en}/ui.json` — chrome strings only, in each language (nav group labels, Mode options, language names `langEn` / `langVi`, action labels, social `aria-label`s, the resume's section labels, edit-mode labels) — person text never lives here
|
||||
- `src/i18n/index.ts` — load + validate + join ONCE at module load; exports `UI` and `CONTENT` as `Record<Language, Resolved…>`; `src/i18n/dict-types.ts` carries the document types; `src/i18n/validate.ts` + `scripts/validate-content.ts` enforce the cross-document rules (orphan or missing keys, HTML markup in text values) — a malformed document fails `pnpm build`, CI, and the browser load, never a silent half-render
|
||||
- `src/i18n/locales/{vi,en}/content/{profile,skills,experience,projects}.json` — all content text, one file per entity, keyed by the structure ids; the `profile` record is fixed-keyed (`name`, `title`, `bio`, `subtitle`, `tldr`, `tagline`, `currentInterests`, `roles`, `philosophyQuotes`, `philosophy.<id>.{title, description, keywords}`); `src/i18n/locales/{vi,en}/ui/{group}.json` — 14 chrome groups (`navigation`, `footer`, `social`, `hero`, `about`, `expertise`, `experience`, `projects`, `projectDetail`, `contact`, `philosophy`, `resume`, `edit`, `common`), in each language (nav group labels, Mode options, language names `langEn` / `langVi`, action labels, social `aria-label`s, the resume's section labels, edit-mode labels) — person text never lives here; `src/i18n/index.ts` merges both trees back into the same `UI`/`CONTENT` records and asserts the merge against the group lists — a group dropped in the split is a load-time error, never a silent omission
|
||||
- `src/data/pages/{home,about,experience,projects,project-detail,contact,philosophy,resume}.json` + `pages.ts` loader — per-route manifests: which entity fields the page renders (`fields[]`; `*` = every field the record id owns) and which UI groups it reads; `src/types/index.ts` carries `PageId` / `PageManifestClaim` / `PageManifest`. The validator enforces: no unknown entity, no unknown UI group, no unresolvable field path, **no orphan text field** (every text leaf in the content documents is claimed by at least one manifest), no missing manifest for a route in `src/data/navigation.ts` plus `/projects/:id`
|
||||
- `src/i18n/index.ts` — load + validate + join ONCE at module load; exports `UI` and `CONTENT` as `Record<Language, Resolved…>`; `src/i18n/dict-types.ts` carries the document types; `src/i18n/validate.ts` + `scripts/validate-content.ts` enforce the cross-document rules (orphan or missing keys, HTML markup in text values, the manifest rules above) — a malformed document fails `pnpm build`, CI, and the browser load, never a silent half-render
|
||||
- `src/i18n/provider.tsx` — `I18nProvider` wraps the app; components consume `const { ui: s, content: c } = useI18n()`: `s` is the chrome of the current language, `c` the joined records (`c.profile`, `c.skillGroups`, `c.experiences`, `c.projects`). There is no `field()` and no `*En` field pair anymore
|
||||
- Translation is a JSON edit, never a component edit; a new language is a new locale directory plus one `Language` union member
|
||||
- `src/data/resume.ts` — resume availability, supported languages, URL generation, and `resumeQr` (the `{id, file, label}` descriptors the resume header renders as QR codes)
|
||||
@@ -87,10 +88,10 @@ Content is split once, at authoring time, into language-neutral **structure docu
|
||||
- Entry: any route with `?edit` — `MaybeEditMode` in `App.tsx` lazy-mounts `EditModeShell` (its own chunk; visitors never load edit code). The shell authenticates, fetches the live master documents through the proxy, and re-wraps the tree in an `I18nProvider` override — the seven routes ARE the preview
|
||||
- Target branch (spec D10): `?edit=<branch>` reads (`?ref=`) and writes (`branch` in the PUT body) that branch; a bare `?edit` resumes the session's last branch, default `master`. Names are validated against git ref rules in `src/i18n/edit-mode.ts` before any request (illegal → exit like a failed auth); the branch is stored beside the session flag. The target branch must already exist — Contents API updates never create branches. Only `master` deploys, so the EditBar shows a merge hint on other branches
|
||||
- Auth: HTTP Basic at the nginx `/api/content/` proxy is the security boundary; `src/i18n/edit-mode.ts` probes it through a hidden iframe, keeps the session flag `portfolio-edit` in sessionStorage, and strips `?edit` when the probe fails (401 or cancelled prompt → normal visitor site)
|
||||
- `src/i18n/draft.ts` — `DraftStore`: baselines (`data` + blob `sha`) of the six content documents, copy-on-write draft, leaf-path diff, cross-document validation on every accepted edit, three-way rebase on save conflicts (Gitea 28 reports a blob-sha mismatch as 422 with a "does not match" message; older deployments answered 412 — both are handled; origin / base / working kept separate), draft persisted to sessionStorage `portfolio-draft`, sequential-PUT save (one commit per touched document, resume from the first unwritten one on failure), and appending new id union members to `src/types/index.ts` after their documents land
|
||||
- `src/i18n/draft.ts` — `DraftStore`: baselines (`data` + blob `sha`) of the 12 writable documents (4 structure + 8 text), copy-on-write draft, leaf-path diff, cross-document validation on every accepted edit, three-way rebase on save conflicts (Gitea 28 reports a blob-sha mismatch as 422 with a "does not match" message; older deployments answered 412 — both are handled; origin / base / working kept separate), draft persisted to sessionStorage `portfolio-draft`, sequential-PUT save (one commit per touched document, resume from the first unwritten one on failure), and appending new id union members to `src/types/index.ts` after their documents land
|
||||
- `src/components/ui/EditableText.tsx` — the site's own element (`as` = the tag or motion component it renders today) becomes the inline editor only in edit mode; commit on blur only (Vietnamese IME-safe), Esc cancels, Enter commits single-line fields, paste is plain-text, empty required values are rejected at commit; without an `EditContext` provider it renders byte-identical markup to the plain element
|
||||
- `src/components/layout/EditBar.tsx` — fixed save bar: per-path diff with revert, conflict resolution (rebase / take-theirs / hand-merge), per-document save status, partial-save resume, exit confirm; `src/components/layout/JsonPanel.tsx` — per-document JSON editor with shape hints, record templates (structure + text stubs created together), orphan-free record delete, read-only `ui.json` tabs
|
||||
- Editable surface is content text only (bio, tagline segments, project titles/summaries/section prose, experience titles/responsibilities, skill-group titles, philosophy titles/descriptions); structure fields (`featured`, `variant`, technologies, links, ids) are edited in the JSON panel; `ui.json` is read-only in v4. **Design agreed 2026-10-23 (`spec-v4-inline-editing.md`), not yet implemented:** the JSON panel will be deleted — pencil-icon-trigger inline editing with field-provenance chips (`document → pointer`), chip-level tag editors, ghost add/delete/move record controls, per-record settings popover, auto-generated ids, handle-only social links with loader-derived URLs
|
||||
- `src/components/layout/EditBar.tsx` — fixed save bar: per-path diff with revert and "appears on" page annotations (computed from the page manifests via `manifestsClaiming`, never from component code), conflict resolution (rebase / take-theirs / per-field keep-mine–keep-theirs), per-document save status, partial-save resume, exit confirm
|
||||
- Editable surface: content text inline (pencil-triggered, click never edits) **and** structure — chip-level tag editors (technologies, categories, interests, roles, keywords, tagline emphasis), ghost add/delete/move on every record surface, per-record settings popover (`featured`, project section list + type picker, `variant`, location, logo), ids auto-generated from title slugs, social links handle-only with URLs derived in the loaders. Implemented 2026-10-23 (`spec-v4-inline-editing.md` + `spec-v4-data-organization.md`); the JSON panel is deleted. UI documents stay read-only in v4. Field provenance: hovering any pencil shows `document → pointer` (`describeField()` names the per-entity file automatically); the EditBar diff line and a `validate:content` error for the same field read identically
|
||||
- Dev parity: `vite.config.ts` proxies `/api/content/` to the Gitea Contents API exactly like production nginx — run `pnpm dev` with `GITEA_TOKEN` set; without it edit mode falls to the offline state (bundled content, save disabled)
|
||||
- Spec: `docs/design/specs/v4/spec-v4-live-edit.md` §5–§6
|
||||
|
||||
@@ -99,11 +100,11 @@ Content is split once, at authoring time, into language-neutral **structure docu
|
||||
```
|
||||
src/
|
||||
components/
|
||||
layout/ — Layout.tsx, Navigation.tsx, MobileMenu.tsx, Footer.tsx, ThemePaletteMenu.tsx, ResumeNavButton.tsx, EditModeShell.tsx, EditBar.tsx, JsonPanel.tsx
|
||||
layout/ — Layout.tsx, Navigation.tsx, MobileMenu.tsx, Footer.tsx, ThemePaletteMenu.tsx, ResumeNavButton.tsx, EditModeShell.tsx, EditBar.tsx
|
||||
sections/ — Hero, About, Expertise, Experience, Projects, Contact, HeroParticles, DownloadResume (the hero lazer CTA; it gates itself on `resumeAvailable`)
|
||||
ui/ — Badge, Button, ContactLinks, LanguageIcon, ResumeDialog, SectionHeading, SocialLinks, Tag, Typewriter, InView, RollingTextLink, BackToTop, EditableText, icons
|
||||
data/ — profile, skills, experience, projects (JSON documents + typed loaders), resume, palettes, navigation, social, site (TS modules)
|
||||
i18n/ — index.ts (loader), dict-types.ts, validate.ts, provider.tsx, draft.ts (DraftStore + save pipeline), edit-mode.ts (session/auth), locales/{vi,en}/{content,ui}.json
|
||||
ui/ — Badge, Button, ContactLinks, LanguageIcon, ResumeDialog, SectionHeading, SocialLinks, Tag, Typewriter, InView, RollingTextLink, BackToTop, EditableText, TagListEditor, RecordControls, RecordSettings, icons
|
||||
data/ — profile, skills, experience, projects (JSON documents + typed loaders), pages (manifest JSON + pages.ts loader), resume, palettes, navigation, social, site (TS modules)
|
||||
i18n/ — index.ts (loader), dict-types.ts, validate.ts, provider.tsx, draft.ts (DraftStore + save pipeline), edit-mode.ts (session/auth), locales/{vi,en}/content/{profile,skills,experience,projects}.json + ui/{group}.json (14 chrome groups)
|
||||
hooks/ — useTheme.tsx, useLanguage.tsx, useClickOutside.ts, useResumeDialog.ts, useEdit.ts (edit context)
|
||||
pages/ — HomePage, AboutPage, ExperiencePage, ProjectsListPage, ProjectDetailPage, PhilosophyPage, ContactPage
|
||||
types/ — shared TypeScript interfaces
|
||||
@@ -190,7 +191,7 @@ All specification documents are in `docs/design/`:
|
||||
| `specs/ui/spec-ui-*.md` | UI specs per section (hero, about, expertise, etc.) |
|
||||
| `specs/v2/spec-v2-*.md` | v2 feature specs (resume, seo, blog, analytics, testing, cicd) |
|
||||
| `specs/v3/spec-v3-*.md` | v3 feature specs (theme colors, theme switch, theme palette switch, palette reference, UI enhancements, mobile navigation, nav & CTA enhancements, nav swatch & hamburger, typography, i18n, resume improvements, resume redesign, review fixes) |
|
||||
| `specs/v4/spec-v4-*.md` | v4 feature specs (i18n locale overlay, git-backed live edit with preview, authenticated Contents-API write path; supersedes v3-i18n Phase 2). `spec-v4-data-organization.md`: per-entity content files, per-page field-level manifests, per-feature-group UI — design agreed 2026-10-23, **not yet implemented**. `spec-v4-inline-editing.md`: edit everything on the page (pencil-icon triggers, tag chips, record add/delete/move, settings popover), JSON panel deleted — design agreed 2026-10-23, **not yet implemented**; it supersedes live-edit §5.1/§5.4 panel scope. The current layout and JsonPanel below remain authoritative until those specs land |
|
||||
| `specs/v4/spec-v4-*.md` | v4 feature specs (i18n locale overlay, git-backed live edit with preview, authenticated Contents-API write path; supersedes v3-i18n Phase 2). `spec-v4-data-organization.md`: per-entity content files, per-page field-level manifests, per-feature-group UI — implemented 2026-10-23 (automated checks pass; browser walkthrough pending). `spec-v4-inline-editing.md`: edit everything on the page (pencil-icon triggers, tag chips, record add/delete/move, settings popover), JSON panel deleted — implemented 2026-10-23; it supersedes live-edit §5.1/§5.4 panel scope |
|
||||
|
||||
Read `spec.md` first for product context. Read `spec-v2.md` for current feature scope.
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Specification — v4 Data Organization (per-entity content, per-page manifests, per-group UI)
|
||||
|
||||
Status: **Design agreed 2026-10-23; implementation TODO.** Follow-up to `spec-v4-live-edit.md`; does not change its D1–D10 decisions, only the physical document layout and the edit-mode document registry.
|
||||
Status: **Design agreed 2026-10-23; implemented 2026-10-23** (§9). Automated gates pass; the remaining open items are the owner's browser walkthrough (§8 last two rows) and pushing the new file layout to the Gitea content repository (live-edit row 11 dependency — the proxy answers 404 for paths the repository does not have). Follow-up to `spec-v4-live-edit.md`; does not change its D1–D10 decisions, only the physical document layout and the edit-mode document registry.
|
||||
|
||||
## 1. Decisions from the 2026-10-23 discussion
|
||||
|
||||
@@ -146,10 +146,10 @@ Order decided 2026-10-23: this spec lands **after** `spec-v4-inline-editing.md`
|
||||
|
||||
## 8. Acceptance criteria
|
||||
|
||||
- [ ] Merged `CONTENT` and `UI` byte-identical before/after the split (automated comparison script, throwaway).
|
||||
- [ ] `pnpm build`, `pnpm validate:content`, `pnpm lint` (no new warnings), `pnpm build:resume-all` pass.
|
||||
- [ ] `pnpm tsx scripts/smoke-draft.ts` passes against the new registry.
|
||||
- [ ] Validator rejects: unknown entity, unresolvable field path, orphan content field, unknown ui group, missing manifest.
|
||||
- [x] Merged `CONTENT` and `UI` byte-identical before/after the split (automated comparison script, throwaway). — verified 2026-10-23 against baseline dumps captured before the cutover: `CONTENT.vi`/`CONTENT.en` identical; `UI` differs only by the intentional label changes of the inline-editing cutover (panel labels removed, `edit.fields` + `appears*` labels added).
|
||||
- [x] `pnpm build`, `pnpm validate:content`, `pnpm lint` (no new warnings), `pnpm build:resume-all` pass. — verified 2026-10-23; the resume generator consumes the merged `UI`/`CONTENT` with zero call-site changes, both PDFs render.
|
||||
- [x] `pnpm tsx scripts/smoke-draft.ts` passes against the new registry. — 8/8 checks 2026-10-23, fixtures over `experience.json` / `experience.vi.json` / `projects.json`.
|
||||
- [x] Validator rejects: unknown entity, unresolvable field path, orphan content field, unknown ui group, missing manifest. — verified 2026-10-23 by a throwaway mutation harness (all five rejects + a clean acceptance asserted); the unknown-ui-group rule caught a real mistake during implementation (`project-detail.json` naming the group by file name instead of namespace).
|
||||
- [ ] Edit mode end-to-end (browser): edit one bio line + one project summary → EditBar shows two documents with page annotations → save produces two per-file commits on the target branch.
|
||||
- [ ] Browser walkthrough unchanged for visitors: all 7 routes, both languages, identical rendering.
|
||||
|
||||
@@ -158,5 +158,5 @@ Order decided 2026-10-23: this spec lands **after** `spec-v4-inline-editing.md`
|
||||
| # | Task | Status |
|
||||
|---|---|---|
|
||||
| 0 | Design agreed (D1–D5) | ✅ Done 2026-10-23 |
|
||||
| 1–6 | Implementation steps §7 | ⬜ TODO |
|
||||
| — | Acceptance §8 | ⬜ TODO |
|
||||
| 1–6 | Implementation steps §7 | ✅ Done 2026-10-23 — content split (4 files × 2 languages) + UI split (14 groups × 2) with merge asserted in `index.ts`; `src/data/pages/*.json` (8 manifests) + `pages.ts` + `PageId`/`PageManifestClaim`/`PageManifest` in `src/types/index.ts`; validator rules 1–4 in `validate.ts` (run at load and by `validate:content`); `draft.ts` registry data-driven over 12 writable documents (4 structure + 8 text, `entityOfDoc`/`docEntityMap` exported for provenance + EditBar); `describeField()` names the per-entity file automatically; EditBar "appears on" annotations via `manifestsClaiming`/`recordEntity`; AGENTS.md Data Layer + Live Edit Mode + Component Structure updated |
|
||||
| — | Acceptance §8 | 🟡 Automated rows verified 2026-10-23 (see §8 checkboxes); browser rows open — the owner verifies in a real browser |
|
||||
@@ -1,6 +1,6 @@
|
||||
# Specification — v4 Inline Editing (edit everything on the page; no JSON panel)
|
||||
|
||||
Status: **Design agreed 2026-10-23; implementation TODO.** Supersedes the JSON-panel parts of `spec-v4-live-edit.md` §5.1 ("Structural editing") and `spec-v4-data-organization.md` §6.4. The save pipeline (§5.4/§6 of live-edit), DraftStore semantics, conflict handling, branch targeting (D10), and the EditBar all stay as specified. Order decided 2026-10-23: this spec lands **before** `spec-v4-data-organization.md`.
|
||||
Status: **Design agreed 2026-10-23; implemented 2026-10-23** (see §7). The remaining gate is the owner's browser walkthrough of §6. Supersedes the JSON-panel parts of `spec-v4-live-edit.md` §5.1 ("Structural editing") and `spec-v4-data-organization.md` §6.4. The save pipeline (§5.4/§6 of live-edit), DraftStore semantics, conflict handling, branch targeting (D10), and the EditBar all stay as specified. Order decided 2026-10-23: this spec lands **before** `spec-v4-data-organization.md` — both have now landed, in that order.
|
||||
|
||||
## 1. Decisions
|
||||
|
||||
@@ -113,6 +113,6 @@ Page manifests (`spec-v4-data-organization.md` §5) are **read-only in the app**
|
||||
|---|---|---|
|
||||
| 0 | Design agreed (E1–E7) | ✅ Done 2026-10-23 |
|
||||
| 1–7 | Implementation §5 | ✅ Done 2026-10-23 — EditableText zone/pencil/provenance, TagListEditor over all tag arrays, tagline emphasis, `RecordControls` + `AddGhost` on every record surface (About, AboutPage, Expertise, Experience, ExperiencePage, Projects, ProjectsListPage, ProjectDetailPage incl. sections, PhilosophyPage), `RecordSettings` (featured, section list + type picker, variant, location, logo), id-slug rename on title commit, per-field conflict UI in EditBar; chrome CSS in `App.css`, labels in both `ui.json` |
|
||||
| 8 | Remove `JsonPanel` + panel labels | ⬜ TODO — kept until the inline surface is verified in a real browser |
|
||||
| 9 | Docs superseded notes | ⬜ TODO |
|
||||
| — | Acceptance §6 | 🟡 Partial — `pnpm build`, `pnpm validate:content`, `pnpm lint` (no new warnings), `pnpm tsx scripts/smoke-draft.ts` pass 2026-10-23; browser verification of the edit surfaces pending (user verifies in a real browser) |
|
||||
| 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) |
|
||||
@@ -599,3 +599,4 @@ Deferred (not v4):
|
||||
| 18 | Move the three person-content keys out of `ui.json` (§11): `about.subtitle` → `profile.subtitle`, `experience.tldrText` → `profile.tldr`, `philosophy.quotes` → `profile.philosophyQuotes`; extend `ProfileText`, repoint 4 call sites, `EditableText` wrap + `SectionHeading` `subtitle: ReactNode`, JsonPanel hint update; `tsc` is the migration net | post-v4 | ✅ Done 2026-10-22 (automated) — values in both `content.{vi,en}.json`, keys deleted from both `ui` documents, `edit.fields` labels added; verified: `pnpm build`, `pnpm validate:content`, `pnpm lint` (no new warnings), `scripts/smoke-draft.ts` 7/7, throwaway SSR smoke asserting the subtitle / TL;DR / essay markers on `/about`, home + `/experience`, `/philosophy` in both languages — deleted after the run. ⬜ Browser: inline-edit the three fields in `?edit` |
|
||||
| 19 | Localize the §4 structure-assigned strings (`experience.company` of non-company entries, `duration`, `currentInterests`, `roles`, `keywords`, `projects.role`/`metrics`) or keep them EN-only like `technologies` | post-v4 | ✅ Done 2026-10-22 (automated) — fields moved to the text documents (§4 follow-up); VI document carries localized values (numeric dates + "nay", "Sẵn sàng cho cơ hội mới", "Nghỉ giữa chặng", "Đã triển khai tại 16 sortations", "Xử lý 70.000 ảnh/tháng"), en overrides with the originals, proper nouns and term lists identical (en omits); company/duration/role inline-editable, tag arrays JSON-panel-only; templates in `draft.ts` and JsonPanel hints follow the new shapes; resume generator reads `profile.tldr` from content. Verified: `pnpm build`, `pnpm validate:content`, `pnpm lint` (no new warnings), `pnpm build:resume-all` (both PDFs), SSR smoke marker sets per language incl. localized durations/companies/metrics/roles on home + `/experience` + project detail — deleted after the run. ⬜ Browser: VI pages show the localized timeline; `?edit` company/duration/role |
|
||||
| 20 | Save pipeline adapted to the live Gitea 28 Contents API | 3 | ✅ Done 2026-10-23 — the first real save answered 422 "repository file already exists [path: src/i18n/locales/vi/content.json]": Gitea 28 decides create-vs-update by the body `sha` (blob ID), which the client never sent. `draft.ts`: `fetchDoc`/`fetchTextFile` keep the blob `sha`; PUT bodies send `sha`; the new blob sha is read from the FileResponse `content.sha`; save conflict detection = 422 with a "does not match" message (412 kept for older deployments); §6.1 amended. Verified: `tsc -b`, `pnpm lint` (no new warnings), `scripts/smoke-draft.ts` 8/8. ⬜ Browser + Gitea: save → commit lands on the target branch; stale blob sha → conflict flow |
|
||||
| 21 | v4 cutover: `spec-v4-inline-editing.md` E1–E7 (pencil-trigger inline editing, chip tag editors, ghost record add/delete/move, settings popovers, auto-ids, handle-only socials, `JsonPanel.tsx` deleted) + `spec-v4-data-organization.md` (content per entity, UI in 14 groups, per-route manifests + validator rules 1–4, 12-document draft registry, EditBar "appears on" annotations) | post-v4 | ✅ Done 2026-10-23 (automated) — details and evidence in each spec's Progress Tracking: the split is gated against baseline dumps (merged `CONTENT` byte-identical both languages; `UI` differs only by the intentional label changes), the manifest validator rejects all five bad cases (unknown entity / field path / orphan field / ui group / missing manifest), `smoke-draft.ts` 8/8 on the new registry, `tsc -b`, `pnpm build`, `pnpm lint` (no new warnings), `pnpm build:resume-all` all pass. ⬜ Browser: edit-mode walkthrough (pencil-only editing, provenance chips, save → per-file commits with page annotations) + visitor routes unchanged; the Gitea content repository must carry the new file layout before saves answer 200 (row 11 dependency) |
|
||||
+28
-25
@@ -1,4 +1,5 @@
|
||||
// Throwaway smoke test for the draft store (spec-v4 §5.1, §5.5, §5.6).
|
||||
// Throwaway smoke test for the draft store (spec-v4 §5.1, §5.5, §5.6;
|
||||
// registry per spec-v4-data-organization §6.1).
|
||||
// Run: pnpm tsx scripts/smoke-draft.ts
|
||||
import { DraftStore, bundledBase } from '../src/i18n/draft';
|
||||
|
||||
@@ -13,28 +14,30 @@ const store = new DraftStore(structuredClone(bases));
|
||||
const projects = store.dataOf('projects') as { id: string }[];
|
||||
const firstProject = projects[0].id;
|
||||
|
||||
// 1. setValue on a text path is accepted and tracked.
|
||||
// 1. setValue on a text path is accepted and tracked in the entity document
|
||||
// of the edited language; the diff stores the document-relative pointer.
|
||||
const rejected = store.setValue('vi', `projects.${firstProject}.summary`, 'SUMMARY CHANGED');
|
||||
if (rejected !== null) fail(`valid edit rejected: ${JSON.stringify(rejected)}`);
|
||||
if (!store.isDirty()) fail('store not dirty after accepted edit');
|
||||
const paths = store.changedPaths('content.vi');
|
||||
if (!paths.includes(`projects.${firstProject}.summary`)) fail(`path not diffed: ${paths}`);
|
||||
const paths = store.changedPaths('projects.vi');
|
||||
if (!paths.includes(`${firstProject}.summary`)) fail(`path not diffed: ${paths}`);
|
||||
|
||||
// 2. Empty required value is rejected and leaves the draft untouched.
|
||||
const before = structuredClone(store.dataOf('content.vi'));
|
||||
const before = structuredClone(store.dataOf('profile.vi'));
|
||||
const empty = store.setValue('vi', 'profile.bio', ' ');
|
||||
if (empty === null) fail('empty required value accepted');
|
||||
if (JSON.stringify(store.dataOf('content.vi')) !== JSON.stringify(before)) fail('rejected edit mutated draft');
|
||||
if (JSON.stringify(store.dataOf('profile.vi')) !== JSON.stringify(before))
|
||||
fail('rejected edit mutated draft');
|
||||
|
||||
// 3. Delete removes the structure record AND both text entries — no orphan.
|
||||
const del = store.deleteRecord('project', { id: firstProject });
|
||||
if (del !== null) fail(`delete rejected: ${JSON.stringify(del)}`);
|
||||
const stillListed = (store.dataOf('projects') as { id: string }[]).some((p) => p.id === firstProject);
|
||||
if (stillListed) fail('project still in structure after delete');
|
||||
const vi = store.dataOf('content.vi') as Record<string, Record<string, unknown>>;
|
||||
const en = store.dataOf('content.en') as Record<string, Record<string, unknown>>;
|
||||
if (vi.projects[firstProject]) fail('vi text orphan after delete');
|
||||
if (en.projects[firstProject]) fail('en text orphan after delete');
|
||||
const viText = store.dataOf('projects.vi') as Record<string, unknown>;
|
||||
const enText = store.dataOf('projects.en') as Record<string, unknown>;
|
||||
if (viText[firstProject]) fail('vi text orphan after delete');
|
||||
if (enText[firstProject]) fail('en text orphan after delete');
|
||||
const issues = store.validate();
|
||||
if (issues.length > 0) fail(`validate after delete: ${JSON.stringify(issues)}`);
|
||||
|
||||
@@ -61,37 +64,37 @@ if (!same) fail('restored draft differs from saved snapshot');
|
||||
const store2 = new DraftStore(structuredClone(bases));
|
||||
store2.setValue('vi', `projects.${firstProject}.summary`, 'MINE');
|
||||
const driftedBase = structuredClone(bases);
|
||||
(driftedBase['content.vi'].data as Record<string, Record<string, string>>).projects[firstProject].summary = 'THEIRS';
|
||||
store2.resetBase('content.vi', driftedBase['content.vi']);
|
||||
const rebaseIssues = store2.rebase('content.vi');
|
||||
(driftedBase['projects.vi'].data as Record<string, Record<string, string>>)[firstProject].summary = 'THEIRS';
|
||||
store2.resetBase('projects.vi', driftedBase['projects.vi']);
|
||||
const rebaseIssues = store2.rebase('projects.vi');
|
||||
if (rebaseIssues === null) fail('rebase silently took one side on a real conflict');
|
||||
store2.discardDocument('content.vi');
|
||||
if (store2.isPathDirty(`projects.${firstProject}.summary`)) fail('take-theirs left draft residue');
|
||||
store2.discardDocument('projects.vi');
|
||||
if (store2.changedPaths('projects.vi').includes(`${firstProject}.summary`))
|
||||
fail('take-theirs left draft residue');
|
||||
|
||||
// 7. Clean rebase: base changed at a DIFFERENT path → draft edit survives.
|
||||
const store3 = new DraftStore(structuredClone(bases));
|
||||
store3.setValue('vi', `projects.${firstProject}.summary`, 'MINE');
|
||||
const otherBase = structuredClone(bases);
|
||||
const otherId = projects[1].id;
|
||||
(otherBase['content.vi'].data as Record<string, Record<string, string>>).projects[otherId].summary = 'THEIRS';
|
||||
store3.resetBase('content.vi', otherBase['content.vi']);
|
||||
const clean = store3.rebase('content.vi');
|
||||
(otherBase['projects.vi'].data as Record<string, Record<string, string>>)[otherId].summary = 'THEIRS';
|
||||
store3.resetBase('projects.vi', otherBase['projects.vi']);
|
||||
const clean = store3.rebase('projects.vi');
|
||||
if (clean !== null) fail(`clean rebase rejected: ${JSON.stringify(clean)}`);
|
||||
const merged = (store3.dataOf('content.vi') as Record<string, Record<string, string>>).projects;
|
||||
if (merged[firstProject].summary !== 'MINE') fail('rebase lost the draft edit');
|
||||
if (merged[otherId].summary !== 'THEIRS') fail('rebase lost the base edit');
|
||||
const mergedText = store3.dataOf('projects.vi') as Record<string, Record<string, string>>;
|
||||
if (mergedText[firstProject].summary !== 'MINE') fail('rebase lost the draft edit');
|
||||
if (mergedText[otherId].summary !== 'THEIRS') fail('rebase lost the base edit');
|
||||
|
||||
// 8. A text document that does not hold an array field yet (an older target
|
||||
// branch — the field still lives in the structure document) must gain a real
|
||||
// array when a [0] path is committed; an object-keyed pseudo-array crashed
|
||||
// TagListEditor's items.map on the re-render after the first tag edit.
|
||||
const store4 = new DraftStore(structuredClone(bases));
|
||||
const baseVi = store4.dataOf('content.vi') as Record<string, Record<string, unknown>>;
|
||||
delete baseVi.profile.currentInterests;
|
||||
const baseVi = store4.dataOf('profile.vi') as Record<string, Record<string, unknown>>;
|
||||
delete baseVi.currentInterests;
|
||||
const tagEdit = store4.setValue('vi', 'profile.currentInterests[0]', 'NEW TAG');
|
||||
if (tagEdit !== null) fail(`tag edit rejected: ${JSON.stringify(tagEdit)}`);
|
||||
const arr = (store4.dataOf('content.vi') as Record<string, Record<string, unknown>>).profile
|
||||
.currentInterests;
|
||||
const arr = (store4.dataOf('profile.vi') as Record<string, Record<string, unknown>>).currentInterests;
|
||||
if (!Array.isArray(arr)) fail(`setPath made ${JSON.stringify(arr)}, not an array`);
|
||||
if (arr[0] !== 'NEW TAG') fail('array element not set');
|
||||
|
||||
|
||||
+32
-13
@@ -1,23 +1,42 @@
|
||||
// CLI over the shared validator (spec-v4 §3.6): the CI build gate and, from
|
||||
// Phase 3 on, the save gate. A malformed content document fails here with
|
||||
// exact document paths, so the last good deploy stays live.
|
||||
// CLI over the shared validator (spec-v4 §3.6, spec-v4-data-organization §5.1):
|
||||
// the CI build gate and, from Phase 3 on, the save gate. A malformed content
|
||||
// or manifest document fails here with exact file paths, so the last good
|
||||
// deploy stays live.
|
||||
import { experiences } from '../src/data/experience';
|
||||
import { profile } from '../src/data/profile';
|
||||
import { projects } from '../src/data/projects';
|
||||
import { skillGroups } from '../src/data/skills';
|
||||
import contentEnJson from '../src/i18n/locales/en/content.json';
|
||||
import contentViJson from '../src/i18n/locales/vi/content.json';
|
||||
import experienceEnJson from '../src/i18n/locales/en/content/experience.json';
|
||||
import experienceViJson from '../src/i18n/locales/vi/content/experience.json';
|
||||
import profileEnJson from '../src/i18n/locales/en/content/profile.json';
|
||||
import profileViJson from '../src/i18n/locales/vi/content/profile.json';
|
||||
import projectsEnJson from '../src/i18n/locales/en/content/projects.json';
|
||||
import projectsViJson from '../src/i18n/locales/vi/content/projects.json';
|
||||
import skillsEnJson from '../src/i18n/locales/en/content/skills.json';
|
||||
import skillsViJson from '../src/i18n/locales/vi/content/skills.json';
|
||||
import { UI } from '../src/i18n';
|
||||
import type { ContentEn, ContentVi } from '../src/i18n/dict-types';
|
||||
import { collectContentIssues } from '../src/i18n/validate';
|
||||
import { collectContentIssues, collectManifestIssues } from '../src/i18n/validate';
|
||||
|
||||
const contentVi: ContentVi = contentViJson;
|
||||
const contentEn: ContentEn = contentEnJson;
|
||||
const contentVi: ContentVi = {
|
||||
profile: profileViJson,
|
||||
skills: skillsViJson,
|
||||
experience: experienceViJson,
|
||||
projects: projectsViJson,
|
||||
};
|
||||
const contentEn: ContentEn = {
|
||||
profile: profileEnJson,
|
||||
skills: skillsEnJson,
|
||||
experience: experienceEnJson,
|
||||
projects: projectsEnJson,
|
||||
};
|
||||
|
||||
const issues = collectContentIssues(
|
||||
{ profile, skills: skillGroups, experience: experiences, projects },
|
||||
contentVi,
|
||||
contentEn,
|
||||
);
|
||||
const structures = { profile, skills: skillGroups, experience: experiences, projects };
|
||||
|
||||
const issues = [
|
||||
...collectContentIssues(structures, contentVi, contentEn),
|
||||
...collectManifestIssues(structures, contentVi, contentEn, Object.keys(UI.vi)),
|
||||
];
|
||||
|
||||
if (issues.length > 0) {
|
||||
console.error(`content validation failed (${issues.length} issue(s)):`);
|
||||
|
||||
+5
-140
@@ -2229,6 +2229,11 @@
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.edit-bar-appears {
|
||||
color: var(--text-muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.edit-bar-conflicts {
|
||||
margin-top: 10px;
|
||||
display: grid;
|
||||
@@ -2265,142 +2270,6 @@
|
||||
color: var(--success);
|
||||
}
|
||||
|
||||
.json-panel {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 950;
|
||||
width: min(620px, 100%);
|
||||
background: var(--bg-elevated);
|
||||
border-left: 1px solid var(--border-strong);
|
||||
padding: 14px 16px;
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.json-panel-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.json-panel-tabs {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.json-panel-tab {
|
||||
background: transparent;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 6px;
|
||||
padding: 4px 8px;
|
||||
color: var(--text-secondary);
|
||||
font: inherit;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.json-panel-tab.is-active {
|
||||
border-color: var(--accent);
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.json-panel-conflict-flag {
|
||||
color: var(--warning);
|
||||
}
|
||||
|
||||
.json-panel-shape {
|
||||
margin: 0;
|
||||
padding: 8px 10px;
|
||||
background: var(--bg-surface);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
color: var(--text-muted);
|
||||
font-size: 12px;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.json-panel-tools,
|
||||
.json-panel-records {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.json-panel-record {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 6px;
|
||||
padding: 3px 8px;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.json-panel-readonly {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.json-panel-section-add select {
|
||||
background: var(--bg-surface);
|
||||
color: var(--text-primary);
|
||||
border: 1px solid var(--border-strong);
|
||||
border-radius: 6px;
|
||||
padding: 4px 6px;
|
||||
font: inherit;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.json-panel-merge {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
border: 1px solid var(--warning);
|
||||
border-radius: 8px;
|
||||
padding: 8px 10px;
|
||||
}
|
||||
|
||||
.json-panel-merge textarea {
|
||||
min-height: 140px;
|
||||
}
|
||||
|
||||
.json-panel-editor {
|
||||
flex: 1;
|
||||
min-height: 300px;
|
||||
background: var(--bg-surface);
|
||||
color: var(--text-primary);
|
||||
border: 1px solid var(--border-strong);
|
||||
border-radius: 8px;
|
||||
padding: 10px;
|
||||
font-family: ui-monospace, 'Cascadia Mono', 'Consolas', monospace;
|
||||
font-size: 12.5px;
|
||||
line-height: 1.5;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
.json-panel-editor:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: 1px;
|
||||
}
|
||||
|
||||
.json-panel-issues {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
display: grid;
|
||||
gap: 3px;
|
||||
color: var(--error);
|
||||
}
|
||||
|
||||
.json-panel-status {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
/* Inline editing affordances (§5.3): outline only — the element itself stays
|
||||
the site's own, so the page keeps its exact rendering outside edit mode. */
|
||||
.editable-text {
|
||||
@@ -2682,10 +2551,6 @@
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.json-panel {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.edit-bar-actions {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
// the whole-document operations.
|
||||
import { useState } from 'react';
|
||||
import { useI18n } from '@/i18n/provider';
|
||||
import { DRAFT_DOCS } from '@/i18n/draft';
|
||||
import { DRAFT_DOCS, entityOfDoc } from '@/i18n/draft';
|
||||
import { manifestsClaiming, recordEntity } from '@/data/pages';
|
||||
import { DEFAULT_BRANCH } from '@/i18n/edit-mode';
|
||||
import type { ConflictField, DocSaveResult, DraftDocId } from '@/i18n/draft';
|
||||
import type { ContentIssue } from '@/i18n/validate';
|
||||
@@ -33,7 +34,7 @@ type EditBarProps = {
|
||||
onTakeTheirs: (id: DraftDocId) => void;
|
||||
onResolveField: (id: DraftDocId, path: string, side: 'mine' | 'theirs') => void;
|
||||
onDiscardDoc: (id: DraftDocId) => void;
|
||||
onRevertPath: (path: string) => void;
|
||||
onRevertPath: (id: DraftDocId, path: string) => void;
|
||||
};
|
||||
|
||||
function fileOf(id: DraftDocId): string {
|
||||
@@ -81,6 +82,19 @@ export function EditBar({
|
||||
? s.conflictStatus
|
||||
: `${s.failed} (${result.http ?? 0})`;
|
||||
|
||||
// "appears on" annotation (spec-v4-data-organization §6.3): the pages whose
|
||||
// manifest claims this document-relative path — grouping is computed from
|
||||
// the manifests, never from component code.
|
||||
const appearsOn = (docId: DraftDocId, path: string): string | null => {
|
||||
const entity = entityOfDoc(docId);
|
||||
if (!entity) return null;
|
||||
const pages = manifestsClaiming(recordEntity(entity), path);
|
||||
if (pages.length === 0) return null;
|
||||
return pages
|
||||
.map((m) => (m.id === 'resume' ? s.appearsResume : m.id === 'home' ? s.appearsHome : m.route))
|
||||
.join(', ');
|
||||
};
|
||||
|
||||
return (
|
||||
<footer className="edit-bar" aria-label={s.title}>
|
||||
<div className="edit-bar-row">
|
||||
@@ -138,17 +152,25 @@ export function EditBar({
|
||||
</button>
|
||||
</div>
|
||||
<ul>
|
||||
{doc.paths.map((p) => (
|
||||
<li key={p.path}>
|
||||
<code className="edit-bar-path">{p.path}</code>
|
||||
<span className="edit-bar-value">{truncate(p.before)}</span>
|
||||
<span aria-hidden="true">→</span>
|
||||
<span className="edit-bar-value">{truncate(p.after)}</span>
|
||||
<button type="button" className="edit-btn" onClick={() => onRevertPath(p.path)}>
|
||||
{s.revert}
|
||||
</button>
|
||||
</li>
|
||||
))}
|
||||
{doc.paths.map((p) => {
|
||||
const appears = appearsOn(doc.id, p.path);
|
||||
return (
|
||||
<li key={p.path}>
|
||||
<code className="edit-bar-path">{p.path}</code>
|
||||
<span className="edit-bar-value">{truncate(p.before)}</span>
|
||||
<span aria-hidden="true">→</span>
|
||||
<span className="edit-bar-value">{truncate(p.after)}</span>
|
||||
{appears && (
|
||||
<span className="edit-bar-appears">
|
||||
{s.appearsOn}: {appears}
|
||||
</span>
|
||||
)}
|
||||
<button type="button" className="edit-btn" onClick={() => onRevertPath(doc.id, p.path)}>
|
||||
{s.revert}
|
||||
</button>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
))}
|
||||
|
||||
@@ -173,7 +173,6 @@ export default function EditModeShell({ children }: { children: ReactNode }) {
|
||||
() =>
|
||||
store && (phase === 'ready' || phase === 'offline')
|
||||
? {
|
||||
textDoc: lang === 'en' ? 'content.en' : 'content.vi',
|
||||
commit: (path, value) => {
|
||||
const rejected = store.setValue(lang, path, value);
|
||||
setIssues(rejected ?? []);
|
||||
@@ -183,13 +182,26 @@ export default function EditModeShell({ children }: { children: ReactNode }) {
|
||||
refresh(store);
|
||||
return null;
|
||||
},
|
||||
revert: (path) => {
|
||||
const rejected = store.revertPath(path);
|
||||
describeText: (path) => store.describeText(lang, path),
|
||||
isTextDirty: (path) => store.isTextDirty(lang, path),
|
||||
setText: (path, value) => {
|
||||
const rejected = store.setText(lang, path, value);
|
||||
setIssues(rejected ?? []);
|
||||
if (!rejected) refresh(store);
|
||||
return rejected;
|
||||
},
|
||||
isPathDirty: (path) => store.isPathDirty(path),
|
||||
deleteText: (path) => {
|
||||
const rejected = store.deleteText(lang, path);
|
||||
setIssues(rejected ?? []);
|
||||
if (!rejected) refresh(store);
|
||||
return rejected;
|
||||
},
|
||||
moveText: (path, from, to) => {
|
||||
const rejected = store.moveText(lang, path, from, to);
|
||||
if (rejected) setIssues(rejected);
|
||||
else refresh(store);
|
||||
return rejected;
|
||||
},
|
||||
describe: (doc, path) => store.describeField(doc, path),
|
||||
apply: (doc, next) => {
|
||||
const rejected = store.apply(doc, next);
|
||||
@@ -342,10 +354,10 @@ export default function EditModeShell({ children }: { children: ReactNode }) {
|
||||
[store, refresh],
|
||||
);
|
||||
|
||||
const revertPath = useCallback(
|
||||
(path: string) => {
|
||||
const revertField = useCallback(
|
||||
(id: DraftDocId, path: string) => {
|
||||
if (!store) return;
|
||||
const rejected = store.revertPath(path);
|
||||
const rejected = store.revertIn(id, path);
|
||||
setIssues(rejected ?? []);
|
||||
if (!rejected) refresh(store);
|
||||
},
|
||||
@@ -391,7 +403,7 @@ export default function EditModeShell({ children }: { children: ReactNode }) {
|
||||
onTakeTheirs={resolveTakeTheirs}
|
||||
onResolveField={(id, path, side) => void resolveConflictField(id, path, side)}
|
||||
onDiscardDoc={discardDoc}
|
||||
onRevertPath={revertPath}
|
||||
onRevertPath={revertField}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
|
||||
@@ -1,291 +0,0 @@
|
||||
// JsonPanel (spec-v4 §5.4): the structural editor of edit mode. One tab per
|
||||
// draft document, plus read-only tabs for the two UI dictionaries. The whole
|
||||
// document is shown as JSON; a valid change applies to the draft immediately
|
||||
// (the live page re-renders), an invalid one is rejected and reported with
|
||||
// exact document paths. Templates create records with every required field
|
||||
// present; delete removes the record from the structure document AND its text
|
||||
// in both language documents in one validated step, so no orphan is possible
|
||||
// (§3.4). A conflicted document shows the live master side by side for a
|
||||
// hand-merge.
|
||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||
import { useI18n } from '@/i18n/provider';
|
||||
import { UI } from '@/i18n';
|
||||
import { DRAFT_DOCS } from '@/i18n/draft';
|
||||
import type { DraftDocId, DraftStore } from '@/i18n/draft';
|
||||
import type { ContentIssue } from '@/i18n/validate';
|
||||
|
||||
export type PanelTab = DraftDocId | 'ui.vi' | 'ui.en';
|
||||
|
||||
const PANEL_TABS: PanelTab[] = [...DRAFT_DOCS.map((d) => d.id), 'ui.vi', 'ui.en'];
|
||||
|
||||
// The shape of each document, shown above the editor so the format is
|
||||
// discoverable without reading the spec (§5.4).
|
||||
const SHAPES: Record<PanelTab, string> = {
|
||||
profile:
|
||||
'profile.json — { firstName, lastName, email, githubUrl, linkedinUrl, githubHandle, linkedinHandle, telegramUrl, telegramHandle, philosophy: [{ id }] }',
|
||||
skills: 'skills.json — [{ id, skills: [string] }]',
|
||||
experience:
|
||||
'experience.json — [{ id, location?, variant?: "current" | "gap", logo? }]',
|
||||
projects:
|
||||
'projects.json — [{ id, category, technologies: [string], featured, sections: [{ id, type: "text" | "diagram" | "metrics" | "code" }] }]',
|
||||
'content.vi':
|
||||
'content.vi.json — { profile: { name, title, tagline: [{ text, emphasis? }], bio, subtitle, tldr, currentInterests: [string], roles: [string], philosophyQuotes: [{ title, details: [string] }], philosophy: { <id>: { title, description, keywords: [string] } } }, skills: { <id>: { title } }, experience: { <id>: { title, company, duration, responsibilities: [string] } }, projects: { <id>: { title, summary, role, metrics?: [string], sections: { <id>: { title, content } } } } }',
|
||||
'content.en':
|
||||
'content.en.json — same tree; every field optional, a missing field renders the Vietnamese value',
|
||||
'ui.vi': 'locales/vi/ui.json — chrome strings; read-only in edit mode (Phase 4)',
|
||||
'ui.en': 'locales/en/ui.json — chrome strings; read-only in edit mode (Phase 4)',
|
||||
};
|
||||
|
||||
type RecordRow = { kind: 'project' | 'experience' | 'skill-group' | 'philosophy' | 'section'; id: string; projectId?: string };
|
||||
|
||||
type JsonPanelProps = {
|
||||
store: DraftStore;
|
||||
tab: PanelTab;
|
||||
revision: number;
|
||||
conflicts: DraftDocId[];
|
||||
onClose: () => void;
|
||||
onTab: (tab: PanelTab) => void;
|
||||
onChanged: () => void;
|
||||
onConflictResolved: (id: DraftDocId) => void;
|
||||
};
|
||||
|
||||
export function JsonPanel({
|
||||
store,
|
||||
tab,
|
||||
revision,
|
||||
conflicts,
|
||||
onClose,
|
||||
onTab,
|
||||
onChanged,
|
||||
onConflictResolved,
|
||||
}: JsonPanelProps) {
|
||||
const { ui } = useI18n();
|
||||
const s = ui.edit.panel;
|
||||
const isUi = tab === 'ui.vi' || tab === 'ui.en';
|
||||
const conflicted = !isUi && conflicts.includes(tab as DraftDocId);
|
||||
const [text, setText] = useState('');
|
||||
const [parseError, setParseError] = useState<string | null>(null);
|
||||
const [docIssues, setDocIssues] = useState<ContentIssue[]>([]);
|
||||
const [sectionProject, setSectionProject] = useState('');
|
||||
const textRef = useRef(text);
|
||||
textRef.current = text;
|
||||
|
||||
const documentOf = (target: PanelTab): unknown =>
|
||||
target === 'ui.vi' ? UI.vi : target === 'ui.en' ? UI.en : store.dataOf(target);
|
||||
|
||||
// Load the tab's document as pretty JSON. A textarea that already holds the
|
||||
// same data is left alone — otherwise the store update our own keystroke
|
||||
// caused would re-serialize the text out from under the caret.
|
||||
useEffect(() => {
|
||||
const canonical = JSON.stringify(documentOf(tab), null, 2);
|
||||
try {
|
||||
if (JSON.stringify(JSON.parse(textRef.current), null, 2) === canonical) return;
|
||||
} catch {
|
||||
// textarea currently invalid — reload the last good document
|
||||
}
|
||||
setText(canonical);
|
||||
setParseError(null);
|
||||
setDocIssues([]);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [tab, revision]);
|
||||
|
||||
const applyCandidate = (candidate: unknown) => {
|
||||
const rejected = store.setDocument(tab as DraftDocId, candidate);
|
||||
setDocIssues(rejected ?? []);
|
||||
if (!rejected) onChanged();
|
||||
};
|
||||
|
||||
const handleChange = (next: string) => {
|
||||
setText(next);
|
||||
if (isUi) return;
|
||||
let candidate: unknown;
|
||||
try {
|
||||
candidate = JSON.parse(next);
|
||||
setParseError(null);
|
||||
} catch (error) {
|
||||
setParseError(error instanceof Error ? error.message : String(error));
|
||||
return;
|
||||
}
|
||||
applyCandidate(candidate);
|
||||
};
|
||||
|
||||
const runTemplate = (
|
||||
kind: 'project' | 'experience' | 'skill-group' | 'philosophy' | 'section',
|
||||
options: { projectId?: string } = {},
|
||||
) => {
|
||||
const rejected = store.addRecord(kind, options);
|
||||
setDocIssues(rejected ?? []);
|
||||
if (!rejected) onChanged();
|
||||
};
|
||||
|
||||
const runDelete = (kind: RecordRow['kind'], ids: { id: string; projectId?: string }) => {
|
||||
if (!window.confirm(s.deleteConfirm)) return;
|
||||
const rejected = store.deleteRecord(kind, ids);
|
||||
setDocIssues(rejected ?? []);
|
||||
if (!rejected) onChanged();
|
||||
};
|
||||
|
||||
// The record list mirrors the document currently in the draft — the same
|
||||
// data the textarea shows.
|
||||
const records = useMemo<RecordRow[]>(() => {
|
||||
if (isUi) return [];
|
||||
const list = (value: unknown): { id: string }[] =>
|
||||
Array.isArray(value) ? (value as { id: string }[]) : [];
|
||||
if (tab === 'profile') {
|
||||
const data = store.dataOf('profile') as { philosophy?: { id: string }[] };
|
||||
return list(data.philosophy).map((r) => ({ kind: 'philosophy', id: r.id }));
|
||||
}
|
||||
if (tab === 'skills') {
|
||||
return list(store.dataOf('skills')).map((r) => ({ kind: 'skill-group', id: r.id }));
|
||||
}
|
||||
if (tab === 'experience') {
|
||||
return list(store.dataOf('experience')).map((r) => ({ kind: 'experience', id: r.id }));
|
||||
}
|
||||
const projects = list(store.dataOf('projects')) as { id: string; sections?: { id: string }[] }[];
|
||||
return projects.flatMap((p) => [
|
||||
{ kind: 'project' as const, id: p.id },
|
||||
...list(p.sections).map((sec) => ({ kind: 'section' as const, id: sec.id, projectId: p.id })),
|
||||
]);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [tab, revision, isUi]);
|
||||
|
||||
const projectIds = useMemo(
|
||||
() => (Array.isArray(store.dataOf('projects')) ? (store.dataOf('projects') as { id: string }[]).map((p) => p.id) : []),
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
[revision],
|
||||
);
|
||||
|
||||
const applyMerge = () => {
|
||||
let candidate: unknown;
|
||||
try {
|
||||
candidate = JSON.parse(text);
|
||||
} catch {
|
||||
return; // the draft column must be valid JSON before merging
|
||||
}
|
||||
const rejected = store.setDocument(tab as DraftDocId, candidate);
|
||||
setDocIssues(rejected ?? []);
|
||||
if (!rejected) {
|
||||
onConflictResolved(tab as DraftDocId);
|
||||
onChanged();
|
||||
}
|
||||
};
|
||||
|
||||
const templateFor: Partial<Record<PanelTab, { label: string; run: () => void }>> = {
|
||||
profile: { label: s.addPhilosophy, run: () => runTemplate('philosophy') },
|
||||
skills: { label: s.addSkillGroup, run: () => runTemplate('skill-group') },
|
||||
experience: { label: s.addExperience, run: () => runTemplate('experience') },
|
||||
projects: { label: s.addProject, run: () => runTemplate('project') },
|
||||
};
|
||||
|
||||
return (
|
||||
<aside className="json-panel" aria-label={s.title}>
|
||||
<div className="json-panel-head">
|
||||
<strong>{s.title}</strong>
|
||||
<button type="button" className="edit-btn" onClick={onClose}>
|
||||
{ui.edit.closePanel}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<nav className="json-panel-tabs" aria-label={s.title}>
|
||||
{PANEL_TABS.map((t) => (
|
||||
<button
|
||||
key={t}
|
||||
type="button"
|
||||
className={`json-panel-tab${t === tab ? ' is-active' : ''}`}
|
||||
aria-selected={t === tab}
|
||||
role="tab"
|
||||
onClick={() => onTab(t)}
|
||||
>
|
||||
<code>{t === 'ui.vi' || t === 'ui.en' ? `locales/${t.slice(3)}/ui.json` : DRAFT_DOCS.find((d) => d.id === t)!.file}</code>
|
||||
{conflicts.includes(t as DraftDocId) && <span className="json-panel-conflict-flag">●</span>}
|
||||
</button>
|
||||
))}
|
||||
</nav>
|
||||
|
||||
<pre className="json-panel-shape">{SHAPES[tab]}</pre>
|
||||
|
||||
<div className="json-panel-tools">
|
||||
{templateFor[tab] && (
|
||||
<button type="button" className="edit-btn" onClick={templateFor[tab]!.run}>
|
||||
{templateFor[tab]!.label}
|
||||
</button>
|
||||
)}
|
||||
{(tab === 'content.vi' || tab === 'content.en') && (
|
||||
<span className="json-panel-section-add">
|
||||
<label>
|
||||
{s.addSection}{' '}
|
||||
<select value={sectionProject} onChange={(e) => setSectionProject(e.target.value)}>
|
||||
<option value="">{s.projectLabel}</option>
|
||||
{projectIds.map((id) => (
|
||||
<option key={id} value={id}>
|
||||
{id}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
<button
|
||||
type="button"
|
||||
className="edit-btn"
|
||||
disabled={!sectionProject}
|
||||
onClick={() => runTemplate('section', { projectId: sectionProject })}
|
||||
>
|
||||
{s.addSection}
|
||||
</button>
|
||||
</span>
|
||||
)}
|
||||
{isUi && <span className="json-panel-readonly">{s.readOnly}</span>}
|
||||
</div>
|
||||
|
||||
{records.length > 0 && (
|
||||
<div className="json-panel-records">
|
||||
{records.map((r) => (
|
||||
<span key={`${r.kind}:${r.projectId ?? ''}:${r.id}`} className="json-panel-record">
|
||||
<code>{r.projectId ? `${r.projectId} / ${r.id}` : r.id}</code>
|
||||
<button
|
||||
type="button"
|
||||
className="edit-btn"
|
||||
onClick={() => runDelete(r.kind, { id: r.id, projectId: r.projectId })}
|
||||
>
|
||||
{s.deleteRecord}
|
||||
</button>
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{conflicted && (
|
||||
<div className="json-panel-merge">
|
||||
<label>{s.baseLabel}</label>
|
||||
<textarea value={JSON.stringify(store.baseDataOf(tab as DraftDocId), null, 2)} readOnly spellCheck={false} />
|
||||
<label>{s.draftLabel}</label>
|
||||
<button type="button" className="edit-btn edit-btn-primary" onClick={applyMerge}>
|
||||
{s.applyMerge}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<textarea
|
||||
className="json-panel-editor"
|
||||
value={text}
|
||||
readOnly={isUi}
|
||||
spellCheck={false}
|
||||
aria-label={tab}
|
||||
onChange={(e) => handleChange(e.target.value)}
|
||||
/>
|
||||
|
||||
{(parseError || docIssues.length > 0) && (
|
||||
<ul className="json-panel-issues">
|
||||
{parseError && <li>{s.parseError}: {parseError}</li>}
|
||||
{docIssues.map((issue) => (
|
||||
<li key={`${issue.path}:${issue.message}`}>
|
||||
<code>{issue.path}</code>: {issue.message}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
<span className="json-panel-status" role="status">
|
||||
{parseError ? s.parseError : docIssues.length > 0 ? s.invalid : isUi ? s.readOnly : s.valid}
|
||||
</span>
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import {HeroParticles} from '@/components/sections/HeroParticles'
|
||||
import {EditableText} from '@/components/ui/EditableText'
|
||||
import {SocialLinks} from "@/components/ui/SocialLinks"
|
||||
import {useEdit} from '@/hooks/useEdit'
|
||||
import {deletePath, parsePath, setPath} from '@/i18n/draft'
|
||||
import {ChevronDownIcon, ChevronUpIcon, PlusIcon, TrashIcon} from '@/components/ui/icons'
|
||||
|
||||
export function Hero() {
|
||||
@@ -88,11 +87,10 @@ export function Hero() {
|
||||
aria-label={`${s.edit.emphasis} — ${s.edit.fields.tagline} ${i + 1}`}
|
||||
onMouseDown={(event) => event.stopPropagation()}
|
||||
onClick={() => {
|
||||
const segs = parsePath(`profile.tagline[${i}].emphasis`)
|
||||
if (segment.emphasis) {
|
||||
edit.apply(edit.textDoc, deletePath(edit.dataOf(edit.textDoc), segs))
|
||||
edit.deleteText(`profile.tagline[${i}].emphasis`)
|
||||
} else {
|
||||
edit.apply(edit.textDoc, setPath(edit.dataOf(edit.textDoc), segs, true))
|
||||
edit.setText(`profile.tagline[${i}].emphasis`, true)
|
||||
}
|
||||
}}
|
||||
>
|
||||
@@ -104,7 +102,7 @@ export function Hero() {
|
||||
aria-label={`${s.edit.moveUp} — ${s.edit.fields.tagline} ${i + 1}`}
|
||||
disabled={i === 0}
|
||||
onMouseDown={(event) => event.stopPropagation()}
|
||||
onClick={() => edit.moveItem(edit.textDoc, 'profile.tagline', i, i - 1)}
|
||||
onClick={() => edit.moveText('profile.tagline', i, i - 1)}
|
||||
>
|
||||
<ChevronUpIcon size={12}/>
|
||||
</button>
|
||||
@@ -114,7 +112,7 @@ export function Hero() {
|
||||
aria-label={`${s.edit.moveDown} — ${s.edit.fields.tagline} ${i + 1}`}
|
||||
disabled={i === c.profile.tagline.length - 1}
|
||||
onMouseDown={(event) => event.stopPropagation()}
|
||||
onClick={() => edit.moveItem(edit.textDoc, 'profile.tagline', i, i + 1)}
|
||||
onClick={() => edit.moveText('profile.tagline', i, i + 1)}
|
||||
>
|
||||
<ChevronDownIcon size={12}/>
|
||||
</button>
|
||||
@@ -125,7 +123,7 @@ export function Hero() {
|
||||
onMouseDown={(event) => event.stopPropagation()}
|
||||
onClick={() => {
|
||||
if (window.confirm(s.edit.removeConfirm)) {
|
||||
edit.apply(edit.textDoc, deletePath(edit.dataOf(edit.textDoc), parsePath(`profile.tagline[${i}]`)))
|
||||
edit.deleteText(`profile.tagline[${i}]`)
|
||||
}
|
||||
}}
|
||||
>
|
||||
@@ -160,7 +158,7 @@ export function Hero() {
|
||||
<button
|
||||
type="button"
|
||||
className="edit-add-inline"
|
||||
onClick={() => edit.apply(edit.textDoc, setPath(edit.dataOf(edit.textDoc), parsePath('profile.tagline'), [...c.profile.tagline, {text: s.edit.newTag}]))}
|
||||
onClick={() => edit.setText('profile.tagline', [...c.profile.tagline, { text: s.edit.newTag }])}
|
||||
>
|
||||
<PlusIcon size={12}/>
|
||||
{s.edit.addTaglineSegment}
|
||||
|
||||
@@ -34,9 +34,12 @@ import { PencilIcon } from '@/components/ui/icons';
|
||||
type EditableTextProps = {
|
||||
// The element this site renders today — tag or motion component.
|
||||
as?: ElementType;
|
||||
// Path inside the target document, e.g. `projects.iot-dws-integration.summary`.
|
||||
// A text path carries its entity as the first segment (`profile.bio`,
|
||||
// `projects.iot-dws-integration.summary`): the store resolves the entity
|
||||
// text document of the language being edited (spec-v4-data-organization §3).
|
||||
// `doc` instead names a structure document — the path is then relative to
|
||||
// it, e.g. `3.featured` (E4).
|
||||
path: string;
|
||||
// Target document; defaults to the text document of the edited language (E1).
|
||||
doc?: DraftDocId;
|
||||
// Human-readable field name for the accessibility label (§5.3).
|
||||
label: string;
|
||||
@@ -76,9 +79,9 @@ export function EditableText({
|
||||
<EditableField
|
||||
edit={edit}
|
||||
Comp={Comp}
|
||||
docId={doc ?? edit.textDoc}
|
||||
path={path}
|
||||
label={label}
|
||||
doc={doc}
|
||||
multiline={multiline}
|
||||
fieldControls={fieldControls}
|
||||
className={className}
|
||||
@@ -128,7 +131,7 @@ function readElementText(el: HTMLElement): string {
|
||||
function EditableField({
|
||||
edit,
|
||||
Comp,
|
||||
docId,
|
||||
doc,
|
||||
path,
|
||||
label,
|
||||
multiline,
|
||||
@@ -139,7 +142,7 @@ function EditableField({
|
||||
}: {
|
||||
edit: EditApi;
|
||||
Comp: ElementType;
|
||||
docId: DraftDocId;
|
||||
doc?: DraftDocId;
|
||||
path: string;
|
||||
label: string;
|
||||
multiline: boolean;
|
||||
@@ -154,9 +157,10 @@ function EditableField({
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [copied, setCopied] = useState(false);
|
||||
|
||||
const info = edit.describe(docId, path);
|
||||
const isText = doc === undefined;
|
||||
const info = isText ? edit.describeText(path) : edit.describe(doc, path);
|
||||
const pointer = `${info.doc} → ${info.pointer}`;
|
||||
const dirty = edit.isPathDirtyIn(docId, path);
|
||||
const dirty = isText ? edit.isTextDirty(path) : edit.isPathDirtyIn(doc, path);
|
||||
const cls = [className, 'editable-text', dirty && 'edit-dirty', error && 'edit-invalid']
|
||||
.filter(Boolean)
|
||||
.join(' ');
|
||||
@@ -185,10 +189,9 @@ function EditableField({
|
||||
el.focus(); // empty-required: the field keeps focus
|
||||
return;
|
||||
}
|
||||
const issues =
|
||||
docId === edit.textDoc
|
||||
? edit.commit(path, value)
|
||||
: edit.apply(docId, setPath(edit.dataOf(docId), parsePath(path), value));
|
||||
const issues = isText
|
||||
? edit.commit(path, value)
|
||||
: edit.apply(doc, setPath(edit.dataOf(doc), parsePath(path), value));
|
||||
if (issues) {
|
||||
setError(issues[0]?.message ?? 'invalid');
|
||||
el.focus();
|
||||
|
||||
@@ -15,11 +15,13 @@ import type { DraftDocId } from '@/i18n/draft';
|
||||
import { ChevronDownIcon, ChevronUpIcon, PlusIcon, TrashIcon } from '@/components/ui/icons';
|
||||
|
||||
type TagListEditorProps = {
|
||||
// Structure document to edit; defaults to the text document of the edited
|
||||
// language (E1) — text arrays need no explicit doc.
|
||||
// Structure document to edit. Without it the array is a text array: the
|
||||
// path carries its entity (`profile.currentInterests`,
|
||||
// `projects.lazada.metrics`) and the store resolves the entity document of
|
||||
// the language being edited (spec-v4-data-organization §3).
|
||||
doc?: DraftDocId;
|
||||
// Array path inside that document: `profile.currentInterests` for a text
|
||||
// document, `[2].technologies` for a structure document.
|
||||
// Array path inside the target document: `3.technologies` for a structure
|
||||
// document (document-relative), the entity-prefixed path for a text one.
|
||||
arrayPath: string;
|
||||
items: string[];
|
||||
// The container and item elements the site renders today.
|
||||
@@ -62,10 +64,12 @@ export function TagListEditor({
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
const docId = doc ?? edit.textDoc;
|
||||
|
||||
// Whole-array write — one call for a text or a structure document (E1).
|
||||
const write = (next: string[]) =>
|
||||
edit.apply(docId, setPath(edit.dataOf(docId), parsePath(arrayPath), next));
|
||||
doc
|
||||
? edit.apply(doc, setPath(edit.dataOf(doc), parsePath(arrayPath), next))
|
||||
: edit.setText(arrayPath, next);
|
||||
|
||||
const controls = (i: number) => (
|
||||
<>
|
||||
@@ -75,7 +79,7 @@ export function TagListEditor({
|
||||
aria-label={`${s.edit.moveUp} — ${labelPrefix} ${i + 1}`}
|
||||
disabled={i === 0}
|
||||
onMouseDown={(event) => event.stopPropagation()}
|
||||
onClick={() => edit.moveItem(docId, arrayPath, i, i - 1)}
|
||||
onClick={() => (doc ? edit.moveItem(doc, arrayPath, i, i - 1) : edit.moveText(arrayPath, i, i - 1))}
|
||||
>
|
||||
<ChevronUpIcon size={12} />
|
||||
</button>
|
||||
@@ -85,7 +89,7 @@ export function TagListEditor({
|
||||
aria-label={`${s.edit.moveDown} — ${labelPrefix} ${i + 1}`}
|
||||
disabled={i === items.length - 1}
|
||||
onMouseDown={(event) => event.stopPropagation()}
|
||||
onClick={() => edit.moveItem(docId, arrayPath, i, i + 1)}
|
||||
onClick={() => (doc ? edit.moveItem(doc, arrayPath, i, i + 1) : edit.moveText(arrayPath, i, i + 1))}
|
||||
>
|
||||
<ChevronDownIcon size={12} />
|
||||
</button>
|
||||
@@ -109,7 +113,7 @@ export function TagListEditor({
|
||||
<EditableText
|
||||
key={i}
|
||||
as={Comp}
|
||||
doc={docId}
|
||||
doc={doc}
|
||||
path={`${arrayPath}[${i}]`}
|
||||
label={`${labelPrefix} ${i + 1}`}
|
||||
className={itemClassName}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
// Typed loader for the page manifests (spec-v4-data-organization §5): which
|
||||
// joined records and which page-owned UI groups each page consumes.
|
||||
// Manifests are language-neutral, part of validation, and read-only in the
|
||||
// app — they exist for provenance (EditBar grouping, orphan-field rule),
|
||||
// never for rendering.
|
||||
import aboutJson from './pages/about.json';
|
||||
import contactJson from './pages/contact.json';
|
||||
import experienceJson from './pages/experience.json';
|
||||
import homeJson from './pages/home.json';
|
||||
import philosophyJson from './pages/philosophy.json';
|
||||
import projectDetailJson from './pages/project-detail.json';
|
||||
import projectsJson from './pages/projects.json';
|
||||
import resumeJson from './pages/resume.json';
|
||||
import type { ContentEntityId, PageManifest, PageManifestClaim } from '../types/index';
|
||||
|
||||
export const pageManifests: PageManifest[] = [
|
||||
homeJson,
|
||||
aboutJson,
|
||||
experienceJson,
|
||||
projectsJson,
|
||||
projectDetailJson,
|
||||
contactJson,
|
||||
philosophyJson,
|
||||
resumeJson,
|
||||
] as PageManifest[];
|
||||
|
||||
// Record-keyed text documents (and array structure documents) carry the
|
||||
// record as their first path segment; a claim names the record-relative
|
||||
// field ("summary", "sections.*"). The profile documents name fields
|
||||
// directly.
|
||||
function claimMatches(claim: string, relPath: string): boolean {
|
||||
if (claim === '*') return true;
|
||||
if (claim.endsWith('.*')) return relPath.startsWith(claim.slice(0, -2) + '.');
|
||||
return (
|
||||
relPath === claim || relPath.startsWith(claim + '.') || relPath.startsWith(claim + '[')
|
||||
);
|
||||
}
|
||||
|
||||
// Does this manifest claim this document-relative path?
|
||||
export function manifestClaimsPath(
|
||||
manifest: PageManifest,
|
||||
entity: ContentEntityId,
|
||||
relPath: string,
|
||||
): boolean {
|
||||
const candidate =
|
||||
entity === 'profile'
|
||||
? relPath
|
||||
: relPath.includes('.')
|
||||
? relPath.slice(relPath.indexOf('.') + 1)
|
||||
: '';
|
||||
return manifest.content.some(
|
||||
(claim: PageManifestClaim) =>
|
||||
claim.entity === entity && claim.fields.some((field) => claimMatches(field, candidate)),
|
||||
);
|
||||
}
|
||||
|
||||
// The manifests that claim a path — EditBar's "appears on" annotation
|
||||
// (§6.3), computed from the manifests, never from component code.
|
||||
export function manifestsClaiming(
|
||||
entity: ContentEntityId,
|
||||
relPath: string,
|
||||
): PageManifest[] {
|
||||
return pageManifests.filter((m) => manifestClaimsPath(m, entity, relPath));
|
||||
}
|
||||
|
||||
// Draft path prefixes (`skills`, `experience`) name the text file; the §3
|
||||
// entity ids name the joined record (`skillGroups`, `experiences`). Manifest
|
||||
// claims and EditBar grouping work on the record ids.
|
||||
export function recordEntity(
|
||||
textEntity: 'profile' | 'skills' | 'experience' | 'projects',
|
||||
): ContentEntityId {
|
||||
if (textEntity === 'skills') return 'skillGroups';
|
||||
if (textEntity === 'experience') return 'experiences';
|
||||
return textEntity;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"id": "about",
|
||||
"route": "/about",
|
||||
"content": [
|
||||
{
|
||||
"entity": "profile",
|
||||
"fields": ["name", "bio", "subtitle", "currentInterests", "philosophy"]
|
||||
},
|
||||
{ "entity": "skillGroups", "fields": ["*"] }
|
||||
],
|
||||
"ui": ["about"]
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"id": "contact",
|
||||
"route": "/contact",
|
||||
"content": [
|
||||
{
|
||||
"entity": "profile",
|
||||
"fields": [
|
||||
"email",
|
||||
"githubUrl",
|
||||
"githubHandle",
|
||||
"linkedinUrl",
|
||||
"linkedinHandle",
|
||||
"telegramUrl",
|
||||
"telegramHandle"
|
||||
]
|
||||
}
|
||||
],
|
||||
"ui": ["contact"]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"id": "experience",
|
||||
"route": "/experience",
|
||||
"content": [
|
||||
{ "entity": "profile", "fields": ["tldr"] },
|
||||
{ "entity": "experiences", "fields": ["*"] }
|
||||
],
|
||||
"ui": ["experience"]
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"id": "home",
|
||||
"route": "/",
|
||||
"content": [
|
||||
{
|
||||
"entity": "profile",
|
||||
"fields": [
|
||||
"name",
|
||||
"tagline",
|
||||
"roles",
|
||||
"bio",
|
||||
"currentInterests",
|
||||
"philosophy",
|
||||
"tldr",
|
||||
"email",
|
||||
"githubUrl",
|
||||
"githubHandle",
|
||||
"linkedinUrl",
|
||||
"linkedinHandle",
|
||||
"telegramUrl",
|
||||
"telegramHandle"
|
||||
]
|
||||
},
|
||||
{ "entity": "skillGroups", "fields": ["*"] },
|
||||
{ "entity": "experiences", "fields": ["*"] },
|
||||
{ "entity": "projects", "fields": ["featured", "title", "summary", "technologies", "category"] }
|
||||
],
|
||||
"ui": ["hero", "about", "expertise", "experience", "projects", "contact"]
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"id": "philosophy",
|
||||
"route": "/philosophy",
|
||||
"content": [
|
||||
{ "entity": "profile", "fields": ["philosophyQuotes"] }
|
||||
],
|
||||
"ui": ["philosophy"]
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"id": "project-detail",
|
||||
"route": "/projects/:id",
|
||||
"content": [
|
||||
{
|
||||
"entity": "projects",
|
||||
"fields": ["title", "summary", "role", "metrics", "technologies", "category", "sections.*"]
|
||||
}
|
||||
],
|
||||
"ui": ["projectDetail"]
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"id": "projects",
|
||||
"route": "/projects",
|
||||
"content": [
|
||||
{ "entity": "projects", "fields": ["*"] }
|
||||
],
|
||||
"ui": ["projects"]
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"id": "resume",
|
||||
"route": null,
|
||||
"content": [
|
||||
{
|
||||
"entity": "profile",
|
||||
"fields": [
|
||||
"name",
|
||||
"title",
|
||||
"bio",
|
||||
"email",
|
||||
"githubUrl",
|
||||
"githubHandle",
|
||||
"linkedinUrl",
|
||||
"linkedinHandle",
|
||||
"telegramUrl",
|
||||
"telegramHandle"
|
||||
]
|
||||
},
|
||||
{ "entity": "skillGroups", "fields": ["*"] },
|
||||
{ "entity": "experiences", "fields": ["*"] },
|
||||
{ "entity": "projects", "fields": ["*"] }
|
||||
],
|
||||
"ui": []
|
||||
}
|
||||
+17
-10
@@ -13,16 +13,23 @@ import type {
|
||||
|
||||
// commit/apply/revert return the validator issues when the candidate draft is
|
||||
// invalid (the change was NOT applied), or null when it was accepted.
|
||||
//
|
||||
// Two path conventions (spec-v4-data-organization §3): a TEXT path carries
|
||||
// its entity as the first segment (`projects.lazada.summary`) and the store
|
||||
// resolves the entity document of the language being edited; a STRUCTURE path
|
||||
// is always given together with the structure document id and is relative to
|
||||
// that document (`summary` inside 'projects').
|
||||
export type EditApi = {
|
||||
// The text document of the language being edited — the default `doc` for
|
||||
// every text path (E1).
|
||||
textDoc: DraftDocId;
|
||||
// Text-document helpers, unchanged from v1 (paths relative to textDoc).
|
||||
// Text fields: the target document is derived from the path + language.
|
||||
commit: (path: string, value: string) => ContentIssue[] | null;
|
||||
revert: (path: string) => ContentIssue[] | null;
|
||||
isPathDirty: (path: string) => boolean;
|
||||
// Generic draft surface (E4): read one document, propose the next version,
|
||||
// ask where a field lives.
|
||||
describeText: (path: string) => FieldInfo;
|
||||
isTextDirty: (path: string) => boolean;
|
||||
// Write any value at a text path — a leaf, a tag array, a segment object
|
||||
// (E1/E5). deleteText/moveText cover removal and order.
|
||||
setText: (path: string, value: unknown) => ContentIssue[] | null;
|
||||
deleteText: (path: string) => ContentIssue[] | null;
|
||||
moveText: (path: string, from: number, to: number) => ContentIssue[] | null;
|
||||
// Structure documents: explicit doc id, document-relative paths.
|
||||
describe: (doc: DraftDocId, path: string) => FieldInfo;
|
||||
apply: (doc: DraftDocId, next: unknown) => ContentIssue[] | null;
|
||||
dataOf: (doc: DraftDocId) => unknown;
|
||||
@@ -30,8 +37,8 @@ export type EditApi = {
|
||||
setStructured: (doc: DraftDocId, path: string, value: unknown) => ContentIssue[] | null;
|
||||
deleteStructured: (doc: DraftDocId, path: string) => ContentIssue[] | null;
|
||||
isPathDirtyIn: (doc: DraftDocId, path: string) => boolean;
|
||||
// One primitive for every order question (E5): record order (document root
|
||||
// array) and tag order (array field) are the same move.
|
||||
// One primitive for every structure order question (E5): record order
|
||||
// (document root array) and tag order (array field) are the same move.
|
||||
moveItem: (doc: DraftDocId, path: string, from: number, to: number) => ContentIssue[] | null;
|
||||
// Records (E2/E3): structure record + text entries move as one action.
|
||||
addRecord: (kind: RecordKind, options?: { projectId?: string }) => ContentIssue[] | null;
|
||||
|
||||
+35
-5
@@ -9,7 +9,20 @@ import type {
|
||||
ProjectId,
|
||||
SkillGroupId,
|
||||
} from '../types/index';
|
||||
import uiViJson from './locales/vi/ui.json';
|
||||
import navJson from './locales/vi/ui/navigation.json';
|
||||
import footerJson from './locales/vi/ui/footer.json';
|
||||
import socialJson from './locales/vi/ui/social.json';
|
||||
import heroJson from './locales/vi/ui/hero.json';
|
||||
import aboutJson from './locales/vi/ui/about.json';
|
||||
import expertiseJson from './locales/vi/ui/expertise.json';
|
||||
import experienceJson from './locales/vi/ui/experience.json';
|
||||
import projectsJson from './locales/vi/ui/projects.json';
|
||||
import contactJson from './locales/vi/ui/contact.json';
|
||||
import projectDetailJson from './locales/vi/ui/project-detail.json';
|
||||
import philosophyJson from './locales/vi/ui/philosophy.json';
|
||||
import commonJson from './locales/vi/ui/common.json';
|
||||
import resumeJson from './locales/vi/ui/resume.json';
|
||||
import editJson from './locales/vi/ui/edit.json';
|
||||
|
||||
// --- structure (src/data/*.json) ---
|
||||
|
||||
@@ -121,8 +134,25 @@ type PartialDeep<T> = T extends readonly unknown[]
|
||||
|
||||
export type ContentEn = { [K in keyof ContentVi]?: PartialDeep<ContentVi[K]> };
|
||||
|
||||
// --- UI (src/i18n/locales/{vi,en}/ui.json) ---
|
||||
// --- UI (src/i18n/locales/{vi,en}/ui/{group}.json) ---
|
||||
|
||||
// Derived from the complete Vietnamese tree; the en import is checked against
|
||||
// this type in index.ts — both files are complete by construction (§3.3).
|
||||
export type UIDict = typeof uiViJson;
|
||||
// Derived from the complete Vietnamese group files (spec-v4-data-organization
|
||||
// §4); index.ts assembles the merged record in this key order and the en
|
||||
// groups are checked against the same type — both sides are complete by
|
||||
// construction (§3.3).
|
||||
export type UIDict = {
|
||||
nav: typeof navJson;
|
||||
social: typeof socialJson;
|
||||
footer: typeof footerJson;
|
||||
hero: typeof heroJson;
|
||||
about: typeof aboutJson;
|
||||
expertise: typeof expertiseJson;
|
||||
experience: typeof experienceJson;
|
||||
projects: typeof projectsJson;
|
||||
contact: typeof contactJson;
|
||||
projectDetail: typeof projectDetailJson;
|
||||
philosophy: typeof philosophyJson;
|
||||
common: typeof commonJson;
|
||||
resume: typeof resumeJson;
|
||||
edit: typeof editJson;
|
||||
};
|
||||
+219
-112
@@ -3,8 +3,14 @@
|
||||
// tracking, cross-document validation on every accepted edit, sessionStorage
|
||||
// durability, and the sequential-PUT save pipeline with blob-sha
|
||||
// optimistic concurrency. Pure logic — the React glue lives in EditModeShell.
|
||||
import contentEnJson from './locales/en/content.json';
|
||||
import contentViJson from './locales/vi/content.json';
|
||||
import experienceEnTextJson from './locales/en/content/experience.json';
|
||||
import experienceViTextJson from './locales/vi/content/experience.json';
|
||||
import profileEnTextJson from './locales/en/content/profile.json';
|
||||
import profileViTextJson from './locales/vi/content/profile.json';
|
||||
import projectsEnTextJson from './locales/en/content/projects.json';
|
||||
import projectsViTextJson from './locales/vi/content/projects.json';
|
||||
import skillsEnTextJson from './locales/en/content/skills.json';
|
||||
import skillsViTextJson from './locales/vi/content/skills.json';
|
||||
import experienceJson from '../data/experience.json';
|
||||
import profileJson from '../data/profile.json';
|
||||
import projectsJson from '../data/projects.json';
|
||||
@@ -19,8 +25,14 @@ export type DraftDocId =
|
||||
| 'skills'
|
||||
| 'experience'
|
||||
| 'projects'
|
||||
| 'content.vi'
|
||||
| 'content.en';
|
||||
| 'profile.vi'
|
||||
| 'profile.en'
|
||||
| 'skills.vi'
|
||||
| 'skills.en'
|
||||
| 'experience.vi'
|
||||
| 'experience.en'
|
||||
| 'projects.vi'
|
||||
| 'projects.en';
|
||||
|
||||
export type DraftDocMeta = {
|
||||
id: DraftDocId;
|
||||
@@ -29,17 +41,62 @@ export type DraftDocMeta = {
|
||||
lang?: Language;
|
||||
};
|
||||
|
||||
// The six documents an edit session may write. `ui.{vi,en}.json` are shown
|
||||
// read-only in the panel (§5.1) and never enter a draft.
|
||||
// The twelve documents an edit session may write: four structure documents
|
||||
// plus one text document per entity per language (spec-v4-data-organization
|
||||
// §6.1). The page manifests and the UI group files are read-only in the app
|
||||
// and never enter a draft.
|
||||
export const DRAFT_DOCS: readonly DraftDocMeta[] = [
|
||||
{ id: 'profile', file: 'src/data/profile.json', kind: 'structure' },
|
||||
{ id: 'skills', file: 'src/data/skills.json', kind: 'structure' },
|
||||
{ id: 'experience', file: 'src/data/experience.json', kind: 'structure' },
|
||||
{ id: 'projects', file: 'src/data/projects.json', kind: 'structure' },
|
||||
{ id: 'content.vi', file: 'src/i18n/locales/vi/content.json', kind: 'text', lang: 'vi' },
|
||||
{ id: 'content.en', file: 'src/i18n/locales/en/content.json', kind: 'text', lang: 'en' },
|
||||
{ id: 'profile.vi', file: 'src/i18n/locales/vi/content/profile.json', kind: 'text', lang: 'vi' },
|
||||
{ id: 'profile.en', file: 'src/i18n/locales/en/content/profile.json', kind: 'text', lang: 'en' },
|
||||
{ id: 'skills.vi', file: 'src/i18n/locales/vi/content/skills.json', kind: 'text', lang: 'vi' },
|
||||
{ id: 'skills.en', file: 'src/i18n/locales/en/content/skills.json', kind: 'text', lang: 'en' },
|
||||
{ id: 'experience.vi', file: 'src/i18n/locales/vi/content/experience.json', kind: 'text', lang: 'vi' },
|
||||
{ id: 'experience.en', file: 'src/i18n/locales/en/content/experience.json', kind: 'text', lang: 'en' },
|
||||
{ id: 'projects.vi', file: 'src/i18n/locales/vi/content/projects.json', kind: 'text', lang: 'vi' },
|
||||
{ id: 'projects.en', file: 'src/i18n/locales/en/content/projects.json', kind: 'text', lang: 'en' },
|
||||
];
|
||||
|
||||
// Text entities, keyed by the leading path segment a text write carries
|
||||
// (`profile.bio` → entity `profile`). The record name is the joined-record
|
||||
// key the page manifests use (spec-v4-data-organization §3) — the mapping is
|
||||
// needed only there, so it lives in src/data/pages.ts.
|
||||
export const TEXT_ENTITIES = ['profile', 'skills', 'experience', 'projects'] as const;
|
||||
export type TextEntity = (typeof TEXT_ENTITIES)[number];
|
||||
|
||||
export function textDocId(entity: TextEntity, lang: Language): DraftDocId {
|
||||
return `${entity}.${lang}` as DraftDocId;
|
||||
}
|
||||
|
||||
// A text path carries its entity as the first segment; inside the entity's
|
||||
// text document the pointer is the rest (E7: the provenance chip shows
|
||||
// `locales/vi/content/profile.json → bio`).
|
||||
export function splitTextPath(path: string): { entity: TextEntity; rest: string } | null {
|
||||
const dot = path.indexOf('.');
|
||||
const head = dot < 0 ? path : path.slice(0, dot);
|
||||
if (!TEXT_ENTITIES.includes(head as TextEntity)) return null;
|
||||
return { entity: head as TextEntity, rest: dot < 0 ? '' : path.slice(dot + 1) };
|
||||
}
|
||||
|
||||
// The entity a draft document belongs to: text documents carry it in the id
|
||||
// (`projects.vi`), structure documents are named by it. EditBar uses this to
|
||||
// group changed paths against the page manifests (spec-v4-data-organization §6.3).
|
||||
const STRUCTURE_ENTITY: Record<string, TextEntity> = {
|
||||
profile: 'profile',
|
||||
skills: 'skills',
|
||||
experience: 'experience',
|
||||
projects: 'projects',
|
||||
};
|
||||
|
||||
export function entityOfDoc(id: DraftDocId): TextEntity | null {
|
||||
const dot = id.indexOf('.');
|
||||
if (dot >= 0) return id.slice(0, dot) as TextEntity;
|
||||
return STRUCTURE_ENTITY[id] ?? null;
|
||||
}
|
||||
|
||||
export const PROXY_BASE = '/api/content/';
|
||||
export const TYPES_FILE = 'src/types/index.ts';
|
||||
|
||||
@@ -249,8 +306,14 @@ export function bundledBase(): Record<DraftDocId, DocBase> {
|
||||
skills: { data: structuredClone(skillsJson), sha: '' },
|
||||
experience: { data: structuredClone(experienceJson), sha: '' },
|
||||
projects: { data: structuredClone(projectsJson), sha: '' },
|
||||
'content.vi': { data: structuredClone(contentViJson), sha: '' },
|
||||
'content.en': { data: structuredClone(contentEnJson), sha: '' },
|
||||
'profile.vi': { data: structuredClone(profileViTextJson), sha: '' },
|
||||
'profile.en': { data: structuredClone(profileEnTextJson), sha: '' },
|
||||
'skills.vi': { data: structuredClone(skillsViTextJson), sha: '' },
|
||||
'skills.en': { data: structuredClone(skillsEnTextJson), sha: '' },
|
||||
'experience.vi': { data: structuredClone(experienceViTextJson), sha: '' },
|
||||
'experience.en': { data: structuredClone(experienceEnTextJson), sha: '' },
|
||||
'projects.vi': { data: structuredClone(projectsViTextJson), sha: '' },
|
||||
'projects.en': { data: structuredClone(projectsEnTextJson), sha: '' },
|
||||
};
|
||||
}
|
||||
|
||||
@@ -388,10 +451,6 @@ export class DraftStore {
|
||||
return this.working.size > 0;
|
||||
}
|
||||
|
||||
isPathDirty(path: string): boolean {
|
||||
return this.touched().some((id) => this.changedPaths(id).includes(path));
|
||||
}
|
||||
|
||||
changedDocs(): { id: DraftDocId; paths: { path: string; before: unknown; after: unknown }[] }[] {
|
||||
return this.touched().map((id) => ({
|
||||
id,
|
||||
@@ -430,8 +489,18 @@ export class DraftStore {
|
||||
|
||||
draftTexts(): { vi: ContentVi; en: ContentEn } {
|
||||
return {
|
||||
vi: this.dataOf('content.vi') as ContentVi,
|
||||
en: this.dataOf('content.en') as ContentEn,
|
||||
vi: {
|
||||
profile: this.dataOf('profile.vi') as ContentVi['profile'],
|
||||
skills: this.dataOf('skills.vi') as ContentVi['skills'],
|
||||
experience: this.dataOf('experience.vi') as ContentVi['experience'],
|
||||
projects: this.dataOf('projects.vi') as ContentVi['projects'],
|
||||
},
|
||||
en: {
|
||||
profile: this.dataOf('profile.en') as ContentEn['profile'],
|
||||
skills: this.dataOf('skills.en') as ContentEn['skills'],
|
||||
experience: this.dataOf('experience.en') as ContentEn['experience'],
|
||||
projects: this.dataOf('projects.en') as ContentEn['projects'],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -440,36 +509,69 @@ export class DraftStore {
|
||||
return collectContentIssues(this.draftStructures(), texts.vi, texts.en);
|
||||
}
|
||||
|
||||
// Inline text edit (§5.3): the value lands in the text document of the
|
||||
// language being edited; missing en entries are created, vi paths always
|
||||
// exist. Returns the validator issues when the candidate draft is invalid,
|
||||
// leaving the store untouched.
|
||||
// --- text documents -----------------------------------------------------------
|
||||
// A text path carries its entity as the first segment; the target document
|
||||
// is that entity's text file in the language being edited, and the pointer
|
||||
// inside it is the rest (spec-v4-data-organization §3, E7). Missing en
|
||||
// entries are created, vi paths always exist (§5.3). Invalid candidates
|
||||
// return the validator issues and leave the store untouched.
|
||||
|
||||
private textTarget(
|
||||
lang: Language,
|
||||
path: string,
|
||||
): { id: DraftDocId; segs: PathSeg[]; rest: string } | null {
|
||||
const split = splitTextPath(path);
|
||||
if (!split) return null;
|
||||
return { id: textDocId(split.entity, lang), segs: parsePath(split.rest), rest: split.rest };
|
||||
}
|
||||
|
||||
setValue(lang: Language, path: string, value: string): ContentIssue[] | null {
|
||||
const id: DraftDocId = lang === 'vi' ? 'content.vi' : 'content.en';
|
||||
return this.tryApply(new Map([[id, setPath(this.dataOf(id), parsePath(path), value)]]));
|
||||
return this.setText(lang, path, value);
|
||||
}
|
||||
|
||||
// Whole-document replacement from the JSON panel (§5.4).
|
||||
setDocument(id: DraftDocId, data: unknown): ContentIssue[] | null {
|
||||
return this.tryApply(new Map([[id, data]]));
|
||||
// Write any value at a text path — a string leaf, a tag array, a tagline
|
||||
// segment object. One write surface for every text shape (E1/E5).
|
||||
setText(lang: Language, path: string, value: unknown): ContentIssue[] | null {
|
||||
const t = this.textTarget(lang, path);
|
||||
if (!t) return [{ path, message: 'not a text path' }];
|
||||
return this.tryApply(new Map([[t.id, setPath(this.dataOf(t.id), t.segs, value)]]));
|
||||
}
|
||||
|
||||
// Per-field revert (§5.3): restore the baseline value at this path in every
|
||||
// touched text document; a path that was newly created is removed instead.
|
||||
revertPath(path: string): ContentIssue[] | null {
|
||||
const segs = parsePath(path);
|
||||
let lastIssues: ContentIssue[] | null = null;
|
||||
for (const id of ['content.vi', 'content.en'] as const) {
|
||||
if (!this.changedPaths(id).includes(path)) continue;
|
||||
const original = getPath(this.base.get(id)!.data, segs);
|
||||
const current = this.dataOf(id);
|
||||
const next =
|
||||
original === undefined
|
||||
? deletePath(current, segs)
|
||||
: setPath(current, segs, original);
|
||||
lastIssues = this.tryApply(new Map([[id, next]]));
|
||||
deleteText(lang: Language, path: string): ContentIssue[] | null {
|
||||
const t = this.textTarget(lang, path);
|
||||
if (!t) return [{ path, message: 'not a text path' }];
|
||||
return this.tryApply(new Map([[t.id, deletePath(this.dataOf(t.id), t.segs)]]));
|
||||
}
|
||||
|
||||
moveText(lang: Language, path: string, from: number, to: number): ContentIssue[] | null {
|
||||
const t = this.textTarget(lang, path);
|
||||
if (!t) return [{ path, message: 'not a text path' }];
|
||||
const arr = getPath(this.dataOf(t.id), t.segs);
|
||||
if (!Array.isArray(arr) || from < 0 || to < 0 || from >= arr.length || to >= arr.length) {
|
||||
return null;
|
||||
}
|
||||
return lastIssues;
|
||||
const next = [...arr];
|
||||
const [moved] = next.splice(from, 1);
|
||||
next.splice(to, 0, moved);
|
||||
return this.tryApply(new Map([[t.id, setPath(this.dataOf(t.id), t.segs, next)]]));
|
||||
}
|
||||
|
||||
isTextDirty(lang: Language, path: string): boolean {
|
||||
const t = this.textTarget(lang, path);
|
||||
return t !== null && this.changedPaths(t.id).includes(t.rest);
|
||||
}
|
||||
|
||||
// Per-field revert (§5.3): restore the baseline value at this document-
|
||||
// relative path in this document; a path that was newly created is removed.
|
||||
revertIn(id: DraftDocId, path: string): ContentIssue[] | null {
|
||||
if (!this.changedPaths(id).includes(path)) return null;
|
||||
const segs = parsePath(path);
|
||||
const original = getPath(this.base.get(id)!.data, segs);
|
||||
const next =
|
||||
original === undefined
|
||||
? deletePath(this.dataOf(id), segs)
|
||||
: setPath(this.dataOf(id), segs, original);
|
||||
return this.tryApply(new Map([[id, next]]));
|
||||
}
|
||||
|
||||
discardDocument(id: DraftDocId): void {
|
||||
@@ -481,10 +583,20 @@ export class DraftStore {
|
||||
// are created or removed in one action — orphan text is never produced.
|
||||
addRecord(kind: RecordKind, options: { projectId?: string } = {}): ContentIssue[] | null {
|
||||
const candidates = new Map<DraftDocId, unknown>();
|
||||
const vi = structuredClone(this.dataOf('content.vi')) as Record<string, any>;
|
||||
const en = structuredClone(this.dataOf('content.en')) as Record<string, any>;
|
||||
let createdIds: RecordIds | null = null;
|
||||
|
||||
// Structure record and text entries are created in one action — orphan
|
||||
// text is never produced (§5.4). The text lives in the entity's own
|
||||
// document in both languages.
|
||||
const withTexts = (entity: TextEntity, mutate: (doc: Record<string, any>) => void) => {
|
||||
for (const lang of ['vi', 'en'] as const) {
|
||||
const id = textDocId(entity, lang);
|
||||
const doc = structuredClone(this.dataOf(id)) as Record<string, any>;
|
||||
mutate(doc);
|
||||
candidates.set(id, doc);
|
||||
}
|
||||
};
|
||||
|
||||
if (kind === 'project') {
|
||||
const projects = structuredClone(this.dataOf('projects')) as Record<string, any>[];
|
||||
const id = uniqueId('new-project', projects.map((p) => p.id));
|
||||
@@ -492,8 +604,9 @@ export class DraftStore {
|
||||
projects.push({ id, category: 'experiment', technologies: [], featured: false, sections: [] });
|
||||
candidates.set('projects', projects);
|
||||
const stub = { title: 'New project', summary: 'Write the summary here.', role: 'Owner', sections: {} };
|
||||
vi.projects = { ...vi.projects, [id]: structuredClone(stub) };
|
||||
en.projects = { ...en.projects, [id]: structuredClone(stub) };
|
||||
withTexts('projects', (doc) => {
|
||||
doc[id] = structuredClone(stub);
|
||||
});
|
||||
} else if (kind === 'experience') {
|
||||
const experiences = structuredClone(this.dataOf('experience')) as Record<string, any>[];
|
||||
const id = uniqueId('new-experience', experiences.map((e) => e.id));
|
||||
@@ -501,16 +614,18 @@ export class DraftStore {
|
||||
experiences.push({ id });
|
||||
candidates.set('experience', experiences);
|
||||
const stub = { title: 'New role', company: 'New company', duration: 'present', responsibilities: ['Write a responsibility here.'] };
|
||||
vi.experience = { ...vi.experience, [id]: structuredClone(stub) };
|
||||
en.experience = { ...en.experience, [id]: structuredClone(stub) };
|
||||
withTexts('experience', (doc) => {
|
||||
doc[id] = structuredClone(stub);
|
||||
});
|
||||
} else if (kind === 'skill-group') {
|
||||
const groups = structuredClone(this.dataOf('skills')) as Record<string, any>[];
|
||||
const id = uniqueId('new-skill-group', groups.map((g) => g.id));
|
||||
createdIds = { id };
|
||||
groups.push({ id, skills: ['New skill'] });
|
||||
candidates.set('skills', groups);
|
||||
vi.skills = { ...vi.skills, [id]: { title: 'New skill group' } };
|
||||
en.skills = { ...en.skills, [id]: { title: 'New skill group' } };
|
||||
withTexts('skills', (doc) => {
|
||||
doc[id] = { title: 'New skill group' };
|
||||
});
|
||||
} else if (kind === 'philosophy') {
|
||||
const profile = structuredClone(this.dataOf('profile')) as Record<string, any>;
|
||||
const points = profile.philosophy as Record<string, any>[];
|
||||
@@ -519,8 +634,9 @@ export class DraftStore {
|
||||
points.push({ id });
|
||||
candidates.set('profile', profile);
|
||||
const stub = { title: 'New principle', description: 'Write the principle here.', keywords: ['new-keyword'] };
|
||||
vi.profile = { ...vi.profile, philosophy: { ...vi.profile.philosophy, [id]: structuredClone(stub) } };
|
||||
en.profile = { ...en.profile, philosophy: { ...en.profile.philosophy, [id]: structuredClone(stub) } };
|
||||
withTexts('profile', (doc) => {
|
||||
doc.philosophy = { ...doc.philosophy, [id]: structuredClone(stub) };
|
||||
});
|
||||
} else {
|
||||
const projectId = options.projectId;
|
||||
if (!projectId) return [{ path: 'projects.json', message: 'pick a project first' }];
|
||||
@@ -532,28 +648,25 @@ export class DraftStore {
|
||||
project.sections = [...project.sections, { id: sectionId, type: 'text' }];
|
||||
candidates.set('projects', projects);
|
||||
const stub = { title: 'New section', content: 'Write the section here.' };
|
||||
for (const texts of [vi, en]) {
|
||||
const text = texts.projects[projectId] as Record<string, any>;
|
||||
texts.projects = {
|
||||
...texts.projects,
|
||||
[projectId]: { ...text, sections: { ...text.sections, [sectionId]: structuredClone(stub) } },
|
||||
};
|
||||
}
|
||||
withTexts('projects', (doc) => {
|
||||
const text = doc[projectId] as Record<string, any>;
|
||||
doc[projectId] = { ...text, sections: { ...text.sections, [sectionId]: structuredClone(stub) } };
|
||||
});
|
||||
}
|
||||
candidates.set('content.vi', vi);
|
||||
candidates.set('content.en', en);
|
||||
const issues = this.tryApply(candidates);
|
||||
if (issues === null && createdIds) this.created.add(recordKey(kind, createdIds));
|
||||
return issues;
|
||||
}
|
||||
|
||||
// Delete removes the record's text entries from both language documents in
|
||||
// the same action — the validator can never see orphan text (§5.4).
|
||||
// Delete removes the structure record and the record's text entries from
|
||||
// both language documents in the same action — the validator can never see
|
||||
// orphan text (§5.4).
|
||||
deleteRecord(kind: RecordKind, ids: RecordIds): ContentIssue[] | null {
|
||||
const candidates = new Map<DraftDocId, unknown>();
|
||||
|
||||
const dropFromTexts = (mutate: (doc: Record<string, any>) => void) => {
|
||||
for (const id of ['content.vi', 'content.en'] as const) {
|
||||
const withTexts = (entity: TextEntity, mutate: (doc: Record<string, any>) => void) => {
|
||||
for (const lang of ['vi', 'en'] as const) {
|
||||
const id = textDocId(entity, lang);
|
||||
const doc = structuredClone(this.dataOf(id)) as Record<string, any>;
|
||||
mutate(doc);
|
||||
candidates.set(id, doc);
|
||||
@@ -561,27 +674,26 @@ export class DraftStore {
|
||||
};
|
||||
|
||||
if (kind === 'project') {
|
||||
const projects = (this.dataOf('projects') as Record<string, any>[]).filter((p) => p.id !== ids.id);
|
||||
candidates.set('projects', projects);
|
||||
dropFromTexts((doc) => {
|
||||
delete doc.projects[ids.id];
|
||||
candidates.set('projects', (this.dataOf('projects') as Record<string, any>[]).filter((p) => p.id !== ids.id));
|
||||
withTexts('projects', (doc) => {
|
||||
delete doc[ids.id];
|
||||
});
|
||||
} else if (kind === 'experience') {
|
||||
candidates.set('experience', (this.dataOf('experience') as Record<string, any>[]).filter((e) => e.id !== ids.id));
|
||||
dropFromTexts((doc) => {
|
||||
delete doc.experience[ids.id];
|
||||
withTexts('experience', (doc) => {
|
||||
delete doc[ids.id];
|
||||
});
|
||||
} else if (kind === 'skill-group') {
|
||||
candidates.set('skills', (this.dataOf('skills') as Record<string, any>[]).filter((g) => g.id !== ids.id));
|
||||
dropFromTexts((doc) => {
|
||||
delete doc.skills[ids.id];
|
||||
withTexts('skills', (doc) => {
|
||||
delete doc[ids.id];
|
||||
});
|
||||
} else if (kind === 'philosophy') {
|
||||
const profile = structuredClone(this.dataOf('profile')) as Record<string, any>;
|
||||
profile.philosophy = (profile.philosophy as Record<string, any>[]).filter((p) => p.id !== ids.id);
|
||||
candidates.set('profile', profile);
|
||||
dropFromTexts((doc) => {
|
||||
delete doc.profile.philosophy[ids.id];
|
||||
withTexts('profile', (doc) => {
|
||||
delete doc.philosophy[ids.id];
|
||||
});
|
||||
} else {
|
||||
const projectId = ids.projectId;
|
||||
@@ -591,8 +703,8 @@ export class DraftStore {
|
||||
if (!project) return [{ path: 'projects.json', message: `no project ${projectId}` }];
|
||||
project.sections = (project.sections as Record<string, any>[]).filter((s) => s.id !== ids.id);
|
||||
candidates.set('projects', projects);
|
||||
dropFromTexts((doc) => {
|
||||
const text = doc.projects[projectId];
|
||||
withTexts('projects', (doc) => {
|
||||
const text = doc[projectId];
|
||||
if (text) text.sections = { ...text.sections };
|
||||
delete text?.sections[ids.id];
|
||||
});
|
||||
@@ -609,6 +721,14 @@ export class DraftStore {
|
||||
return { doc: file.replace(/^src\//, ''), pointer: path, repoPath: file };
|
||||
}
|
||||
|
||||
// Provenance for a text path (E7): resolves the entity document for the
|
||||
// language being edited — the chip reads `locales/vi/content/profile.json → bio`.
|
||||
describeText(lang: Language, path: string): FieldInfo {
|
||||
const split = splitTextPath(path);
|
||||
if (!split) return { doc: 'content', pointer: path, repoPath: path };
|
||||
return this.describeField(textDocId(split.entity, lang), split.rest);
|
||||
}
|
||||
|
||||
// --- generic document writes (E4/E5): structure fields and text arrays ----
|
||||
|
||||
apply(id: DraftDocId, next: unknown): ContentIssue[] | null {
|
||||
@@ -651,14 +771,24 @@ export class DraftStore {
|
||||
const candidates = new Map<DraftDocId, unknown>();
|
||||
let newId = slug;
|
||||
|
||||
const renameInTexts = (mutate: (doc: Record<string, any>) => void) => {
|
||||
for (const id of ['content.vi', 'content.en'] as const) {
|
||||
const withTexts = (entity: TextEntity, mutate: (doc: Record<string, any>) => void) => {
|
||||
for (const lang of ['vi', 'en'] as const) {
|
||||
const id = textDocId(entity, lang);
|
||||
const doc = structuredClone(this.dataOf(id)) as Record<string, any>;
|
||||
mutate(doc);
|
||||
candidates.set(id, doc);
|
||||
}
|
||||
};
|
||||
|
||||
// Rename a record key in place, keeping the document's key order so the
|
||||
// committed file stays reviewable.
|
||||
const renameKey = (doc: Record<string, any>, from: string, to: string) => {
|
||||
if (doc[from] === undefined) return;
|
||||
const entries = Object.entries(doc).map(([k, v]) => (k === from ? [to, v] : [k, v]));
|
||||
for (const k of Object.keys(doc)) delete doc[k];
|
||||
Object.assign(doc, Object.fromEntries(entries));
|
||||
};
|
||||
|
||||
if (kind === 'project') {
|
||||
const projects = structuredClone(this.dataOf('projects')) as Record<string, any>[];
|
||||
newId = uniqueId(slug, projects.map((p) => p.id));
|
||||
@@ -667,12 +797,8 @@ export class DraftStore {
|
||||
if (p.id === ids.id) projects[i] = { ...p, id: newId };
|
||||
});
|
||||
candidates.set('projects', projects);
|
||||
renameInTexts((doc) => {
|
||||
const rec = doc.projects[ids.id];
|
||||
if (rec === undefined) return;
|
||||
const rest = { ...doc.projects };
|
||||
delete rest[ids.id];
|
||||
doc.projects = { ...rest, [newId]: rec };
|
||||
withTexts('projects', (doc) => {
|
||||
renameKey(doc, ids.id, newId);
|
||||
});
|
||||
} else if (kind === 'experience') {
|
||||
const experiences = structuredClone(this.dataOf('experience')) as Record<string, any>[];
|
||||
@@ -682,12 +808,8 @@ export class DraftStore {
|
||||
if (e.id === ids.id) experiences[i] = { ...e, id: newId };
|
||||
});
|
||||
candidates.set('experience', experiences);
|
||||
renameInTexts((doc) => {
|
||||
const rec = doc.experience[ids.id];
|
||||
if (rec === undefined) return;
|
||||
const rest = { ...doc.experience };
|
||||
delete rest[ids.id];
|
||||
doc.experience = { ...rest, [newId]: rec };
|
||||
withTexts('experience', (doc) => {
|
||||
renameKey(doc, ids.id, newId);
|
||||
});
|
||||
} else if (kind === 'skill-group') {
|
||||
const groups = structuredClone(this.dataOf('skills')) as Record<string, any>[];
|
||||
@@ -697,12 +819,8 @@ export class DraftStore {
|
||||
if (g.id === ids.id) groups[i] = { ...g, id: newId };
|
||||
});
|
||||
candidates.set('skills', groups);
|
||||
renameInTexts((doc) => {
|
||||
const rec = doc.skills[ids.id];
|
||||
if (rec === undefined) return;
|
||||
const rest = { ...doc.skills };
|
||||
delete rest[ids.id];
|
||||
doc.skills = { ...rest, [newId]: rec };
|
||||
withTexts('skills', (doc) => {
|
||||
renameKey(doc, ids.id, newId);
|
||||
});
|
||||
} else if (kind === 'philosophy') {
|
||||
const profile = structuredClone(this.dataOf('profile')) as Record<string, any>;
|
||||
@@ -713,12 +831,8 @@ export class DraftStore {
|
||||
if (p.id === ids.id) points[i] = { ...p, id: newId };
|
||||
});
|
||||
candidates.set('profile', profile);
|
||||
renameInTexts((doc) => {
|
||||
const rec = doc.profile.philosophy[ids.id];
|
||||
if (rec === undefined) return;
|
||||
const rest = { ...doc.profile.philosophy };
|
||||
delete rest[ids.id];
|
||||
doc.profile.philosophy = { ...rest, [newId]: rec };
|
||||
withTexts('profile', (doc) => {
|
||||
renameKey(doc.philosophy, ids.id, newId);
|
||||
});
|
||||
} else {
|
||||
const projectId = ids.projectId;
|
||||
@@ -733,16 +847,9 @@ export class DraftStore {
|
||||
if (s.id === ids.id) sections[i] = { ...s, id: newId };
|
||||
});
|
||||
candidates.set('projects', projects);
|
||||
renameInTexts((doc) => {
|
||||
const text = doc.projects[projectId];
|
||||
const rec = text?.sections?.[ids.id];
|
||||
if (rec === undefined) return;
|
||||
const rest = { ...text.sections };
|
||||
delete rest[ids.id];
|
||||
doc.projects = {
|
||||
...doc.projects,
|
||||
[projectId]: { ...text, sections: { ...rest, [newId]: rec } },
|
||||
};
|
||||
withTexts('projects', (doc) => {
|
||||
const text = doc[projectId];
|
||||
if (text?.sections) renameKey(text.sections, ids.id, newId);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -935,7 +1042,7 @@ export async function saveDraft(
|
||||
for (const id of store.touched()) {
|
||||
const meta = DRAFT_DOCS.find((d) => d.id === id)!;
|
||||
const paths = store.changedPaths(id);
|
||||
const message = `content: ${paths[0] ?? meta.file} (${paths.length} path${paths.length === 1 ? '' : 's'})`;
|
||||
const message = `content: ${meta.file} (${paths.length} path${paths.length === 1 ? '' : 's'})`;
|
||||
const res = await putDoc(meta.file, store.dataOf(id), message, store.shaOf(id), branch);
|
||||
if (res.ok) {
|
||||
store.markWritten(id, res.sha);
|
||||
|
||||
+94
-10
@@ -5,10 +5,42 @@ import { experiences } from '../data/experience';
|
||||
import { profile } from '../data/profile';
|
||||
import { projects } from '../data/projects';
|
||||
import { skillGroups } from '../data/skills';
|
||||
import contentEnJson from './locales/en/content.json';
|
||||
import contentViJson from './locales/vi/content.json';
|
||||
import uiEnJson from './locales/en/ui.json';
|
||||
import uiViJson from './locales/vi/ui.json';
|
||||
import profileViJson from './locales/vi/content/profile.json';
|
||||
import skillsViJson from './locales/vi/content/skills.json';
|
||||
import experienceViJson from './locales/vi/content/experience.json';
|
||||
import projectsViJson from './locales/vi/content/projects.json';
|
||||
import profileEnJson from './locales/en/content/profile.json';
|
||||
import skillsEnJson from './locales/en/content/skills.json';
|
||||
import experienceEnJson from './locales/en/content/experience.json';
|
||||
import projectsEnJson from './locales/en/content/projects.json';
|
||||
import uiNavViJson from './locales/vi/ui/navigation.json';
|
||||
import uiSocialViJson from './locales/vi/ui/social.json';
|
||||
import uiFooterViJson from './locales/vi/ui/footer.json';
|
||||
import uiHeroViJson from './locales/vi/ui/hero.json';
|
||||
import uiAboutViJson from './locales/vi/ui/about.json';
|
||||
import uiExpertiseViJson from './locales/vi/ui/expertise.json';
|
||||
import uiExperienceViJson from './locales/vi/ui/experience.json';
|
||||
import uiProjectsViJson from './locales/vi/ui/projects.json';
|
||||
import uiContactViJson from './locales/vi/ui/contact.json';
|
||||
import uiProjectDetailViJson from './locales/vi/ui/project-detail.json';
|
||||
import uiPhilosophyViJson from './locales/vi/ui/philosophy.json';
|
||||
import uiCommonViJson from './locales/vi/ui/common.json';
|
||||
import uiResumeViJson from './locales/vi/ui/resume.json';
|
||||
import uiEditViJson from './locales/vi/ui/edit.json';
|
||||
import uiNavEnJson from './locales/en/ui/navigation.json';
|
||||
import uiSocialEnJson from './locales/en/ui/social.json';
|
||||
import uiFooterEnJson from './locales/en/ui/footer.json';
|
||||
import uiHeroEnJson from './locales/en/ui/hero.json';
|
||||
import uiAboutEnJson from './locales/en/ui/about.json';
|
||||
import uiExpertiseEnJson from './locales/en/ui/expertise.json';
|
||||
import uiExperienceEnJson from './locales/en/ui/experience.json';
|
||||
import uiProjectsEnJson from './locales/en/ui/projects.json';
|
||||
import uiContactEnJson from './locales/en/ui/contact.json';
|
||||
import uiProjectDetailEnJson from './locales/en/ui/project-detail.json';
|
||||
import uiPhilosophyEnJson from './locales/en/ui/philosophy.json';
|
||||
import uiCommonEnJson from './locales/en/ui/common.json';
|
||||
import uiResumeEnJson from './locales/en/ui/resume.json';
|
||||
import uiEditEnJson from './locales/en/ui/edit.json';
|
||||
import type {
|
||||
ContentEn,
|
||||
ContentVi,
|
||||
@@ -25,15 +57,61 @@ import type {
|
||||
UIDict,
|
||||
} from './dict-types';
|
||||
import type { Language, PhilosophyId } from '../types/index';
|
||||
import { validateContent } from './validate';
|
||||
import { validateContent, validateManifests } from './validate';
|
||||
import type { ContentStructures } from './validate';
|
||||
|
||||
const uiVi: UIDict = uiViJson;
|
||||
// tsc enforces en completeness against the derived Vietnamese tree (§3.3).
|
||||
const uiEn: UIDict = uiEnJson;
|
||||
// The per-entity text files merge back into the same ContentVi/ContentEn
|
||||
// records every consumer reads (spec-v4-data-organization §3); key order is
|
||||
// the record shape, unchanged from the single-file layout. Each file is
|
||||
// checked against its slice type by these annotations.
|
||||
const contentVi: ContentVi = {
|
||||
profile: profileViJson,
|
||||
skills: skillsViJson,
|
||||
experience: experienceViJson,
|
||||
projects: projectsViJson,
|
||||
};
|
||||
const contentEn: ContentEn = {
|
||||
profile: profileEnJson,
|
||||
skills: skillsEnJson,
|
||||
experience: experienceEnJson,
|
||||
projects: projectsEnJson,
|
||||
};
|
||||
|
||||
const contentVi: ContentVi = contentViJson;
|
||||
const contentEn: ContentEn = contentEnJson;
|
||||
// Feature-group UI files merge into the same UIDict record (§4); the key
|
||||
// order matches the old ui.json namespaces exactly.
|
||||
const uiVi: UIDict = {
|
||||
nav: uiNavViJson,
|
||||
social: uiSocialViJson,
|
||||
footer: uiFooterViJson,
|
||||
hero: uiHeroViJson,
|
||||
about: uiAboutViJson,
|
||||
expertise: uiExpertiseViJson,
|
||||
experience: uiExperienceViJson,
|
||||
projects: uiProjectsViJson,
|
||||
contact: uiContactViJson,
|
||||
projectDetail: uiProjectDetailViJson,
|
||||
philosophy: uiPhilosophyViJson,
|
||||
common: uiCommonViJson,
|
||||
resume: uiResumeViJson,
|
||||
edit: uiEditViJson,
|
||||
};
|
||||
// tsc enforces en completeness against the Vietnamese tree (§3.3).
|
||||
const uiEn: UIDict = {
|
||||
nav: uiNavEnJson,
|
||||
social: uiSocialEnJson,
|
||||
footer: uiFooterEnJson,
|
||||
hero: uiHeroEnJson,
|
||||
about: uiAboutEnJson,
|
||||
expertise: uiExpertiseEnJson,
|
||||
experience: uiExperienceEnJson,
|
||||
projects: uiProjectsEnJson,
|
||||
contact: uiContactEnJson,
|
||||
projectDetail: uiProjectDetailEnJson,
|
||||
philosophy: uiPhilosophyEnJson,
|
||||
common: uiCommonEnJson,
|
||||
resume: uiResumeEnJson,
|
||||
edit: uiEditEnJson,
|
||||
};
|
||||
|
||||
const structures = {
|
||||
profile,
|
||||
@@ -149,3 +227,9 @@ export const CONTENT: Record<Language, ResolvedContent> = resolveContent(
|
||||
contentVi,
|
||||
contentEn,
|
||||
);
|
||||
|
||||
// The manifest rules (spec-v4-data-organization §5.1) run at the same point
|
||||
// as the content rules: a manifest that claims a field no page renders, or
|
||||
// a text field no manifest claims, fails the build — not a silent hole in
|
||||
// EditBar's provenance.
|
||||
validateManifests(structures, contentVi, contentEn, Object.keys(uiVi));
|
||||
@@ -1,143 +0,0 @@
|
||||
{
|
||||
"profile": {
|
||||
"name": "Dong Nguyen",
|
||||
"bio": "Senior Software Engineer with experience building distributed systems, logistics technology, and AI/ML applications for real-world problems. Focused on system architecture, integration, and production-grade solutions.",
|
||||
"subtitle": "Senior Software Engineer with deep expertise in distributed systems, logistics technology, and practical AI applications.",
|
||||
"tldr": "15 years of experience, more than 8 companies along the way. Too long to tell.",
|
||||
"tagline": [
|
||||
{
|
||||
"text": "Building scalable software systems, intelligent logistics solutions, and practical AI applications."
|
||||
}
|
||||
],
|
||||
"philosophyQuotes": [
|
||||
{
|
||||
"title": "Time is priceless",
|
||||
"details": [
|
||||
"Time is priceless. You can’t buy it, pause it, or rewind it. Once it’s gone, it’s gone for good.",
|
||||
"We spend so much of our lives chasing things—money, status, validation—but time is the one thing we can never earn back.",
|
||||
"So be mindful of how you use it. Invest it in what truly matters: the people you love, the goals that inspire you, the moments that feed your soul."
|
||||
]
|
||||
}
|
||||
],
|
||||
"philosophy": {
|
||||
"build-for-the-real-problem": {
|
||||
"title": "Build for the real problem",
|
||||
"description": "Don't start with technology. Start with the problem."
|
||||
},
|
||||
"think-in-systems": {
|
||||
"description": "Care about the overall architecture, not just individual components."
|
||||
},
|
||||
"measure-impact": {
|
||||
"description": "Technical implementation must be tied to measurable outcomes."
|
||||
},
|
||||
"business-domain-knowledge-is-a-key-of-success": {
|
||||
"title": "Business domain knowledge is a key of success",
|
||||
"description": "Don't start with technology. Start with the problem."
|
||||
}
|
||||
}
|
||||
},
|
||||
"experience": {
|
||||
"open-to-work": {
|
||||
"title": "Seeking a New Place",
|
||||
"company": "Open to new opportunities",
|
||||
"duration": "Nov 2026 – Present",
|
||||
"responsibilities": [
|
||||
"Open to Senior Engineer roles: system architecture, integration platforms, full-stack delivery"
|
||||
]
|
||||
},
|
||||
"relax-gap": {
|
||||
"title": "Relax",
|
||||
"company": "Career break",
|
||||
"duration": "Aug 2026 – Oct 2026",
|
||||
"responsibilities": [
|
||||
"Intentional break between roles — recovering the rhythm before the next system"
|
||||
]
|
||||
},
|
||||
"lazada-senior-swe": {
|
||||
"duration": "Jan 2020 – Aug 2026",
|
||||
"responsibilities": [
|
||||
"System ownership and architecture design for logistics integration systems",
|
||||
"Developed IoT-DWS integration solution deployed across 16 sortations",
|
||||
"Led system maintenance and modernization for production environments",
|
||||
"Applied Computer Vision and ML to solve real-world operational problems",
|
||||
"Scrum Master responsibilities — team achieved Scrum Level L3"
|
||||
]
|
||||
},
|
||||
"nexts-founder": {
|
||||
"title": "CTO & Founder",
|
||||
"responsibilities": [
|
||||
"Developed a solution for autonomous vehicles to collect real-time data from onboard sensors and systems, including LiDAR, cameras, GPS, and CAN bus."
|
||||
]
|
||||
},
|
||||
"sap-senior-swe": {
|
||||
"responsibilities": [
|
||||
"Team leader managing the B1 Integration product"
|
||||
]
|
||||
}
|
||||
},
|
||||
"projects": {
|
||||
"iot-dws-integration": {
|
||||
"title": "IoT-DWS Integration System",
|
||||
"summary": "Designed and deployed an integration system between IoT devices and DWS (Dimensioning Weighing Scanning) machines across 16 sortations.",
|
||||
"metrics": [
|
||||
"16 sortations deployed"
|
||||
],
|
||||
"sections": {
|
||||
"context": {
|
||||
"content": "Took over and rapidly mastered an IoT-DWS system after the previous responsible team member left the project. Needed to quickly understand the current architecture and continue developing the integration solution."
|
||||
},
|
||||
"problem": {
|
||||
"content": "Needed integration between IoT devices (sensors, cameras) and DWS machines — a complex physical system with multiple different protocols (HMI, FTP, HTTP)."
|
||||
},
|
||||
"solution": {
|
||||
"content": "Designed an HTTP-based integration engine with HMAC security, RocketMQ messaging, and protocol adapters for HMI/FTP/HTTP."
|
||||
},
|
||||
"challenges": {
|
||||
"content": "Multiple different protocols, security requirements (HMAC signature), real-time data processing, production reliability."
|
||||
},
|
||||
"result": {
|
||||
"content": "Solution deployed across 16 sortations, stable in production, supporting 3 protocols (HMI, FTP, HTTP)."
|
||||
}
|
||||
}
|
||||
},
|
||||
"awb-detection": {
|
||||
"summary": "Applied Computer Vision and Machine Learning to automatically detect and OCR shipping labels from camera images on sortation lines.",
|
||||
"metrics": [
|
||||
"70,000 images/month processed"
|
||||
],
|
||||
"sections": {
|
||||
"context": {
|
||||
"content": "Sortation machines capture images of packages as they move on conveyor belts. Need to automatically read AWB (Air Waybill) from images for tracking and sorting."
|
||||
},
|
||||
"problem": {
|
||||
"content": "White label on white package — traditional CV methods are not robust enough. Needed ML-based detection."
|
||||
},
|
||||
"result": {
|
||||
"content": "Model fine-tuned for AWB detection, processing 70,000 images/month. Presented at Tech Talk workshop."
|
||||
}
|
||||
}
|
||||
},
|
||||
"facility-management": {
|
||||
"summary": "Built a digital twin platform for logistics facilities — facility modeling, real-time monitoring, and recommendation system.",
|
||||
"sections": {
|
||||
"vision": {
|
||||
"content": "Transition from manual operations to an Operation Intelligence Platform — collect data, monitor, analyze, recommend, decide."
|
||||
},
|
||||
"result": {
|
||||
"content": "Platform supports facility modeling, real-time visibility, and recommendations for capacity planning."
|
||||
}
|
||||
}
|
||||
},
|
||||
"local-llm-experiments": {
|
||||
"summary": "Technical exploration of running local MoE LLMs with llama.cpp — GPU offloading, VRAM optimization, performance tracing.",
|
||||
"sections": {
|
||||
"exploration": {
|
||||
"content": "Technical exploration of MoE (Mixture of Experts), expert routing, GPU offloading, VRAM optimization, prefill/decode pipeline."
|
||||
},
|
||||
"learnings": {
|
||||
"content": "Understand the system → Measure → Analyze → Optimize. Not about showing off hardware — but demonstrating engineering approach."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"open-to-work": {
|
||||
"title": "Seeking a New Place",
|
||||
"company": "Open to new opportunities",
|
||||
"duration": "Nov 2026 – Present",
|
||||
"responsibilities": [
|
||||
"Open to Senior Engineer roles: system architecture, integration platforms, full-stack delivery"
|
||||
]
|
||||
},
|
||||
"relax-gap": {
|
||||
"title": "Relax",
|
||||
"company": "Career break",
|
||||
"duration": "Aug 2026 – Oct 2026",
|
||||
"responsibilities": [
|
||||
"Intentional break between roles — recovering the rhythm before the next system"
|
||||
]
|
||||
},
|
||||
"lazada-senior-swe": {
|
||||
"duration": "Jan 2020 – Aug 2026",
|
||||
"responsibilities": [
|
||||
"System ownership and architecture design for logistics integration systems",
|
||||
"Developed IoT-DWS integration solution deployed across 16 sortations",
|
||||
"Led system maintenance and modernization for production environments",
|
||||
"Applied Computer Vision and ML to solve real-world operational problems",
|
||||
"Scrum Master responsibilities — team achieved Scrum Level L3"
|
||||
]
|
||||
},
|
||||
"nexts-founder": {
|
||||
"title": "CTO & Founder",
|
||||
"responsibilities": [
|
||||
"Developed a solution for autonomous vehicles to collect real-time data from onboard sensors and systems, including LiDAR, cameras, GPS, and CAN bus."
|
||||
]
|
||||
},
|
||||
"sap-senior-swe": {
|
||||
"responsibilities": [
|
||||
"Team leader managing the B1 Integration product"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
{
|
||||
"name": "Dong Nguyen",
|
||||
"bio": "Senior Software Engineer with experience building distributed systems, logistics technology, and AI/ML applications for real-world problems. Focused on system architecture, integration, and production-grade solutions.",
|
||||
"subtitle": "Senior Software Engineer with deep expertise in distributed systems, logistics technology, and practical AI applications.",
|
||||
"tldr": "15 years of experience, more than 8 companies along the way. Too long to tell.",
|
||||
"tagline": [
|
||||
{
|
||||
"text": "Building scalable software systems, intelligent logistics solutions, and practical AI applications."
|
||||
}
|
||||
],
|
||||
"philosophyQuotes": [
|
||||
{
|
||||
"title": "Time is priceless",
|
||||
"details": [
|
||||
"Time is priceless. You can’t buy it, pause it, or rewind it. Once it’s gone, it’s gone for good.",
|
||||
"We spend so much of our lives chasing things—money, status, validation—but time is the one thing we can never earn back.",
|
||||
"So be mindful of how you use it. Invest it in what truly matters: the people you love, the goals that inspire you, the moments that feed your soul."
|
||||
]
|
||||
}
|
||||
],
|
||||
"philosophy": {
|
||||
"build-for-the-real-problem": {
|
||||
"title": "Build for the real problem",
|
||||
"description": "Don't start with technology. Start with the problem."
|
||||
},
|
||||
"think-in-systems": {
|
||||
"description": "Care about the overall architecture, not just individual components."
|
||||
},
|
||||
"measure-impact": {
|
||||
"description": "Technical implementation must be tied to measurable outcomes."
|
||||
},
|
||||
"business-domain-knowledge-is-a-key-of-success": {
|
||||
"title": "Business domain knowledge is a key of success",
|
||||
"description": "Don't start with technology. Start with the problem."
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
{
|
||||
"iot-dws-integration": {
|
||||
"title": "IoT-DWS Integration System",
|
||||
"summary": "Designed and deployed an integration system between IoT devices and DWS (Dimensioning Weighing Scanning) machines across 16 sortations.",
|
||||
"metrics": [
|
||||
"16 sortations deployed"
|
||||
],
|
||||
"sections": {
|
||||
"context": {
|
||||
"content": "Took over and rapidly mastered an IoT-DWS system after the previous responsible team member left the project. Needed to quickly understand the current architecture and continue developing the integration solution."
|
||||
},
|
||||
"problem": {
|
||||
"content": "Needed integration between IoT devices (sensors, cameras) and DWS machines — a complex physical system with multiple different protocols (HMI, FTP, HTTP)."
|
||||
},
|
||||
"solution": {
|
||||
"content": "Designed an HTTP-based integration engine with HMAC security, RocketMQ messaging, and protocol adapters for HMI/FTP/HTTP."
|
||||
},
|
||||
"challenges": {
|
||||
"content": "Multiple different protocols, security requirements (HMAC signature), real-time data processing, production reliability."
|
||||
},
|
||||
"result": {
|
||||
"content": "Solution deployed across 16 sortations, stable in production, supporting 3 protocols (HMI, FTP, HTTP)."
|
||||
}
|
||||
}
|
||||
},
|
||||
"awb-detection": {
|
||||
"summary": "Applied Computer Vision and Machine Learning to automatically detect and OCR shipping labels from camera images on sortation lines.",
|
||||
"metrics": [
|
||||
"70,000 images/month processed"
|
||||
],
|
||||
"sections": {
|
||||
"context": {
|
||||
"content": "Sortation machines capture images of packages as they move on conveyor belts. Need to automatically read AWB (Air Waybill) from images for tracking and sorting."
|
||||
},
|
||||
"problem": {
|
||||
"content": "White label on white package — traditional CV methods are not robust enough. Needed ML-based detection."
|
||||
},
|
||||
"result": {
|
||||
"content": "Model fine-tuned for AWB detection, processing 70,000 images/month. Presented at Tech Talk workshop."
|
||||
}
|
||||
}
|
||||
},
|
||||
"facility-management": {
|
||||
"summary": "Built a digital twin platform for logistics facilities — facility modeling, real-time monitoring, and recommendation system.",
|
||||
"sections": {
|
||||
"vision": {
|
||||
"content": "Transition from manual operations to an Operation Intelligence Platform — collect data, monitor, analyze, recommend, decide."
|
||||
},
|
||||
"result": {
|
||||
"content": "Platform supports facility modeling, real-time visibility, and recommendations for capacity planning."
|
||||
}
|
||||
}
|
||||
},
|
||||
"local-llm-experiments": {
|
||||
"summary": "Technical exploration of running local MoE LLMs with llama.cpp — GPU offloading, VRAM optimization, performance tracing.",
|
||||
"sections": {
|
||||
"exploration": {
|
||||
"content": "Technical exploration of MoE (Mixture of Experts), expert routing, GPU offloading, VRAM optimization, prefill/decode pipeline."
|
||||
},
|
||||
"learnings": {
|
||||
"content": "Understand the system → Measure → Analyze → Optimize. Not about showing off hardware — but demonstrating engineering approach."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{}
|
||||
@@ -1,235 +0,0 @@
|
||||
{
|
||||
"nav": {
|
||||
"home": "Home",
|
||||
"resume": "Get resume",
|
||||
"about": "About",
|
||||
"experience": "Experience",
|
||||
"projects": "Projects",
|
||||
"philosophy": "Philosophy",
|
||||
"contact": "Contact",
|
||||
"palette": "Theme",
|
||||
"paletteAria": "Switch theme color",
|
||||
"menuAria": "Site menu",
|
||||
"openMenu": "Open menu",
|
||||
"closeMenu": "Close menu",
|
||||
"groupMenu": "Menu",
|
||||
"groupAppearance": "Appearance",
|
||||
"themeGroup": "Mode",
|
||||
"themeDark": "Dark",
|
||||
"themeLight": "Light",
|
||||
"langGroup": "Language",
|
||||
"langEn": "English",
|
||||
"langVi": "Tiếng Việt",
|
||||
"langSwitch": "Switch language",
|
||||
"switchTo": "Switch to",
|
||||
"mainNav": "Main navigation",
|
||||
"themeSwitch": "Switch display mode",
|
||||
"themeMode": "Display mode"
|
||||
},
|
||||
"social": {
|
||||
"heading": "Connect",
|
||||
"aria": {
|
||||
"github": "View GitHub profile",
|
||||
"linkedin": "View LinkedIn profile",
|
||||
"email": "Send email",
|
||||
"telegram": "Open Telegram chat"
|
||||
}
|
||||
},
|
||||
"footer": {
|
||||
"copyright": "All rights reserved",
|
||||
"links": {
|
||||
"home": "Home",
|
||||
"about": "About",
|
||||
"projects": "Projects",
|
||||
"contact": "Contact"
|
||||
}
|
||||
},
|
||||
"hero": {
|
||||
"greeting": "Hi, I'm",
|
||||
"ctaProjects": "View Projects",
|
||||
"ctaContact": "Contact Me",
|
||||
"scroll": "Scroll"
|
||||
},
|
||||
"about": {
|
||||
"heading": "About Me",
|
||||
"engineeringTitle": "How I Think About Engineering",
|
||||
"exploringTitle": "What I'm Exploring",
|
||||
"exploringTitlePage": "What I'm Currently Exploring",
|
||||
"expertise": "Core Expertise"
|
||||
},
|
||||
"expertise": {
|
||||
"heading": "Core Expertise"
|
||||
},
|
||||
"experience": {
|
||||
"heading": "Experience",
|
||||
"tldr": "TL;DR"
|
||||
},
|
||||
"projects": {
|
||||
"featured": "Featured Projects",
|
||||
"all": "Projects",
|
||||
"viewAll": "View All",
|
||||
"viewDetails": "View Details",
|
||||
"categories": {
|
||||
"software-engineering": "Software Engineering",
|
||||
"logistics": "Logistics",
|
||||
"ai-ml": "AI / ML",
|
||||
"computer-vision": "Computer Vision",
|
||||
"architecture": "Architecture",
|
||||
"experiment": "Experiment"
|
||||
}
|
||||
},
|
||||
"contact": {
|
||||
"heading": "Contact",
|
||||
"email": "Email",
|
||||
"github": "GitHub",
|
||||
"linkedin": "LinkedIn",
|
||||
"telegram": "Telegram"
|
||||
},
|
||||
"projectDetail": {
|
||||
"notFound": "Project Not Found",
|
||||
"backToProjects": "Back to Projects",
|
||||
"impact": "Impact",
|
||||
"role": "Role",
|
||||
"technologies": "Technologies",
|
||||
"experiments": "Engineering Experiments"
|
||||
},
|
||||
"philosophy": {
|
||||
"heading": "Philosophy"
|
||||
},
|
||||
"common": {
|
||||
"resumeDownload": "Get Resume",
|
||||
"resumeModalTitle": "Get Resume",
|
||||
"resumeModalAria": "Choose resume language",
|
||||
"resumeModalHint": "Choose a language — the PDF downloads to your device.",
|
||||
"resumeModalClose": "Close resume options",
|
||||
"backToTop": "Scroll to top",
|
||||
"contactTag": "Contact",
|
||||
"experienceTag": "Experience"
|
||||
},
|
||||
"resume": {
|
||||
"EXPERIENCE": "Experience",
|
||||
"SKILLS": "Skills",
|
||||
"PROJECTS": "Projects",
|
||||
"UPDATED": "Last updated",
|
||||
"QR_ALT": "QR code"
|
||||
},
|
||||
"edit": {
|
||||
"editField": "Edit this field",
|
||||
"copyPath": "Copy JSON path",
|
||||
"pathCopied": "Copied",
|
||||
"emptyRequired": "Required fields cannot be empty",
|
||||
"settings": "Record settings",
|
||||
"closeSettings": "Close settings",
|
||||
"moveUp": "Move up",
|
||||
"moveDown": "Move down",
|
||||
"remove": "Remove",
|
||||
"removeConfirm": "Remove this item?",
|
||||
"newTag": "new",
|
||||
"emphasis": "Emphasis",
|
||||
"featured": "Featured on the home page",
|
||||
"sections": "Sections",
|
||||
"sectionType": "Section type",
|
||||
"sectionTypes": {
|
||||
"text": "prose",
|
||||
"diagram": "diagram",
|
||||
"metrics": "metrics",
|
||||
"code": "code"
|
||||
},
|
||||
"conflictFields": "Show conflicting fields",
|
||||
"yours": "mine:",
|
||||
"theirs": "theirs:",
|
||||
"keepMine": "Keep mine",
|
||||
"keepTheirs": "Keep theirs",
|
||||
"variant": "Timeline variant",
|
||||
"variantNone": "normal",
|
||||
"variantCurrent": "current role",
|
||||
"variantGap": "career break",
|
||||
"addTaglineSegment": "Add tagline segment",
|
||||
"addKeyword": "Add keyword",
|
||||
"addInterest": "Add interest",
|
||||
"addSkill": "Add skill",
|
||||
"addTechnology": "Add technology",
|
||||
"addMetric": "Add metric",
|
||||
"addResponsibility": "Add responsibility",
|
||||
"addQuoteDetail": "Add quote paragraph",
|
||||
"addQuote": "Add quote",
|
||||
"addProject": "Add project",
|
||||
"addSection": "Add section",
|
||||
"addExperience": "Add experience",
|
||||
"addSkillGroup": "Add skill group",
|
||||
"addPhilosophy": "Add philosophy point",
|
||||
"title": "Edit mode",
|
||||
"changes": "Unsaved changes",
|
||||
"noChanges": "No unsaved changes",
|
||||
"openPanel": "JSON panel",
|
||||
"closePanel": "Close panel",
|
||||
"save": "Save",
|
||||
"saving": "Saving…",
|
||||
"resume": "Resume save",
|
||||
"exit": "Exit",
|
||||
"exitConfirm": "Discard unsaved changes?",
|
||||
"changesTitle": "Changes",
|
||||
"discardDoc": "Discard document",
|
||||
"revert": "Revert",
|
||||
"conflicts": "Conflicts",
|
||||
"conflictDetail": "changed externally after this draft was taken",
|
||||
"rebase": "Rebase",
|
||||
"takeTheirs": "Take theirs",
|
||||
"handMerge": "Hand-merge",
|
||||
"written": "written",
|
||||
"conflictStatus": "conflict",
|
||||
"failed": "failed",
|
||||
"deployQueued": "deploy queued — the change goes live after the pipeline finishes",
|
||||
"branchLabel": "target branch",
|
||||
"mergeHint": "written to the branch — merge into master to deploy",
|
||||
"offline": "offline — showing bundled content, save disabled",
|
||||
"draftRestored": "draft restored from this session",
|
||||
"unionNote": "new ids are also appended to src/types/index.ts",
|
||||
"unionFailed": "could not update src/types/index.ts — finish that edit in Gitea",
|
||||
"panel": {
|
||||
"title": "Content documents",
|
||||
"readOnly": "read-only",
|
||||
"valid": "valid",
|
||||
"invalid": "invalid",
|
||||
"parseError": "JSON error",
|
||||
"addProject": "Add project",
|
||||
"addExperience": "Add experience",
|
||||
"addSkillGroup": "Add skill group",
|
||||
"addPhilosophy": "Add philosophy point",
|
||||
"addSection": "Add section",
|
||||
"projectLabel": "project",
|
||||
"deleteRecord": "Delete",
|
||||
"deleteConfirm": "Delete this record and its text in both languages?",
|
||||
"baseLabel": "live master",
|
||||
"draftLabel": "draft",
|
||||
"applyMerge": "Apply merged draft"
|
||||
},
|
||||
"fields": {
|
||||
"title": "title",
|
||||
"summary": "summary",
|
||||
"bio": "bio",
|
||||
"subtitle": "about subtitle",
|
||||
"tldr": "career TL;DR",
|
||||
"tagline": "tagline segment",
|
||||
"groupTitle": "skill group title",
|
||||
"expTitle": "role title",
|
||||
"responsibility": "responsibility",
|
||||
"sectionTitle": "section title",
|
||||
"sectionContent": "section content",
|
||||
"pointTitle": "philosophy title",
|
||||
"pointDescription": "philosophy description",
|
||||
"quoteTitle": "quote title",
|
||||
"quoteDetail": "quote paragraph",
|
||||
"company": "company",
|
||||
"duration": "duration",
|
||||
"projectRole": "project role",
|
||||
"interests": "interest",
|
||||
"skill": "skill",
|
||||
"technology": "technology",
|
||||
"metric": "metric",
|
||||
"pointKeywords": "philosophy keyword",
|
||||
"location": "location",
|
||||
"logo": "logo"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"heading": "About Me",
|
||||
"engineeringTitle": "How I Think About Engineering",
|
||||
"exploringTitle": "What I'm Exploring",
|
||||
"exploringTitlePage": "What I'm Currently Exploring",
|
||||
"expertise": "Core Expertise"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"resumeDownload": "Get Resume",
|
||||
"resumeModalTitle": "Get Resume",
|
||||
"resumeModalAria": "Choose resume language",
|
||||
"resumeModalHint": "Choose a language — the PDF downloads to your device.",
|
||||
"resumeModalClose": "Close resume options",
|
||||
"backToTop": "Scroll to top",
|
||||
"contactTag": "Contact",
|
||||
"experienceTag": "Experience"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"heading": "Contact",
|
||||
"email": "Email",
|
||||
"github": "GitHub",
|
||||
"linkedin": "LinkedIn",
|
||||
"telegram": "Telegram"
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
{
|
||||
"editField": "Edit this field",
|
||||
"copyPath": "Copy JSON path",
|
||||
"pathCopied": "Copied",
|
||||
"emptyRequired": "Required fields cannot be empty",
|
||||
"settings": "Record settings",
|
||||
"closeSettings": "Close settings",
|
||||
"moveUp": "Move up",
|
||||
"moveDown": "Move down",
|
||||
"remove": "Remove",
|
||||
"removeConfirm": "Remove this item?",
|
||||
"newTag": "new",
|
||||
"emphasis": "Emphasis",
|
||||
"featured": "Featured on the home page",
|
||||
"sections": "Sections",
|
||||
"sectionType": "Section type",
|
||||
"sectionTypes": {
|
||||
"text": "prose",
|
||||
"diagram": "diagram",
|
||||
"metrics": "metrics",
|
||||
"code": "code"
|
||||
},
|
||||
"conflictFields": "Show conflicting fields",
|
||||
"yours": "mine:",
|
||||
"theirs": "theirs:",
|
||||
"keepMine": "Keep mine",
|
||||
"keepTheirs": "Keep theirs",
|
||||
"variant": "Timeline variant",
|
||||
"variantNone": "normal",
|
||||
"variantCurrent": "current role",
|
||||
"variantGap": "career break",
|
||||
"addTaglineSegment": "Add tagline segment",
|
||||
"addKeyword": "Add keyword",
|
||||
"addInterest": "Add interest",
|
||||
"addSkill": "Add skill",
|
||||
"addTechnology": "Add technology",
|
||||
"addMetric": "Add metric",
|
||||
"addResponsibility": "Add responsibility",
|
||||
"addQuoteDetail": "Add quote paragraph",
|
||||
"addQuote": "Add quote",
|
||||
"addProject": "Add project",
|
||||
"addSection": "Add section",
|
||||
"addExperience": "Add experience",
|
||||
"addSkillGroup": "Add skill group",
|
||||
"addPhilosophy": "Add philosophy point",
|
||||
"title": "Edit mode",
|
||||
"changes": "Unsaved changes",
|
||||
"noChanges": "No unsaved changes",
|
||||
"save": "Save",
|
||||
"saving": "Saving…",
|
||||
"resume": "Resume save",
|
||||
"exit": "Exit",
|
||||
"exitConfirm": "Discard unsaved changes?",
|
||||
"changesTitle": "Changes",
|
||||
"discardDoc": "Discard document",
|
||||
"revert": "Revert",
|
||||
"conflicts": "Conflicts",
|
||||
"conflictDetail": "changed externally after this draft was taken",
|
||||
"rebase": "Rebase",
|
||||
"takeTheirs": "Take theirs",
|
||||
"written": "written",
|
||||
"conflictStatus": "conflict",
|
||||
"failed": "failed",
|
||||
"deployQueued": "deploy queued — the change goes live after the pipeline finishes",
|
||||
"branchLabel": "target branch",
|
||||
"mergeHint": "written to the branch — merge into master to deploy",
|
||||
"offline": "offline — showing bundled content, save disabled",
|
||||
"draftRestored": "draft restored from this session",
|
||||
"unionNote": "new ids are also appended to src/types/index.ts",
|
||||
"unionFailed": "could not update src/types/index.ts — finish that edit in Gitea",
|
||||
"appearsHome": "home",
|
||||
"appearsResume": "resume PDF",
|
||||
"appearsOn": "appears on",
|
||||
"fields": {
|
||||
"title": "title",
|
||||
"summary": "summary",
|
||||
"bio": "bio",
|
||||
"subtitle": "about subtitle",
|
||||
"tldr": "career TL;DR",
|
||||
"tagline": "tagline segment",
|
||||
"groupTitle": "skill group title",
|
||||
"expTitle": "role title",
|
||||
"responsibility": "responsibility",
|
||||
"sectionTitle": "section title",
|
||||
"sectionContent": "section content",
|
||||
"pointTitle": "philosophy title",
|
||||
"pointDescription": "philosophy description",
|
||||
"quoteTitle": "quote title",
|
||||
"quoteDetail": "quote paragraph",
|
||||
"company": "company",
|
||||
"duration": "duration",
|
||||
"projectRole": "project role",
|
||||
"interests": "interest",
|
||||
"skill": "skill",
|
||||
"technology": "technology",
|
||||
"metric": "metric",
|
||||
"pointKeywords": "philosophy keyword",
|
||||
"location": "location",
|
||||
"logo": "logo",
|
||||
"email": "email address",
|
||||
"githubHandle": "GitHub handle",
|
||||
"linkedinHandle": "LinkedIn handle",
|
||||
"telegramHandle": "Telegram handle"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"heading": "Experience",
|
||||
"tldr": "TL;DR"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"heading": "Core Expertise"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"copyright": "All rights reserved",
|
||||
"links": {
|
||||
"home": "Home",
|
||||
"about": "About",
|
||||
"projects": "Projects",
|
||||
"contact": "Contact"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"greeting": "Hi, I'm",
|
||||
"ctaProjects": "View Projects",
|
||||
"ctaContact": "Contact Me",
|
||||
"scroll": "Scroll"
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"home": "Home",
|
||||
"resume": "Get resume",
|
||||
"about": "About",
|
||||
"experience": "Experience",
|
||||
"projects": "Projects",
|
||||
"philosophy": "Philosophy",
|
||||
"contact": "Contact",
|
||||
"palette": "Theme",
|
||||
"paletteAria": "Switch theme color",
|
||||
"menuAria": "Site menu",
|
||||
"openMenu": "Open menu",
|
||||
"closeMenu": "Close menu",
|
||||
"groupMenu": "Menu",
|
||||
"groupAppearance": "Appearance",
|
||||
"themeGroup": "Mode",
|
||||
"themeDark": "Dark",
|
||||
"themeLight": "Light",
|
||||
"langGroup": "Language",
|
||||
"langEn": "English",
|
||||
"langVi": "Tiếng Việt",
|
||||
"langSwitch": "Switch language",
|
||||
"switchTo": "Switch to",
|
||||
"mainNav": "Main navigation",
|
||||
"themeSwitch": "Switch display mode",
|
||||
"themeMode": "Display mode"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"heading": "Philosophy"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"notFound": "Project Not Found",
|
||||
"backToProjects": "Back to Projects",
|
||||
"impact": "Impact",
|
||||
"role": "Role",
|
||||
"technologies": "Technologies",
|
||||
"experiments": "Engineering Experiments"
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"featured": "Featured Projects",
|
||||
"all": "Projects",
|
||||
"viewAll": "View All",
|
||||
"viewDetails": "View Details",
|
||||
"categories": {
|
||||
"software-engineering": "Software Engineering",
|
||||
"logistics": "Logistics",
|
||||
"ai-ml": "AI / ML",
|
||||
"computer-vision": "Computer Vision",
|
||||
"architecture": "Architecture",
|
||||
"experiment": "Experiment"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"EXPERIENCE": "Experience",
|
||||
"SKILLS": "Skills",
|
||||
"PROJECTS": "Projects",
|
||||
"UPDATED": "Last updated",
|
||||
"QR_ALT": "QR code"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"heading": "Connect",
|
||||
"aria": {
|
||||
"github": "View GitHub profile",
|
||||
"linkedin": "View LinkedIn profile",
|
||||
"email": "Send email",
|
||||
"telegram": "Open Telegram chat"
|
||||
}
|
||||
}
|
||||
@@ -1,261 +0,0 @@
|
||||
{
|
||||
"profile": {
|
||||
"name": "Nguyễn Đông",
|
||||
"title": "Senior Software Engineer",
|
||||
"bio": "Senior Software Engineer với kinh nghiệm xây dựng hệ thống phân tán, logistics technology, và ứng dụng AI/ML vào bài toán thực tế. Tập trung vào system architecture, integration, và production-grade solutions.",
|
||||
"subtitle": "Kỹ sư phần mềm cao cấp với chuyên môn sâu về hệ thống phân tán, công nghệ logistics và ứng dụng AI thực tiễn.",
|
||||
"tldr": "15 năm kinh nghiệm, hơn 8 công ty đã đi qua. Quá dài để kể hết.",
|
||||
"tagline": [
|
||||
{
|
||||
"text": "Phần lớn thời gian tôi là Backend Software Engineer. Muốn tôi là Full Stack Developer, "
|
||||
},
|
||||
{
|
||||
"text": "yes",
|
||||
"emphasis": true
|
||||
},
|
||||
{
|
||||
"text": ", có thể."
|
||||
}
|
||||
],
|
||||
"currentInterests": [
|
||||
"AI in logistics",
|
||||
"Simulation",
|
||||
"Digital twins",
|
||||
"LLM",
|
||||
"High-performance systems",
|
||||
"Computer Vision"
|
||||
],
|
||||
"roles": [
|
||||
"System Architect",
|
||||
"Full-Stack Developer",
|
||||
"System Engineer",
|
||||
"AI/ML Application Engineer"
|
||||
],
|
||||
"philosophyQuotes": [
|
||||
{
|
||||
"title": "Thời gian là vô giá",
|
||||
"details": [
|
||||
"Thời gian là vô giá. Bạn không thể mua nó bằng tiền, không thể khiến nó dừng lại, cũng chẳng thể quay ngược về quá khứ. Một khi thời gian đã trôi qua, nó sẽ mãi mãi không trở lại.",
|
||||
"Chúng ta dành quá nhiều thời gian trong cuộc đời để theo đuổi những thứ như tiền bạc, địa vị và sự công nhận từ người khác. Nhưng thời gian là thứ duy nhất mà chúng ta không bao giờ có thể lấy lại.",
|
||||
"Vì vậy, hãy luôn ý thức về cách bạn sử dụng thời gian của mình. Hãy dành thời gian cho những điều thực sự quan trọng: những người bạn yêu thương, những mục tiêu truyền cảm hứng cho bạn và những khoảnh khắc nuôi dưỡng tâm hồn bạn."
|
||||
]
|
||||
}
|
||||
],
|
||||
"philosophy": {
|
||||
"build-for-the-real-problem": {
|
||||
"title": "Giải pháp được xây dựng dựa trên vấn đề thực tế",
|
||||
"description": "Không bắt đầu bằng technology. Bắt đầu bằng problem.",
|
||||
"keywords": [
|
||||
"Problem-first",
|
||||
"Business value",
|
||||
"Measurement"
|
||||
]
|
||||
},
|
||||
"think-in-systems": {
|
||||
"title": "Think in systems",
|
||||
"description": "Quan tâm đến kiến trúc tổng thể, không chỉ từng component.",
|
||||
"keywords": [
|
||||
"Architecture",
|
||||
"Integration",
|
||||
"Scalability",
|
||||
"Reliability"
|
||||
]
|
||||
},
|
||||
"measure-impact": {
|
||||
"title": "Measure impact",
|
||||
"description": "Technical implementation phải gắn với measurable outcome.",
|
||||
"keywords": [
|
||||
"Performance",
|
||||
"Reliability",
|
||||
"Cost",
|
||||
"Efficiency"
|
||||
]
|
||||
},
|
||||
"keep-learning": {
|
||||
"title": "Keep learning",
|
||||
"description": "Continuous exploration of new technologies and approaches.",
|
||||
"keywords": [
|
||||
"AI/ML",
|
||||
"Computer Vision",
|
||||
"LLM",
|
||||
"Distributed systems"
|
||||
]
|
||||
},
|
||||
"business-domain-knowledge-is-a-key-of-success": {
|
||||
"title": "Kiến thức nghiệp vụ là chìa khóa thành công",
|
||||
"description": "Hiểu sâu về business domain giúp hiểu rõ vấn đề và đưa ra giải pháp phù hợp.",
|
||||
"keywords": [
|
||||
"Biz knowledge",
|
||||
"Business value"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"skills": {
|
||||
"software-engineering": {
|
||||
"title": "Software Engineering"
|
||||
},
|
||||
"system-architecture": {
|
||||
"title": "System Architecture"
|
||||
},
|
||||
"logistics-technology": {
|
||||
"title": "Logistics Technology"
|
||||
},
|
||||
"ai-ml": {
|
||||
"title": "AI / ML"
|
||||
},
|
||||
"infrastructure": {
|
||||
"title": "Infrastructure"
|
||||
},
|
||||
"engineering-practices": {
|
||||
"title": "Engineering Practices"
|
||||
}
|
||||
},
|
||||
"experience": {
|
||||
"open-to-work": {
|
||||
"title": "Đang tìm nơi làm việc mới",
|
||||
"company": "Sẵn sàng cho cơ hội mới",
|
||||
"duration": "11/2026 – nay",
|
||||
"responsibilities": [
|
||||
"Sẵn sàng cho vai trò Senior Engineer: system architecture, integration platform, full-stack delivery"
|
||||
]
|
||||
},
|
||||
"relax-gap": {
|
||||
"title": "Nghỉ ngơi",
|
||||
"company": "Nghỉ giữa chặng",
|
||||
"duration": "08/2026 – 10/2026",
|
||||
"responsibilities": [
|
||||
"Nghỉ có chủ đích giữa hai vai trò — lấy lại nhịp trước khi nhận hệ thống tiếp theo",
|
||||
"Tự thử nghiệm theo nhịp riêng: local LLM với llama.cpp, đọc về Computer Vision"
|
||||
]
|
||||
},
|
||||
"lazada-senior-swe": {
|
||||
"title": "Senior Software Engineer",
|
||||
"company": "Lazada Tech Hub Vietnam",
|
||||
"duration": "01/2020 – 08/2026",
|
||||
"responsibilities": [
|
||||
"System ownership và architecture design cho logistics integration systems",
|
||||
"Developed IoT-DWS integration solution deployed across 16 sortations",
|
||||
"Led system maintenance and modernization for production environments",
|
||||
"Applied Computer Vision and ML to solve real-world operational problems",
|
||||
"Scrum Master responsibilities — team achieved Scrum Level L3"
|
||||
]
|
||||
},
|
||||
"nexts-founder": {
|
||||
"title": "Người sáng lập",
|
||||
"company": "Nexts Limited Company",
|
||||
"duration": "06/2019 – 12/2019",
|
||||
"responsibilities": [
|
||||
"Phát triển giải pháp cho xe tự hành, thu thập dữ liệu thời gian thực từ cảm biến và hệ thống onboard: LiDAR, camera, GPS, CAN bus."
|
||||
]
|
||||
},
|
||||
"sap-senior-swe": {
|
||||
"title": "Senior Software Engineer",
|
||||
"company": "SAP Lab Vietnam",
|
||||
"duration": "2017 – 12/2019",
|
||||
"responsibilities": [
|
||||
"Team leader quản lý sản phẩm B1 Integration"
|
||||
]
|
||||
}
|
||||
},
|
||||
"projects": {
|
||||
"iot-dws-integration": {
|
||||
"title": "Tích hợp hệ thống IoT-DWS",
|
||||
"summary": "Thiết kế và triển khai hệ thống integration giữa IoT devices và DWS (Dimensioning Weighing Scanning) machines cho 16 sortations.",
|
||||
"role": "Senior Software Engineer — System Owner",
|
||||
"metrics": [
|
||||
"Đã triển khai tại 16 sortations"
|
||||
],
|
||||
"sections": {
|
||||
"context": {
|
||||
"title": "Context",
|
||||
"content": "Tiếp nhận và nhanh chóng làm chủ một hệ thống IoT-DWS sau khi thành viên phụ trách trước đó rời project. Cần hiểu nhanh architecture hiện tại và tiếp tục phát triển integration solution."
|
||||
},
|
||||
"problem": {
|
||||
"title": "Problem",
|
||||
"content": "Cần integration giữa các IoT devices (sensors, cameras) và DWS machines — hệ thống vật lý phức tạp với nhiều protocol khác nhau (HMI, FTP, HTTP)."
|
||||
},
|
||||
"solution": {
|
||||
"title": "Solution",
|
||||
"content": "Thiết kế HTTP-based integration engine với HMAC security, RocketMQ messaging, và protocol adapters cho HMI/FTP/HTTP."
|
||||
},
|
||||
"architecture": {
|
||||
"title": "Architecture",
|
||||
"content": "```text\nIoT Devices\n ↓\nProtocol Adapters (HMI/FTP/HTTP)\n ↓\nHTTP Engine + HMAC Security\n ↓\nRocketMQ\n ↓\nDWS Machines\n```"
|
||||
},
|
||||
"challenges": {
|
||||
"title": "Challenges",
|
||||
"content": "Nhiều protocol khác nhau, security requirements (HMAC signature), real-time data processing, production reliability."
|
||||
},
|
||||
"result": {
|
||||
"title": "Result",
|
||||
"content": "Giải pháp được triển khai cho 16 sortations, ổn định trong production, hỗ trợ 3 protocols (HMI, FTP, HTTP)."
|
||||
}
|
||||
}
|
||||
},
|
||||
"awb-detection": {
|
||||
"title": "AWB Detection / Computer Vision",
|
||||
"summary": "Ứng dụng Computer Vision và Machine Learning để tự động phát hiện và OCR shipping label từ hình ảnh camera trên sortation.",
|
||||
"role": "Senior Software Engineer — ML Engineering",
|
||||
"metrics": [
|
||||
"Xử lý 70.000 ảnh/tháng"
|
||||
],
|
||||
"sections": {
|
||||
"context": {
|
||||
"title": "Context",
|
||||
"content": "Sortation machines chụp ảnh packages khi di chuyển trên băng chuyền. Cần tự động đọc AWB (Air Waybill) từ ảnh để tracking và sorting."
|
||||
},
|
||||
"problem": {
|
||||
"title": "Problem",
|
||||
"content": "White label trên white package — traditional CV methods không đủ robust. Cần ML-based detection."
|
||||
},
|
||||
"pipeline": {
|
||||
"title": "Pipeline",
|
||||
"content": "```text\nImage\n ↓\nAWB/Label Detection (YOLO)\n ↓\nBounding Box / OBB\n ↓\nRotation Correction\n ↓\nCrop\n ↓\nOCR\n ↓\nText Extraction\n```"
|
||||
},
|
||||
"challenges": {
|
||||
"title": "Challenges",
|
||||
"content": "White label on white package, rotated labels, varying lighting conditions, real-time inference requirements."
|
||||
},
|
||||
"result": {
|
||||
"title": "Result",
|
||||
"content": "Model fine-tuned cho AWB detection, xử lý 70,000 images/month. Presentation tại Tech Talk workshop."
|
||||
}
|
||||
}
|
||||
},
|
||||
"facility-management": {
|
||||
"title": "Facility Management Platform",
|
||||
"summary": "Xây dựng nền tảng digital twin cho logistics facilities — mô hình hóa facility, theo dõi real-time, và recommendation system.",
|
||||
"role": "Senior Software Engineer — Platform Design",
|
||||
"sections": {
|
||||
"vision": {
|
||||
"title": "Vision",
|
||||
"content": "Chuyển đổi từ manual operations sang Operation Intelligence Platform — thu thập data, monitor, analyze, recommend, decide."
|
||||
},
|
||||
"architecture": {
|
||||
"title": "Architecture",
|
||||
"content": "```text\nPhysical Facility\n ↓\nData Collection\n ↓\nFacility Model\n ↓\nDigital Twin\n ↓\nSimulation\n ↓\nAnalytics\n ↓\nRecommendation\n ↓\nOperation Decision\n```"
|
||||
},
|
||||
"result": {
|
||||
"title": "Result",
|
||||
"content": "Platform hỗ trợ facility modeling, real-time visibility, và recommendation cho capacity planning."
|
||||
}
|
||||
}
|
||||
},
|
||||
"local-llm-experiments": {
|
||||
"title": "Local LLM Experiments",
|
||||
"summary": "Technical exploration về running local MoE LLMs với llama.cpp — GPU offloading, VRAM optimization, performance tracing.",
|
||||
"role": "Engineering Experiment",
|
||||
"sections": {
|
||||
"exploration": {
|
||||
"title": "Exploration",
|
||||
"content": "Technical exploration về MoE (Mixture of Experts), expert routing, GPU offloading, VRAM optimization, prefill/decode pipeline."
|
||||
},
|
||||
"learnings": {
|
||||
"title": "Lessons Learned",
|
||||
"content": "Understand the system → Measure → Analyze → Optimize. Không phải khoe hardware — mà thể hiện engineering approach."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
{
|
||||
"open-to-work": {
|
||||
"title": "Đang tìm nơi làm việc mới",
|
||||
"company": "Sẵn sàng cho cơ hội mới",
|
||||
"duration": "11/2026 – nay",
|
||||
"responsibilities": [
|
||||
"Sẵn sàng cho vai trò Senior Engineer: system architecture, integration platform, full-stack delivery"
|
||||
]
|
||||
},
|
||||
"relax-gap": {
|
||||
"title": "Nghỉ ngơi",
|
||||
"company": "Nghỉ giữa chặng",
|
||||
"duration": "08/2026 – 10/2026",
|
||||
"responsibilities": [
|
||||
"Nghỉ có chủ đích giữa hai vai trò — lấy lại nhịp trước khi nhận hệ thống tiếp theo",
|
||||
"Tự thử nghiệm theo nhịp riêng: local LLM với llama.cpp, đọc về Computer Vision"
|
||||
]
|
||||
},
|
||||
"lazada-senior-swe": {
|
||||
"title": "Senior Software Engineer",
|
||||
"company": "Lazada Tech Hub Vietnam",
|
||||
"duration": "01/2020 – 08/2026",
|
||||
"responsibilities": [
|
||||
"System ownership và architecture design cho logistics integration systems",
|
||||
"Developed IoT-DWS integration solution deployed across 16 sortations",
|
||||
"Led system maintenance and modernization for production environments",
|
||||
"Applied Computer Vision and ML to solve real-world operational problems",
|
||||
"Scrum Master responsibilities — team achieved Scrum Level L3"
|
||||
]
|
||||
},
|
||||
"nexts-founder": {
|
||||
"title": "Người sáng lập",
|
||||
"company": "Nexts Limited Company",
|
||||
"duration": "06/2019 – 12/2019",
|
||||
"responsibilities": [
|
||||
"Phát triển giải pháp cho xe tự hành, thu thập dữ liệu thời gian thực từ cảm biến và hệ thống onboard: LiDAR, camera, GPS, CAN bus."
|
||||
]
|
||||
},
|
||||
"sap-senior-swe": {
|
||||
"title": "Senior Software Engineer",
|
||||
"company": "SAP Lab Vietnam",
|
||||
"duration": "2017 – 12/2019",
|
||||
"responsibilities": [
|
||||
"Team leader quản lý sản phẩm B1 Integration"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
{
|
||||
"name": "Nguyễn Đông",
|
||||
"title": "Senior Software Engineer",
|
||||
"bio": "Senior Software Engineer với kinh nghiệm xây dựng hệ thống phân tán, logistics technology, và ứng dụng AI/ML vào bài toán thực tế. Tập trung vào system architecture, integration, và production-grade solutions.",
|
||||
"subtitle": "Kỹ sư phần mềm cao cấp với chuyên môn sâu về hệ thống phân tán, công nghệ logistics và ứng dụng AI thực tiễn.",
|
||||
"tldr": "15 năm kinh nghiệm, hơn 8 công ty đã đi qua. Quá dài để kể hết.",
|
||||
"tagline": [
|
||||
{
|
||||
"text": "Phần lớn thời gian tôi là Backend Software Engineer. Muốn tôi là Full Stack Developer, "
|
||||
},
|
||||
{
|
||||
"text": "yes",
|
||||
"emphasis": true
|
||||
},
|
||||
{
|
||||
"text": ", có thể."
|
||||
}
|
||||
],
|
||||
"currentInterests": [
|
||||
"AI in logistics",
|
||||
"Simulation",
|
||||
"Digital twins",
|
||||
"LLM",
|
||||
"Computer Vision",
|
||||
"High-performance systems"
|
||||
],
|
||||
"roles": [
|
||||
"System Architect",
|
||||
"Full-Stack Developer",
|
||||
"System Engineer",
|
||||
"AI/ML Application Engineer"
|
||||
],
|
||||
"philosophyQuotes": [
|
||||
{
|
||||
"title": "Thời gian là vô giá",
|
||||
"details": [
|
||||
"Thời gian là vô giá. Bạn không thể mua nó bằng tiền, không thể khiến nó dừng lại, cũng chẳng thể quay ngược về quá khứ. Một khi thời gian đã trôi qua, nó sẽ mãi mãi không trở lại.",
|
||||
"Chúng ta dành quá nhiều thời gian trong cuộc đời để theo đuổi những thứ như tiền bạc, địa vị và sự công nhận từ người khác. Nhưng thời gian là thứ duy nhất mà chúng ta không bao giờ có thể lấy lại.",
|
||||
"Vì vậy, hãy luôn ý thức về cách bạn sử dụng thời gian của mình. Hãy dành thời gian cho những điều thực sự quan trọng: những người bạn yêu thương, những mục tiêu truyền cảm hứng cho bạn và những khoảnh khắc nuôi dưỡng tâm hồn bạn."
|
||||
]
|
||||
}
|
||||
],
|
||||
"philosophy": {
|
||||
"build-for-the-real-problem": {
|
||||
"title": "Giải pháp được xây dựng dựa trên vấn đề thực tế",
|
||||
"description": "Không bắt đầu bằng technology. Bắt đầu bằng problem.",
|
||||
"keywords": [
|
||||
"Problem-first",
|
||||
"Business value",
|
||||
"Measurement"
|
||||
]
|
||||
},
|
||||
"think-in-systems": {
|
||||
"title": "Think in systems",
|
||||
"description": "Quan tâm đến kiến trúc tổng thể, không chỉ từng component.",
|
||||
"keywords": [
|
||||
"Architecture",
|
||||
"Integration",
|
||||
"Scalability",
|
||||
"Reliability"
|
||||
]
|
||||
},
|
||||
"measure-impact": {
|
||||
"title": "Measure impact",
|
||||
"description": "Technical implementation phải gắn với measurable outcome.",
|
||||
"keywords": [
|
||||
"Performance",
|
||||
"Reliability",
|
||||
"Cost",
|
||||
"Efficiency"
|
||||
]
|
||||
},
|
||||
"keep-learning": {
|
||||
"title": "Keep learning",
|
||||
"description": "Continuous exploration of new technologies and approaches.",
|
||||
"keywords": [
|
||||
"AI/ML",
|
||||
"Computer Vision",
|
||||
"LLM",
|
||||
"Distributed systems"
|
||||
]
|
||||
},
|
||||
"business-domain-knowledge-is-a-key-of-success": {
|
||||
"title": "Kiến thức nghiệp vụ là chìa khóa thành công",
|
||||
"description": "Hiểu sâu về business domain giúp hiểu rõ vấn đề và đưa ra giải pháp phù hợp.",
|
||||
"keywords": [
|
||||
"Biz knowledge",
|
||||
"Business value"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
{
|
||||
"iot-dws-integration": {
|
||||
"title": "Tích hợp hệ thống IoT-DWS",
|
||||
"summary": "Thiết kế và triển khai hệ thống integration giữa IoT devices và DWS (Dimensioning Weighing Scanning) machines cho 16 sortations.",
|
||||
"role": "Senior Software Engineer — System Owner",
|
||||
"metrics": [
|
||||
"Đã triển khai tại 16 sortations"
|
||||
],
|
||||
"sections": {
|
||||
"context": {
|
||||
"title": "Context",
|
||||
"content": "Tiếp nhận và nhanh chóng làm chủ một hệ thống IoT-DWS sau khi thành viên phụ trách trước đó rời project. Cần hiểu nhanh architecture hiện tại và tiếp tục phát triển integration solution."
|
||||
},
|
||||
"problem": {
|
||||
"title": "Problem",
|
||||
"content": "Cần integration giữa các IoT devices (sensors, cameras) và DWS machines — hệ thống vật lý phức tạp với nhiều protocol khác nhau (HMI, FTP, HTTP)."
|
||||
},
|
||||
"solution": {
|
||||
"title": "Solution",
|
||||
"content": "Thiết kế HTTP-based integration engine với HMAC security, RocketMQ messaging, và protocol adapters cho HMI/FTP/HTTP."
|
||||
},
|
||||
"architecture": {
|
||||
"title": "Architecture",
|
||||
"content": "```text\nIoT Devices\n ↓\nProtocol Adapters (HMI/FTP/HTTP)\n ↓\nHTTP Engine + HMAC Security\n ↓\nRocketMQ\n ↓\nDWS Machines\n```"
|
||||
},
|
||||
"challenges": {
|
||||
"title": "Challenges",
|
||||
"content": "Nhiều protocol khác nhau, security requirements (HMAC signature), real-time data processing, production reliability."
|
||||
},
|
||||
"result": {
|
||||
"title": "Result",
|
||||
"content": "Giải pháp được triển khai cho 16 sortations, ổn định trong production, hỗ trợ 3 protocols (HMI, FTP, HTTP)."
|
||||
}
|
||||
}
|
||||
},
|
||||
"awb-detection": {
|
||||
"title": "AWB Detection / Computer Vision",
|
||||
"summary": "Ứng dụng Computer Vision và Machine Learning để tự động phát hiện và OCR shipping label từ hình ảnh camera trên sortation.",
|
||||
"role": "Senior Software Engineer — ML Engineering",
|
||||
"metrics": [
|
||||
"Xử lý 70.000 ảnh/tháng"
|
||||
],
|
||||
"sections": {
|
||||
"context": {
|
||||
"title": "Context",
|
||||
"content": "Sortation machines chụp ảnh packages khi di chuyển trên băng chuyền. Cần tự động đọc AWB (Air Waybill) từ ảnh để tracking và sorting."
|
||||
},
|
||||
"problem": {
|
||||
"title": "Problem",
|
||||
"content": "White label trên white package — traditional CV methods không đủ robust. Cần ML-based detection."
|
||||
},
|
||||
"pipeline": {
|
||||
"title": "Pipeline",
|
||||
"content": "```text\nImage\n ↓\nAWB/Label Detection (YOLO)\n ↓\nBounding Box / OBB\n ↓\nRotation Correction\n ↓\nCrop\n ↓\nOCR\n ↓\nText Extraction\n```"
|
||||
},
|
||||
"challenges": {
|
||||
"title": "Challenges",
|
||||
"content": "White label on white package, rotated labels, varying lighting conditions, real-time inference requirements."
|
||||
},
|
||||
"result": {
|
||||
"title": "Result",
|
||||
"content": "Model fine-tuned cho AWB detection, xử lý 70,000 images/month. Presentation tại Tech Talk workshop."
|
||||
}
|
||||
}
|
||||
},
|
||||
"facility-management": {
|
||||
"title": "Facility Management Platform",
|
||||
"summary": "Xây dựng nền tảng digital twin cho logistics facilities — mô hình hóa facility, theo dõi real-time, và recommendation system.",
|
||||
"role": "Senior Software Engineer — Platform Design",
|
||||
"sections": {
|
||||
"vision": {
|
||||
"title": "Vision",
|
||||
"content": "Chuyển đổi từ manual operations sang Operation Intelligence Platform — thu thập data, monitor, analyze, recommend, decide."
|
||||
},
|
||||
"architecture": {
|
||||
"title": "Architecture",
|
||||
"content": "```text\nPhysical Facility\n ↓\nData Collection\n ↓\nFacility Model\n ↓\nDigital Twin\n ↓\nSimulation\n ↓\nAnalytics\n ↓\nRecommendation\n ↓\nOperation Decision\n```"
|
||||
},
|
||||
"result": {
|
||||
"title": "Result",
|
||||
"content": "Platform hỗ trợ facility modeling, real-time visibility, và recommendation cho capacity planning."
|
||||
}
|
||||
}
|
||||
},
|
||||
"local-llm-experiments": {
|
||||
"title": "Local LLM Experiments",
|
||||
"summary": "Technical exploration về running local MoE LLMs với llama.cpp — GPU offloading, VRAM optimization, performance tracing.",
|
||||
"role": "Engineering Experiment",
|
||||
"sections": {
|
||||
"exploration": {
|
||||
"title": "Exploration",
|
||||
"content": "Technical exploration về MoE (Mixture of Experts), expert routing, GPU offloading, VRAM optimization, prefill/decode pipeline."
|
||||
},
|
||||
"learnings": {
|
||||
"title": "Lessons Learned",
|
||||
"content": "Understand the system → Measure → Analyze → Optimize. Không phải khoe hardware — mà thể hiện engineering approach."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"software-engineering": {
|
||||
"title": "Software Engineering"
|
||||
},
|
||||
"system-architecture": {
|
||||
"title": "System Architecture"
|
||||
},
|
||||
"logistics-technology": {
|
||||
"title": "Logistics Technology"
|
||||
},
|
||||
"ai-ml": {
|
||||
"title": "AI / ML"
|
||||
},
|
||||
"infrastructure": {
|
||||
"title": "Infrastructure"
|
||||
},
|
||||
"engineering-practices": {
|
||||
"title": "Engineering Practices"
|
||||
}
|
||||
}
|
||||
@@ -1,235 +0,0 @@
|
||||
{
|
||||
"nav": {
|
||||
"home": "Trang chủ",
|
||||
"resume": "Tải CV",
|
||||
"about": "Giới thiệu",
|
||||
"experience": "Kinh nghiệm",
|
||||
"projects": "Dự án",
|
||||
"philosophy": "Triết lý",
|
||||
"contact": "Liên hệ",
|
||||
"palette": "Giao diện",
|
||||
"paletteAria": "Đổi màu giao diện",
|
||||
"menuAria": "Menu trang",
|
||||
"openMenu": "Mở menu",
|
||||
"closeMenu": "Đóng menu",
|
||||
"groupMenu": "Menu",
|
||||
"groupAppearance": "Giao diện",
|
||||
"themeGroup": "Chế độ",
|
||||
"themeDark": "Tối",
|
||||
"themeLight": "Sáng",
|
||||
"langGroup": "Ngôn ngữ",
|
||||
"langEn": "English",
|
||||
"langVi": "Tiếng Việt",
|
||||
"langSwitch": "Đổi ngôn ngữ",
|
||||
"switchTo": "Chuyển sang",
|
||||
"mainNav": "Điều hướng chính",
|
||||
"themeSwitch": "Đổi chế độ hiển thị",
|
||||
"themeMode": "Chế độ hiển thị"
|
||||
},
|
||||
"social": {
|
||||
"heading": "Kết nối",
|
||||
"aria": {
|
||||
"github": "Xem hồ sơ GitHub",
|
||||
"linkedin": "Xem hồ sơ LinkedIn",
|
||||
"email": "Gửi email",
|
||||
"telegram": "Mở chat Telegram"
|
||||
}
|
||||
},
|
||||
"footer": {
|
||||
"copyright": "Bảo lưu mọi quyền",
|
||||
"links": {
|
||||
"home": "Trang chủ",
|
||||
"about": "Giới thiệu",
|
||||
"projects": "Dự án",
|
||||
"contact": "Liên hệ"
|
||||
}
|
||||
},
|
||||
"hero": {
|
||||
"greeting": "Xin chào, tôi là",
|
||||
"ctaProjects": "Xem dự án",
|
||||
"ctaContact": "Liên hệ",
|
||||
"scroll": "Cuộn"
|
||||
},
|
||||
"about": {
|
||||
"heading": "Giới thiệu",
|
||||
"engineeringTitle": "Cách tôi tư duy về kỹ thuật",
|
||||
"exploringTitle": "Những điều tôi đang tìm hiểu",
|
||||
"exploringTitlePage": "Những điều tôi đang tìm hiểu",
|
||||
"expertise": "Chuyên môn"
|
||||
},
|
||||
"expertise": {
|
||||
"heading": "Chuyên môn"
|
||||
},
|
||||
"experience": {
|
||||
"heading": "Kinh nghiệm",
|
||||
"tldr": "TL;DR"
|
||||
},
|
||||
"projects": {
|
||||
"featured": "Dự án nổi bật",
|
||||
"all": "Dự án",
|
||||
"viewAll": "Xem tất cả",
|
||||
"viewDetails": "Xem chi tiết",
|
||||
"categories": {
|
||||
"software-engineering": "Kỹ thuật phần mềm",
|
||||
"logistics": "Logistics",
|
||||
"ai-ml": "AI / ML",
|
||||
"computer-vision": "Computer Vision",
|
||||
"architecture": "Kiến trúc",
|
||||
"experiment": "Thử nghiệm"
|
||||
}
|
||||
},
|
||||
"contact": {
|
||||
"heading": "Liên hệ",
|
||||
"email": "Email",
|
||||
"github": "GitHub",
|
||||
"linkedin": "LinkedIn",
|
||||
"telegram": "Telegram"
|
||||
},
|
||||
"projectDetail": {
|
||||
"notFound": "Không tìm thấy dự án",
|
||||
"backToProjects": "Quay lại dự án",
|
||||
"impact": "Tác động",
|
||||
"role": "Vai trò",
|
||||
"technologies": "Công nghệ",
|
||||
"experiments": "Thí nghiệm kỹ thuật"
|
||||
},
|
||||
"philosophy": {
|
||||
"heading": "Triết lý"
|
||||
},
|
||||
"common": {
|
||||
"resumeDownload": "Tải CV",
|
||||
"resumeModalTitle": "Tải CV",
|
||||
"resumeModalAria": "Chọn ngôn ngữ CV",
|
||||
"resumeModalHint": "Chọn ngôn ngữ — PDF sẽ tải về máy của bạn.",
|
||||
"resumeModalClose": "Đóng tùy chọn tải CV",
|
||||
"backToTop": "Cuộn lên đầu trang",
|
||||
"contactTag": "Liên hệ",
|
||||
"experienceTag": "Kinh nghiệm"
|
||||
},
|
||||
"resume": {
|
||||
"EXPERIENCE": "Kinh nghiệm",
|
||||
"SKILLS": "Kỹ năng",
|
||||
"PROJECTS": "Dự án",
|
||||
"UPDATED": "Cập nhật lần cuối",
|
||||
"QR_ALT": "mã QR"
|
||||
},
|
||||
"edit": {
|
||||
"editField": "Sửa trường này",
|
||||
"copyPath": "Copy đường dẫn JSON",
|
||||
"pathCopied": "Đã copy",
|
||||
"emptyRequired": "Trường bắt buộc không được để trống",
|
||||
"settings": "Cài đặt bản ghi",
|
||||
"closeSettings": "Đóng cài đặt",
|
||||
"moveUp": "Chuyển lên",
|
||||
"moveDown": "Chuyển xuống",
|
||||
"remove": "Xóa",
|
||||
"removeConfirm": "Xóa mục này?",
|
||||
"newTag": "mới",
|
||||
"emphasis": "Nhấn mạnh",
|
||||
"featured": "Nổi bật",
|
||||
"sections": "Các mục",
|
||||
"sectionType": "Kiểu mục",
|
||||
"sectionTypes": {
|
||||
"text": "chữ",
|
||||
"diagram": "sơ đồ",
|
||||
"metrics": "chỉ số",
|
||||
"code": "code"
|
||||
},
|
||||
"conflictFields": "Xem các trường xung đột",
|
||||
"yours": "bản của tôi:",
|
||||
"theirs": "bản gốc:",
|
||||
"keepMine": "Giữ bản của tôi",
|
||||
"keepTheirs": "Giữ bản gốc",
|
||||
"variant": "Biến thể timeline",
|
||||
"variantNone": "bình thường",
|
||||
"variantCurrent": "đang làm",
|
||||
"variantGap": "nghỉ giữa hai vai trò",
|
||||
"addTaglineSegment": "Thêm đoạn tagline",
|
||||
"addKeyword": "Thêm từ khóa",
|
||||
"addInterest": "Thêm sở thích",
|
||||
"addSkill": "Thêm kỹ năng",
|
||||
"addTechnology": "Thêm công nghệ",
|
||||
"addMetric": "Thêm chỉ số",
|
||||
"addResponsibility": "Thêm trách nhiệm",
|
||||
"addQuoteDetail": "Thêm đoạn trích dẫn",
|
||||
"addQuote": "Thêm trích dẫn",
|
||||
"addProject": "Thêm dự án",
|
||||
"addSection": "Thêm mục",
|
||||
"addExperience": "Thêm kinh nghiệm",
|
||||
"addSkillGroup": "Thêm nhóm kỹ năng",
|
||||
"addPhilosophy": "Thêm nguyên lý",
|
||||
"title": "Chế độ sửa",
|
||||
"changes": "Thay đổi chưa lưu",
|
||||
"noChanges": "Không có thay đổi chưa lưu",
|
||||
"openPanel": "Bảng JSON",
|
||||
"closePanel": "Đóng bảng",
|
||||
"save": "Lưu",
|
||||
"saving": "Đang lưu…",
|
||||
"resume": "Tiếp tục lưu",
|
||||
"exit": "Thoát",
|
||||
"exitConfirm": "Hủy các thay đổi chưa lưu?",
|
||||
"changesTitle": "Changes",
|
||||
"discardDoc": "Bỏ tài liệu",
|
||||
"revert": "Hoàn tác",
|
||||
"conflicts": "Xung đột",
|
||||
"conflictDetail": "đã bị sửa từ ngoài sau khi bản nháp này được tạo",
|
||||
"rebase": "Rebase",
|
||||
"takeTheirs": "Lấy bản gốc",
|
||||
"handMerge": "Tự hợp nhất",
|
||||
"written": "đã ghi",
|
||||
"conflictStatus": "xung đột",
|
||||
"failed": "thất bại",
|
||||
"deployQueued": "đã xếp lịch deploy — nội dung lên site sau khi pipeline chạy xong",
|
||||
"branchLabel": "branch đích",
|
||||
"mergeHint": "đã ghi lên branch — merge vào master để deploy",
|
||||
"offline": "ngoại tuyến — đang hiển thị nội dung đóng gói, không lưu được",
|
||||
"draftRestored": "bản nháp đã khôi phục từ phiên này",
|
||||
"unionNote": "id mới cũng được thêm vào src/types/index.ts",
|
||||
"unionFailed": "không cập nhật được src/types/index.ts — hãy hoàn tất sửa trong Gitea",
|
||||
"panel": {
|
||||
"title": "Tài liệu nội dung",
|
||||
"readOnly": "chỉ đọc",
|
||||
"valid": "hợp lệ",
|
||||
"invalid": "không hợp lệ",
|
||||
"parseError": "Lỗi JSON",
|
||||
"addProject": "Thêm dự án",
|
||||
"addExperience": "Thêm kinh nghiệm",
|
||||
"addSkillGroup": "Thêm nhóm kỹ năng",
|
||||
"addPhilosophy": "Thêm nguyên lý",
|
||||
"addSection": "Thêm mục",
|
||||
"projectLabel": "dự án",
|
||||
"deleteRecord": "Xóa",
|
||||
"deleteConfirm": "Xóa bản ghi này và text của cả hai ngôn ngữ?",
|
||||
"baseLabel": "bản master",
|
||||
"draftLabel": "bản nháp",
|
||||
"applyMerge": "Áp dụng bản hợp nhất"
|
||||
},
|
||||
"fields": {
|
||||
"title": "tiêu đề",
|
||||
"summary": "tóm tắt",
|
||||
"bio": "giới thiệu",
|
||||
"subtitle": "phụ đề giới thiệu",
|
||||
"tldr": "TL;DR sự nghiệp",
|
||||
"tagline": "đoạn tagline",
|
||||
"groupTitle": "tiêu đề nhóm kỹ năng",
|
||||
"expTitle": "tên vị trí",
|
||||
"responsibility": "trách nhiệm",
|
||||
"sectionTitle": "tiêu đề mục",
|
||||
"sectionContent": "nội dung mục",
|
||||
"pointTitle": "tiêu đề nguyên lý",
|
||||
"pointDescription": "mô tả nguyên lý",
|
||||
"quoteTitle": "tiêu đề trích dẫn",
|
||||
"quoteDetail": "đoạn trích dẫn",
|
||||
"company": "công ty",
|
||||
"duration": "thời gian công tác",
|
||||
"projectRole": "vai trò dự án",
|
||||
"interests": "sở thích",
|
||||
"skill": "kỹ năng",
|
||||
"technology": "công nghệ",
|
||||
"metric": "chỉ số",
|
||||
"pointKeywords": "từ khóa nguyên lý",
|
||||
"location": "địa điểm",
|
||||
"logo": "logo"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"heading": "Giới thiệu",
|
||||
"engineeringTitle": "Cách tôi tư duy về kỹ thuật",
|
||||
"exploringTitle": "Những điều tôi đang tìm hiểu",
|
||||
"exploringTitlePage": "Những điều tôi đang tìm hiểu",
|
||||
"expertise": "Chuyên môn"
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"resumeDownload": "Tải CV",
|
||||
"resumeModalTitle": "Tải CV",
|
||||
"resumeModalAria": "Chọn ngôn ngữ CV",
|
||||
"resumeModalHint": "Chọn ngôn ngữ — PDF sẽ tải về máy của bạn.",
|
||||
"resumeModalClose": "Đóng tùy chọn tải CV",
|
||||
"backToTop": "Cuộn lên đầu trang",
|
||||
"contactTag": "Liên hệ",
|
||||
"experienceTag": "Kinh nghiệm"
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"heading": "Liên hệ",
|
||||
"email": "Email",
|
||||
"github": "GitHub",
|
||||
"linkedin": "LinkedIn",
|
||||
"telegram": "Telegram"
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
{
|
||||
"editField": "Sửa trường này",
|
||||
"copyPath": "Copy đường dẫn JSON",
|
||||
"pathCopied": "Đã copy",
|
||||
"emptyRequired": "Trường bắt buộc không được để trống",
|
||||
"settings": "Cài đặt bản ghi",
|
||||
"closeSettings": "Đóng cài đặt",
|
||||
"moveUp": "Chuyển lên",
|
||||
"moveDown": "Chuyển xuống",
|
||||
"remove": "Xóa",
|
||||
"removeConfirm": "Xóa mục này?",
|
||||
"newTag": "mới",
|
||||
"emphasis": "Nhấn mạnh",
|
||||
"featured": "Nổi bật",
|
||||
"sections": "Các mục",
|
||||
"sectionType": "Kiểu mục",
|
||||
"sectionTypes": {
|
||||
"text": "chữ",
|
||||
"diagram": "sơ đồ",
|
||||
"metrics": "chỉ số",
|
||||
"code": "code"
|
||||
},
|
||||
"conflictFields": "Xem các trường xung đột",
|
||||
"yours": "bản của tôi:",
|
||||
"theirs": "bản gốc:",
|
||||
"keepMine": "Giữ bản của tôi",
|
||||
"keepTheirs": "Giữ bản gốc",
|
||||
"variant": "Biến thể timeline",
|
||||
"variantNone": "bình thường",
|
||||
"variantCurrent": "đang làm",
|
||||
"variantGap": "nghỉ giữa hai vai trò",
|
||||
"addTaglineSegment": "Thêm đoạn tagline",
|
||||
"addKeyword": "Thêm từ khóa",
|
||||
"addInterest": "Thêm sở thích",
|
||||
"addSkill": "Thêm kỹ năng",
|
||||
"addTechnology": "Thêm công nghệ",
|
||||
"addMetric": "Thêm chỉ số",
|
||||
"addResponsibility": "Thêm trách nhiệm",
|
||||
"addQuoteDetail": "Thêm đoạn trích dẫn",
|
||||
"addQuote": "Thêm trích dẫn",
|
||||
"addProject": "Thêm dự án",
|
||||
"addSection": "Thêm mục",
|
||||
"addExperience": "Thêm kinh nghiệm",
|
||||
"addSkillGroup": "Thêm nhóm kỹ năng",
|
||||
"addPhilosophy": "Thêm nguyên lý",
|
||||
"title": "Chế độ sửa",
|
||||
"changes": "Thay đổi chưa lưu",
|
||||
"noChanges": "Không có thay đổi chưa lưu",
|
||||
"save": "Lưu",
|
||||
"saving": "Đang lưu…",
|
||||
"resume": "Tiếp tục lưu",
|
||||
"exit": "Thoát",
|
||||
"exitConfirm": "Hủy các thay đổi chưa lưu?",
|
||||
"changesTitle": "Changes",
|
||||
"discardDoc": "Bỏ tài liệu",
|
||||
"revert": "Hoàn tác",
|
||||
"conflicts": "Xung đột",
|
||||
"conflictDetail": "đã bị sửa từ ngoài sau khi bản nháp này được tạo",
|
||||
"rebase": "Rebase",
|
||||
"takeTheirs": "Lấy bản gốc",
|
||||
"written": "đã ghi",
|
||||
"conflictStatus": "xung đột",
|
||||
"failed": "thất bại",
|
||||
"deployQueued": "đã xếp lịch deploy — nội dung lên site sau khi pipeline chạy xong",
|
||||
"branchLabel": "branch đích",
|
||||
"mergeHint": "đã ghi lên branch — merge vào master để deploy",
|
||||
"offline": "ngoại tuyến — đang hiển thị nội dung đóng gói, không lưu được",
|
||||
"draftRestored": "bản nháp đã khôi phục từ phiên này",
|
||||
"unionNote": "id mới cũng được thêm vào src/types/index.ts",
|
||||
"unionFailed": "không cập nhật được src/types/index.ts — hãy hoàn tất sửa trong Gitea",
|
||||
"appearsHome": "Trang chủ",
|
||||
"appearsResume": "CV PDF",
|
||||
"appearsOn": "xuất hiện tại",
|
||||
"fields": {
|
||||
"title": "tiêu đề",
|
||||
"summary": "tóm tắt",
|
||||
"bio": "giới thiệu",
|
||||
"subtitle": "phụ đề giới thiệu",
|
||||
"tldr": "TL;DR sự nghiệp",
|
||||
"tagline": "đoạn tagline",
|
||||
"groupTitle": "tiêu đề nhóm kỹ năng",
|
||||
"expTitle": "tên vị trí",
|
||||
"responsibility": "trách nhiệm",
|
||||
"sectionTitle": "tiêu đề mục",
|
||||
"sectionContent": "nội dung mục",
|
||||
"pointTitle": "tiêu đề nguyên lý",
|
||||
"pointDescription": "mô tả nguyên lý",
|
||||
"quoteTitle": "tiêu đề trích dẫn",
|
||||
"quoteDetail": "đoạn trích dẫn",
|
||||
"company": "công ty",
|
||||
"duration": "thời gian công tác",
|
||||
"projectRole": "vai trò dự án",
|
||||
"interests": "sở thích",
|
||||
"skill": "kỹ năng",
|
||||
"technology": "công nghệ",
|
||||
"metric": "chỉ số",
|
||||
"pointKeywords": "từ khóa nguyên lý",
|
||||
"location": "địa điểm",
|
||||
"logo": "logo",
|
||||
"email": "địa chỉ email",
|
||||
"githubHandle": "GitHub handle",
|
||||
"linkedinHandle": "LinkedIn handle",
|
||||
"telegramHandle": "Telegram handle"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"heading": "Kinh nghiệm",
|
||||
"tldr": "TL;DR"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"heading": "Chuyên môn"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"copyright": "Bảo lưu mọi quyền",
|
||||
"links": {
|
||||
"home": "Trang chủ",
|
||||
"about": "Giới thiệu",
|
||||
"projects": "Dự án",
|
||||
"contact": "Liên hệ"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"greeting": "Xin chào, tôi là",
|
||||
"ctaProjects": "Xem dự án",
|
||||
"ctaContact": "Liên hệ",
|
||||
"scroll": "Cuộn"
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"home": "Trang chủ",
|
||||
"resume": "Tải CV",
|
||||
"about": "Giới thiệu",
|
||||
"experience": "Kinh nghiệm",
|
||||
"projects": "Dự án",
|
||||
"philosophy": "Triết lý",
|
||||
"contact": "Liên hệ",
|
||||
"palette": "Giao diện",
|
||||
"paletteAria": "Đổi màu giao diện",
|
||||
"menuAria": "Menu trang",
|
||||
"openMenu": "Mở menu",
|
||||
"closeMenu": "Đóng menu",
|
||||
"groupMenu": "Menu",
|
||||
"groupAppearance": "Giao diện",
|
||||
"themeGroup": "Chế độ",
|
||||
"themeDark": "Tối",
|
||||
"themeLight": "Sáng",
|
||||
"langGroup": "Ngôn ngữ",
|
||||
"langEn": "English",
|
||||
"langVi": "Tiếng Việt",
|
||||
"langSwitch": "Đổi ngôn ngữ",
|
||||
"switchTo": "Chuyển sang",
|
||||
"mainNav": "Điều hướng chính",
|
||||
"themeSwitch": "Đổi chế độ hiển thị",
|
||||
"themeMode": "Chế độ hiển thị"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"heading": "Triết lý"
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"notFound": "Không tìm thấy dự án",
|
||||
"backToProjects": "Quay lại dự án",
|
||||
"impact": "Tác động",
|
||||
"role": "Vai trò",
|
||||
"technologies": "Công nghệ",
|
||||
"experiments": "Thí nghiệm kỹ thuật"
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"featured": "Dự án nổi bật",
|
||||
"all": "Dự án",
|
||||
"viewAll": "Xem tất cả",
|
||||
"viewDetails": "Xem chi tiết",
|
||||
"categories": {
|
||||
"software-engineering": "Kỹ thuật phần mềm",
|
||||
"logistics": "Logistics",
|
||||
"ai-ml": "AI / ML",
|
||||
"computer-vision": "Computer Vision",
|
||||
"architecture": "Kiến trúc",
|
||||
"experiment": "Thử nghiệm"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"EXPERIENCE": "Kinh nghiệm",
|
||||
"SKILLS": "Kỹ năng",
|
||||
"PROJECTS": "Dự án",
|
||||
"UPDATED": "Cập nhật lần cuối",
|
||||
"QR_ALT": "mã QR"
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"heading": "Kết nối",
|
||||
"aria": {
|
||||
"github": "Xem hồ sơ GitHub",
|
||||
"linkedin": "Xem hồ sơ LinkedIn",
|
||||
"email": "Gửi email",
|
||||
"telegram": "Mở chat Telegram"
|
||||
}
|
||||
}
|
||||
+191
-29
@@ -1,11 +1,12 @@
|
||||
// Cross-document consistency rules (spec-v4 §3.6) — what types cannot express
|
||||
// across two JSON files. Runs at load (dev), in CI (`scripts/validate-content.ts`),
|
||||
// and in the browser before save (edit mode, Phase 3).
|
||||
// Cross-document consistency rules (spec-v4 §3.6, spec-v4-data-organization
|
||||
// §5.1) — what types cannot express across JSON files. Runs at load (dev),
|
||||
// in CI (`scripts/validate-content.ts`), and in the browser before save
|
||||
// (edit mode).
|
||||
//
|
||||
// tsc already guarantees each document individually satisfies its declared type
|
||||
// and that `content.vi.json` covers every union id; this module enforces the
|
||||
// relationships BETWEEN documents and reports exact document paths so a content
|
||||
// edit can be fixed in the JSON panel.
|
||||
// tsc already guarantees each document individually satisfies its declared
|
||||
// type and that every Vietnamese text file covers its union ids; this module
|
||||
// enforces the relationships BETWEEN documents and reports exact file paths
|
||||
// so a content edit can be fixed in the right file.
|
||||
import type {
|
||||
ContentEn,
|
||||
ContentVi,
|
||||
@@ -14,6 +15,8 @@ import type {
|
||||
ProjectStructure,
|
||||
SkillGroupStructure,
|
||||
} from './dict-types';
|
||||
import { manifestsClaiming, pageManifests } from '../data/pages';
|
||||
import type { ContentEntityId } from '../types/index';
|
||||
|
||||
export type ContentIssue = { path: string; message: string };
|
||||
|
||||
@@ -52,6 +55,17 @@ function findHtmlStrings(value: unknown, docPath: string): string[] {
|
||||
return [];
|
||||
}
|
||||
|
||||
// The per-entity text file a namespace lives in (spec-v4-data-organization
|
||||
// §3) — issue paths name the file a fix belongs in.
|
||||
const TEXT_FILE: Record<'profile' | 'skills' | 'experience' | 'projects', string> = {
|
||||
profile: 'profile.json',
|
||||
skills: 'skills.json',
|
||||
experience: 'experience.json',
|
||||
projects: 'projects.json',
|
||||
};
|
||||
const textFile = (lang: 'vi' | 'en', ns: keyof typeof TEXT_FILE) =>
|
||||
`src/i18n/locales/${lang}/content/${TEXT_FILE[ns]}`;
|
||||
|
||||
export function collectContentIssues(
|
||||
structures: ContentStructures,
|
||||
vi: ContentVi,
|
||||
@@ -64,22 +78,22 @@ export function collectContentIssues(
|
||||
// enforced per project, not by a global union.)
|
||||
for (const group of structures.skills) {
|
||||
if (!vi.skills[group.id])
|
||||
issues.push({ path: `content.vi.json: skills.${group.id}`, message: 'missing Vietnamese text' });
|
||||
issues.push({ path: `${textFile('vi', 'skills')}: ${group.id}`, message: 'missing Vietnamese text' });
|
||||
}
|
||||
for (const entry of structures.experience) {
|
||||
if (!vi.experience[entry.id])
|
||||
issues.push({ path: `content.vi.json: experience.${entry.id}`, message: 'missing Vietnamese text' });
|
||||
issues.push({ path: `${textFile('vi', 'experience')}: ${entry.id}`, message: 'missing Vietnamese text' });
|
||||
}
|
||||
for (const project of structures.projects) {
|
||||
const text = vi.projects[project.id];
|
||||
if (!text) {
|
||||
issues.push({ path: `content.vi.json: projects.${project.id}`, message: 'missing Vietnamese text' });
|
||||
issues.push({ path: `${textFile('vi', 'projects')}: ${project.id}`, message: 'missing Vietnamese text' });
|
||||
continue;
|
||||
}
|
||||
for (const section of project.sections) {
|
||||
if (!text.sections[section.id])
|
||||
issues.push({
|
||||
path: `content.vi.json: projects.${project.id}.sections.${section.id}`,
|
||||
path: `${textFile('vi', 'projects')}: ${project.id}.sections.${section.id}`,
|
||||
message: 'missing Vietnamese text for section',
|
||||
});
|
||||
}
|
||||
@@ -87,7 +101,7 @@ export function collectContentIssues(
|
||||
for (const point of structures.profile.philosophy) {
|
||||
if (!vi.profile.philosophy[point.id])
|
||||
issues.push({
|
||||
path: `content.vi.json: profile.philosophy.${point.id}`,
|
||||
path: `${textFile('vi', 'profile')}: philosophy.${point.id}`,
|
||||
message: 'missing Vietnamese text',
|
||||
});
|
||||
}
|
||||
@@ -103,32 +117,31 @@ export function collectContentIssues(
|
||||
const philosophyIds = new Set(structures.profile.philosophy.map((p) => p.id));
|
||||
|
||||
const checkTextDoc = (doc: Partial<ContentVi> | ContentEn, lang: 'vi' | 'en') => {
|
||||
const file = `content.${lang}.json`;
|
||||
for (const id of Object.keys(doc.skills ?? {})) {
|
||||
if (!skillIds.has(id as never))
|
||||
issues.push({ path: `${file}: skills.${id}`, message: 'orphan text key — no such skill group in structure' });
|
||||
issues.push({ path: `${textFile(lang, 'skills')}: ${id}`, message: 'orphan text key — no such skill group in structure' });
|
||||
}
|
||||
for (const id of Object.keys(doc.experience ?? {})) {
|
||||
if (!experienceIds.has(id as never))
|
||||
issues.push({ path: `${file}: experience.${id}`, message: 'orphan text key — no such experience in structure' });
|
||||
issues.push({ path: `${textFile(lang, 'experience')}: ${id}`, message: 'orphan text key — no such experience in structure' });
|
||||
}
|
||||
for (const [id, text] of Object.entries(doc.projects ?? {})) {
|
||||
if (!projectIds.has(id as never)) {
|
||||
issues.push({ path: `${file}: projects.${id}`, message: 'orphan text key — no such project in structure' });
|
||||
issues.push({ path: `${textFile(lang, 'projects')}: ${id}`, message: 'orphan text key — no such project in structure' });
|
||||
continue;
|
||||
}
|
||||
const known = sectionIds.get(id as never)!;
|
||||
for (const sectionId of Object.keys(text.sections ?? {})) {
|
||||
if (!known.has(sectionId))
|
||||
issues.push({
|
||||
path: `${file}: projects.${id}.sections.${sectionId}`,
|
||||
path: `${textFile(lang, 'projects')}: ${id}.sections.${sectionId}`,
|
||||
message: "orphan section text key — not in the project's structure",
|
||||
});
|
||||
}
|
||||
}
|
||||
for (const id of Object.keys(doc.profile?.philosophy ?? {})) {
|
||||
if (!philosophyIds.has(id as never))
|
||||
issues.push({ path: `${file}: profile.philosophy.${id}`, message: 'orphan text key — no such philosophy point' });
|
||||
issues.push({ path: `${textFile(lang, 'profile')}: philosophy.${id}`, message: 'orphan text key — no such philosophy point' });
|
||||
}
|
||||
};
|
||||
checkTextDoc(vi, 'vi');
|
||||
@@ -136,18 +149,18 @@ export function collectContentIssues(
|
||||
|
||||
// Rule 5: text values are plain text — no HTML markup in any content
|
||||
// document (after D9 nothing needs markup; §3.2 keeps rendering separate).
|
||||
// Rule 6: no empty text values in either language document. Every string
|
||||
// in a text document is a required field; the editor rejects an empty
|
||||
// commit with exactly this rule, and CI keeps an emptied field out of
|
||||
// master.
|
||||
for (const [lang, doc] of [['vi', vi], ['en', en]] as const) {
|
||||
for (const path of findHtmlStrings(doc, `content.${lang}.json`)) {
|
||||
issues.push({ path, message: 'text value contains HTML markup' });
|
||||
}
|
||||
}
|
||||
|
||||
// Rule 6: no empty text values in either language document. Every string in
|
||||
// a text document is a required field; the editor rejects an empty commit
|
||||
// with exactly this rule, and CI keeps an emptied field out of master.
|
||||
for (const [lang, doc] of [['vi', vi], ['en', en]] as const) {
|
||||
for (const path of findEmptyStrings(doc, `content.${lang}.json`)) {
|
||||
issues.push({ path, message: 'empty text value' });
|
||||
for (const ns of ['profile', 'skills', 'experience', 'projects'] as const) {
|
||||
for (const path of findHtmlStrings(doc[ns], textFile(lang, ns))) {
|
||||
issues.push({ path, message: 'text value contains HTML markup' });
|
||||
}
|
||||
for (const path of findEmptyStrings(doc[ns], textFile(lang, ns))) {
|
||||
issues.push({ path, message: 'empty text value' });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,3 +178,152 @@ export function validateContent(
|
||||
throw new Error(`content validation failed (${issues.length} issue(s)):\n${detail}`);
|
||||
}
|
||||
}
|
||||
|
||||
// --- page manifest rules (spec-v4-data-organization §5.1) ---------------------
|
||||
// Manifests are developer-owned, language-neutral documents; these rules run
|
||||
// at load and in CI, not per draft — an edit session never rewrites them.
|
||||
|
||||
const MANIFEST_IDS = [
|
||||
'home',
|
||||
'about',
|
||||
'experience',
|
||||
'projects',
|
||||
'project-detail',
|
||||
'contact',
|
||||
'philosophy',
|
||||
'resume',
|
||||
] as const;
|
||||
|
||||
const TEXT_NAMESPACES: {
|
||||
ns: 'profile' | 'skills' | 'experience' | 'projects';
|
||||
entity: ContentEntityId;
|
||||
}[] = [
|
||||
{ ns: 'profile', entity: 'profile' },
|
||||
{ ns: 'skills', entity: 'skillGroups' },
|
||||
{ ns: 'experience', entity: 'experiences' },
|
||||
{ ns: 'projects', entity: 'projects' },
|
||||
];
|
||||
|
||||
function keyUnion(...objects: unknown[]): Set<string> {
|
||||
const keys = new Set<string>();
|
||||
for (const object of objects) {
|
||||
if (object && typeof object === 'object')
|
||||
for (const key of Object.keys(object)) keys.add(key);
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
|
||||
// The joined record keys of a record-keyed entity: structure row fields plus
|
||||
// its text fields in either language.
|
||||
function joinedRecordKeys(
|
||||
structureRows: { id: string }[],
|
||||
viText: unknown,
|
||||
enText: unknown,
|
||||
): Set<string> {
|
||||
const viDoc = (viText ?? {}) as Record<string, Record<string, unknown>>;
|
||||
const enDoc = (enText ?? {}) as Record<string, Record<string, unknown>>;
|
||||
const all = new Set<string>();
|
||||
for (const row of structureRows) {
|
||||
const text = { ...(viDoc[row.id] ?? {}), ...(enDoc[row.id] ?? {}) };
|
||||
for (const key of keyUnion(row, text)) all.add(key);
|
||||
}
|
||||
return all;
|
||||
}
|
||||
|
||||
// Walks every string leaf of a text document, returning document-relative
|
||||
// paths — the same walk as findHtmlStrings, without the HTML filter.
|
||||
function textLeafPaths(value: unknown, prefix: string): string[] {
|
||||
if (typeof value === 'string') return [prefix];
|
||||
if (Array.isArray(value))
|
||||
return value.flatMap((item, i) => textLeafPaths(item, `${prefix}[${i}]`));
|
||||
if (value && typeof value === 'object')
|
||||
return Object.entries(value).flatMap(([key, item]) =>
|
||||
textLeafPaths(item, prefix ? `${prefix}.${key}` : key),
|
||||
);
|
||||
return [];
|
||||
}
|
||||
|
||||
export function collectManifestIssues(
|
||||
structures: ContentStructures,
|
||||
vi: ContentVi,
|
||||
en: ContentEn,
|
||||
uiGroups: readonly string[],
|
||||
): ContentIssue[] {
|
||||
const issues: ContentIssue[] = [];
|
||||
|
||||
// Rule 1: exactly the seven route manifests plus the synthetic resume
|
||||
// consumer — no orphan or missing manifest.
|
||||
const ids: string[] = pageManifests.map((m) => m.id);
|
||||
for (const id of MANIFEST_IDS) {
|
||||
if (!ids.includes(id))
|
||||
issues.push({ path: 'src/data/pages/', message: `missing manifest for ${id}` });
|
||||
}
|
||||
for (const id of ids) {
|
||||
if (!(MANIFEST_IDS as readonly string[]).includes(id))
|
||||
issues.push({ path: `src/data/pages/${id}.json`, message: 'unknown manifest id' });
|
||||
}
|
||||
|
||||
// Rule 2: every claimed entity is known and every field path resolves in
|
||||
// the joined records ("*" is always valid; "x.*" checks the parent key).
|
||||
const entityKeys: Record<ContentEntityId, Set<string>> = {
|
||||
profile: keyUnion(structures.profile, vi.profile, en.profile),
|
||||
skillGroups: joinedRecordKeys(structures.skills, vi.skills, en.skills),
|
||||
experiences: joinedRecordKeys(structures.experience, vi.experience, en.experience),
|
||||
projects: joinedRecordKeys(structures.projects, vi.projects, en.projects),
|
||||
};
|
||||
for (const manifest of pageManifests) {
|
||||
const file = `src/data/pages/${manifest.id}.json`;
|
||||
for (const claim of manifest.content) {
|
||||
const keys = entityKeys[claim.entity as ContentEntityId];
|
||||
if (!keys) {
|
||||
issues.push({ path: `${file}: ${claim.entity}`, message: 'unknown content entity' });
|
||||
continue;
|
||||
}
|
||||
for (const field of claim.fields) {
|
||||
if (field === '*') continue;
|
||||
const key = field.endsWith('.*') ? field.slice(0, -2) : field;
|
||||
if (!keys.has(key))
|
||||
issues.push({
|
||||
path: `${file}: ${claim.entity}.${field}`,
|
||||
message: 'field path does not resolve in the joined records',
|
||||
});
|
||||
}
|
||||
}
|
||||
// Rule 3: page-owned ui groups exist in the UI documents.
|
||||
for (const group of manifest.ui) {
|
||||
if (!uiGroups.includes(group))
|
||||
issues.push({ path: `${file}: ui.${group}`, message: 'unknown ui group' });
|
||||
}
|
||||
}
|
||||
|
||||
// Rule 4 (no orphan fields): every text leaf in either language document
|
||||
// must be claimed by at least one manifest — adding a field without saying
|
||||
// where it appears fails the build, in the dangerous direction only.
|
||||
for (const [lang, doc] of [['vi', vi], ['en', en]] as const) {
|
||||
for (const { ns, entity } of TEXT_NAMESPACES) {
|
||||
for (const leaf of textLeafPaths(doc[ns], '')) {
|
||||
if (manifestsClaiming(entity, leaf).length === 0) {
|
||||
issues.push({
|
||||
path: `${textFile(lang, ns)}: ${leaf}`,
|
||||
message: 'text field claimed by no page manifest',
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return issues;
|
||||
}
|
||||
|
||||
export function validateManifests(
|
||||
structures: ContentStructures,
|
||||
vi: ContentVi,
|
||||
en: ContentEn,
|
||||
uiGroups: readonly string[],
|
||||
): void {
|
||||
const issues = collectManifestIssues(structures, vi, en, uiGroups);
|
||||
if (issues.length > 0) {
|
||||
const detail = issues.map((i) => ` ${i.path}: ${i.message}`).join('\n');
|
||||
throw new Error(`manifest validation failed (${issues.length} issue(s)):\n${detail}`);
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
|
||||
@@ -44,3 +44,39 @@ export type PhilosophyId =
|
||||
| 'measure-impact'
|
||||
| 'keep-learning'
|
||||
| 'business-domain-knowledge-is-a-key-of-success';
|
||||
|
||||
// Page manifests (spec-v4-data-organization §5): one per route plus the
|
||||
// synthetic resume consumer. A manifest claims which joined records a page
|
||||
// reads — provenance for EditBar grouping and the orphan-field rule.
|
||||
export type PageId =
|
||||
| 'home'
|
||||
| 'about'
|
||||
| 'experience'
|
||||
| 'projects'
|
||||
| 'project-detail'
|
||||
| 'contact'
|
||||
| 'philosophy';
|
||||
|
||||
export type ManifestId = PageId | 'resume';
|
||||
|
||||
// Entity ids join the structure document, the text documents, and the
|
||||
// manifest claims (§3 table).
|
||||
export type ContentEntityId = 'profile' | 'skillGroups' | 'experiences' | 'projects';
|
||||
|
||||
export type PageManifestClaim = {
|
||||
entity: ContentEntityId;
|
||||
// Paths into the joined records; "*" claims the whole entity. Record-level
|
||||
// fields are named record-relative ("summary"); "sections.*" claims every
|
||||
// sub-field of the sections record.
|
||||
fields: string[];
|
||||
};
|
||||
|
||||
export type PageManifest = {
|
||||
id: ManifestId;
|
||||
// null for the synthetic resume consumer — it has no route.
|
||||
route: string | null;
|
||||
content: PageManifestClaim[];
|
||||
// Page-owned UI groups only; component-owned groups are never repeated
|
||||
// (§4 ownership table).
|
||||
ui: string[];
|
||||
};
|
||||
Reference in new issue
Block a user