From 166eb171b5382b71cb0eb97676be077eba13c42b Mon Sep 17 00:00:00 2001 From: "dong.nguyen" Date: Fri, 16 Oct 2026 23:14:52 +0700 Subject: [PATCH] feat(experience): timeline status + career-break nodes, TLDR terminal node, prose measures MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Timeline structure - Spine drawn per node (.timeline-entry::before) instead of one line on .timeline, so it ends at the TLDR diamond; marker and spine centres coincide at x=6 (gutter 36 desktop / 28 mobile) - TLDR terminal node: markup in ExperiencePage + Experience section, copy in i18n/strings.ts (experience.tldr / experience.tldrText), CSS .timeline-tldr* (stub, accent link, hollow diamond, chip, text) - ExperienceEntry gains variant?: 'current' | 'gap'; the class is composed in JSX rather than hard-coding entry ids Node decoration - current node: TLDR-family panel (--bg-surface, 1px --border, radius-lg, whisper shadow) with a 2px accent left edge, real entry padding (16/18/20, mobile 14/16/18) and a pulsing marker; mobile pulse capped at 6px spread so the ring never touches the panel border - gap node: dashed spine (repeating-linear-gradient), 10px muted marker, no divider, italic-muted title and company Data - New relax-gap entry (Aug 2026 – Oct 2026) between open-to-work and lazada-senior-swe; unique entry ids; Nexts and SAP bullets aligned across VI/EN Typography - Add --measure-page (680px); .prose-wide / .lede-wide; .page-body 700 -> 680; philosophy grid 3 columns, 2 at <=1024px Cleanup - Achievements dropped from the SPA timeline and their dead .achievement* rules deleted (.achievement-metric kept: projects pages still use it) Resume generator - "${exp.achievements?.map(...).join('')}" short-circuited the whole chain and printed the literal "undefined" in every PDF once an entry had no achievements; now (exp.achievements ?? []) Docs: spec-ui-experience.md, spec-v3-typography.md, AGENTS.md Verified: tsc -b clean; vite build green; oxlint 11 errors / 9 warnings (HEAD baseline was 15/9 — the four that disappeared were the achievements markup findings); pnpm build:resume-all renders both PDFs with the new ordering and no "undefined". --- AGENTS.md | 5 +- docs/design/specs/ui/spec-ui-experience.md | 183 ++++++++--- docs/design/specs/v3/spec-v3-typography.md | 29 +- scripts/generate-resume.ts | 2 +- src/App.css | 360 +++++++++++++++++---- src/components/sections/About.tsx | 56 ++-- src/components/sections/Experience.tsx | 70 ++-- src/data/experience.ts | 127 ++++---- src/i18n/strings.ts | 5 + src/index.css | 1 + src/pages/AboutPage.tsx | 58 ++-- src/pages/ExperiencePage.tsx | 52 ++- src/pages/PhilosophyPage.tsx | 2 +- src/types/index.ts | 1 + 14 files changed, 609 insertions(+), 342 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 577af1b..1e81e1a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -121,9 +121,10 @@ docker-compose.yaml ## Typography -- Scale tokens in `src/index.css`: `--text-body: 18px`, `--text-lede: 20px`, `--text-meta: 15px`, `--leading-body: 1.65`, `--measure-prose: 600px` +- Scale tokens in `src/index.css`: `--text-body: 18px`, `--text-lede: 20px`, `--text-meta: 15px`, `--leading-body: 1.65`, `--measure-prose: 600px`, `--measure-page: 680px` - Global: `p` = `--text-body` / `--leading-body`; `h3` 21px, `h4` 18px, `h5` 16px, `h6` 15px -- Prose columns use `.prose` (measure-capped, carries paragraph + heading rhythm); a lead paragraph outside a column uses `.prose-lede`; non-prose columns use `.page-body` (700px); titles inside a column use `.subheading` +- Two measures: `.prose` (600px) for long-form narrative, `.prose-wide` (680px, body steps up to `--text-lede`) for page-length prose. A lead paragraph uses `.prose-lede` (600px), or `.prose-lede lede-wide` (680px) when it sits next to a full-width grid. Non-prose columns use `.page-body` (`--measure-page`); titles inside a column use `.subheading` +- Cards and grids take the full container width; text columns do not. `/about` and the homepage About section use `container-wide` with `.philosophy-grid` at 3 columns (2 at ≤1024px, 1 at ≤768px), the same model as `.expertise-grid` - Body copy sizes come from the tokens; 12-14px literals are reserved for chrome (tags, badges, pills, footer, duration labels) - Components MUST NOT set `fontSize` / `lineHeight` inline — use the classes above - Font stack is `system-ui`: no webfont is loaded by the SPA. The Source Sans 3 woff2 files in `public/fonts/` are consumed only by `scripts/generate-resume.ts` diff --git a/docs/design/specs/ui/spec-ui-experience.md b/docs/design/specs/ui/spec-ui-experience.md index 76bd3fe..61b2d03 100644 --- a/docs/design/specs/ui/spec-ui-experience.md +++ b/docs/design/specs/ui/spec-ui-experience.md @@ -2,7 +2,7 @@ ## Overview -Timeline hiển thị kinh nghiệm làm việc, tập trung vào achievements và impact. +Timeline hiển thị kinh nghiệm làm việc: role, company, duration/location và responsibilities. Achievements **không còn render trong SPA** (2026-10-16) — dữ liệu vẫn được `scripts/generate-resume.ts` dùng cho resume PDF. --- @@ -11,24 +11,24 @@ Timeline hiển thị kinh nghiệm làm việc, tập trung vào achievements v ``` ExperienceSection ├── SectionHeading ("Experience") -└── ExperienceTimeline - └── ExperienceEntry (×N) - ├── TimelineMarker - ├── Company/RoleHeader - │ ├── Title - │ ├── Company - │ └── Duration - ├── Responsibilities - │ └── List items - ├── FeaturedAchievement (optional) - │ ├── AchievementTitle - │ ├── Context - │ ├── TechnicalWork - │ ├── Impact (with metrics) - │ └── Tags (technologies) - └── ExpandableDetails (optional) +└── ExperienceTimeline (.timeline) + ├── ExperienceEntry (×N, newest-first) — entry có `current: true` nhận thêm class `.timeline-entry-current` + │ ├── TimelineMarker (.timeline-marker) + │ ├── TimelineHeader (.timeline-header) + │ │ ├── Title (.timeline-title) + │ │ ├── Company (.timeline-company) + │ │ └── Meta (.timeline-meta) + │ │ ├── Duration (.timeline-duration) + │ │ └── Location (.timeline-location) + │ └── Responsibilities (.timeline-responsibilities → li) + └── TldrNode (.timeline-tldr) — node chốt, luôn render sau entry cuối + ├── Diamond marker (.timeline-tldr-marker) + ├── Chip (.timeline-tldr-chip) + └── Text (.timeline-tldr-text) ``` +`FeaturedAchievement` và `ExpandableDetails` không còn trong markup SPA — xem §Featured Achievement. Node TLDR là node cuối của timeline — xem §TLDR Terminal Node. Entry mới nhất là một *status*, không phải vai trò đã qua — xem §Current Status Node. + --- ## Content Model @@ -37,11 +37,14 @@ ExperienceSection interface ExperienceEntry { id: string; title: string; + titleEn?: string; company: string; - duration: string; // e.g. "2021 – Present" + duration: string; // e.g. "Jan 2020 – Aug 2026" location?: string; responsibilities: string[]; - achievements?: FeaturedAchievement[]; + responsibilitiesEn?: string[]; + achievements?: FeaturedAchievement[]; // không còn trong data; resume vẫn render nếu có + variant?: 'current' | 'gap'; // 'current' = node đang sống, 'gap' = nghỉ giữa hai vai trò } interface FeaturedAchievement { @@ -56,26 +59,23 @@ interface FeaturedAchievement { } ``` +Text của node TLDR **không** nằm trong `experience.ts`: nó là dẫn xuất của cả timeline chứ không phải một sự kiện, nên ở `src/i18n/strings.ts` — `experience.tldr` (nhãn chip) và `experience.tldrText` (câu tóm tắt). + --- ## Layout ### Desktop -- Timeline line bên trái -- Entries bên phải timeline -- Mỗi entry: full-width card -- Featured achievement: nested card với accent border -- Metrics: highlight box (accent background, white text) -- Tags: row of pills +- Spine vẽ **theo từng node** (`.timeline-entry::before`, `left: -31px`, `bottom: -32px` bắc qua margin 32px) — không còn một đường liên tục trên `.timeline`, nên nó kết thúc đúng tại diamond của node TLDR thay vì chạy dài xuống dưới +- Gutter 36px (`padding-left`); marker 12px có tâm (x=6) nằm đúng trên tâm spine (5 + 1) +- Entry rhythm: 32px padding-bottom + 32px margin-bottom + 1px divider; node `gap` bỏ divider +- Bullet responsibilities: dot 5px (ring `--accent`, nhân `--accent-soft`), đặt tại `0.66em` để thẳng hàng x-height của dòng đầu ### Mobile -- Timeline line ẩn -- Entries: stacked cards -- Featured achievement: full-width nested card -- Metrics: inline highlight -- Tags: wrap pills +- ≤768px: spine và marker **được giữ** (trước đây bị ẩn) — gutter giảm còn 28px, marker `left: -28px` +- Entry rhythm giảm còn 24px --- @@ -83,19 +83,78 @@ interface FeaturedAchievement { | Variant | Style | |---|---| -| Default | Circle, accent color, 12px diameter | -| Active (current role) | Circle, accent fill, 14px diameter | -| Completed | Circle, accent outline, 12px diameter | +| Current node (`variant: 'current'`) | 12px, `--accent` fill + `--accent` ring + pulse `timeline-status-pulse` (spread 0 → 10px `--accent-glow`) | +| Gap node (`variant: 'gap'`) | **10px**, `--border-strong` ring, `--bg-primary` fill — nhỏ hơn một bậc, không accent | +| Other entries | 12px, `--border-strong` ring, `--bg-primary` fill | +| Hover | Ring chuyển sang `--accent` | + +--- + +## Current Status Node + +Entry có `variant: 'current'` trong `experience.ts`: node "bây giờ". Nó dùng **cùng họ panel với node TLDR** — flat surface, hairline border, radius, whisper shadow — và khác đúng hai chỗ: cạnh trái accent và marker pulse. + +| Phần | Style | +|---|---| +| Marker | fill `--accent`, border `--accent`, `animation: timeline-status-pulse 2.4s ease-out infinite` (spread 0 → 10px `--accent-glow`, cùng idiom `.greeting-dot` của hero). Mobile đổi `animation-name` sang `timeline-status-pulse-sm` (spread 0 → 6px) | +| Panel | Entry có padding thật `16px 18px 20px` (desktop) / `14px 16px 18px` (mobile) và **bỏ divider riêng** (`border-bottom: none`); `.timeline-entry-current::after` inset `-10px -10px -10px -8px` (desktop) / `-8px -8px -8px -4px` (mobile), `--bg-surface`, `1px solid --border` + `border-left: 2px solid --accent`, radius `--radius-lg`, shadow `inset 0 1px 0 --inset-highlight, 0 8px 20px -18px --shadow`, `z-index: -1` | +| Stacking | `isolation: isolate` trên entry — panel nằm **sau** text, bullet và đoạn spine của chính entry nhưng **trước** background của section | +| Trigger | `variant?: 'current' \| 'gap'` trong `ExperienceEntry`, class ghép `timeline-entry-${variant}` trong JSX — không hard-code `exp.id` | + +Không có va chạm marker–panel và không có chữ sát viền: + +| | Gutter | Border trái panel | Vòng pulse ngoài cùng | Chữ bắt đầu | Hở pulse | Hở chữ | +|---|---|---|---|---|---|---| +| Desktop | 36 | 36 − 8 = **28–30** | marker 0–12 + spread 10 = 22 | 36 + 18 = **54** | 6px | 24px | +| Mobile | 28 | 28 − 4 = **24–26** | marker 0–12 + spread 6 = 18 | 28 + 16 = **44** | 6px | 18px | + +Spine ở x 5–7 nằm ngoài panel. `prefers-reduced-motion` toàn cục (`index.css:275`) flatten pulse về static, marker vẫn giữ halo của rule `:first-child`. + +--- + +## Gap Node (Career Break) + +Entry có `variant: 'gap'` — khoảng nghỉ giữa hai vai trò. Mục tiêu hình ảnh: **đọc ra là một khoảng trống**, không phải một công việc. + +| Phần | Style | +|---|---| +| Spine | `.timeline-entry-gap::before` đổi sang `repeating-linear-gradient` — gạch 4px, hở 5px, màu `--border-strong`; chạy suốt chiều cao node rồi bắc qua margin 32px sang node kế tiếp | +| Marker | 10px ring `--border-strong`, nhân `--bg-primary`; `left: -35px` desktop (tâm = 36 − 35 + 5 = 6, vẫn đúng trên spine), `-27px` mobile (28 − 27 + 5 = 6) | +| Divider | bỏ (`border-bottom: none`) — đường gạch nối thẳng sang node kế | +| Title | `--text-muted` + `font-style: italic` | +| Company | `--text-muted` | + +Không có accent, không có bed, không có pulse: node gap nhỏ hơn và mờ hơn mọi node việc. `:first-child` fill vẫn tồn tại trong CSS nhưng `.timeline-entry-gap .timeline-marker` đứng sau trong nguồn và có cùng specificity → gap thắng nếu một ngày node gap là node đầu. + +--- + +## TLDR Terminal Node + +Node cuối, luôn có, không đến từ `experiences`: toàn bộ timeline được gói lại trong một câu. + +Intent: tĩnh và lặng. Không gradient, không viền accent đậm, không quầng mạnh. Accent chỉ nằm ở ba chỗ: diamond trên spine, link hairline và chip. + +| Phần | Style | +|---|---| +| Marker | 12px square `rotate(45deg)` → diamond **ruột rỗng**: border 2px `--accent`, nhân `--bg-primary` (che luôn đoạn stub spine đi sau), halo `0 0 0 3px --accent-soft`; tâm vẫn nằm đúng trên spine (x=6) | +| Stub | `.timeline-tldr::before` 2px × 22px nối đoạn spine cuối xuống tâm diamond | +| Link | `.timeline-tldr::after` **1px** accent ngang 24px, từ diamond vào border panel; vẽ đè lên diamond nên khớp nối liền một màu | +| Panel | `--bg-surface` phẳng (không gradient), border 1px `--border`, radius `--radius-lg`, `inset 0 1px 0 --inset-highlight` + `0 8px 20px -18px --shadow` | +| Chip | mono 12px, `letter-spacing: 2px`, uppercase, `--accent`, **không** nền, không khung — cùng giọng với `.section-tag` | +| Text | `var(--text-lede)` 20px / 1.55; không khai báo màu → kế thừa `p` toàn cục (`--text-secondary`), giống mọi lede khác trong site | + +Cột text: 636px (homepage: `.page-body` 680 − gutter 36 − padding 2×24) → ~74 ký tự/dòng; 668px trên `/experience` (752 − 36 − 48) → ~78 ký tự/dòng. Cả hai trong band 45–80. --- ## Featured Achievement -| Variant | Style | +| Scope | Status | |---|---| -| Default | Accent left border (4px), padding, subtle bg | -| Metrics | Accent bg, white text, bold | -| Tags | Pill style, muted bg, muted text | +| SPA (`/experience` + homepage Experience) | **Removed 2026-10-16.** `.achievement`, `.achievement-title`, `.achievement-context`, `.achievement-impact`, `.achievement-metrics`, `.achievement-techs` deleted from `src/App.css`. | +| Resume PDF | Unchanged — `scripts/generate-resume.ts:100-115` and `public/resume-template.html:127-181` still render achievements. | +| Data / types | `achievements` in `src/data/experience.ts` and `FeaturedAchievement` in `src/types/index.ts` kept: the resume generator consumes them. | +| `.achievement-metric` | Kept — still used by `Projects.tsx:75` and `ProjectDetailPage.tsx:47`. | --- @@ -103,19 +162,19 @@ interface FeaturedAchievement { | Element | Size | Weight | |---|---|---| -| Section heading (H2) | 40px / 32px mobile | 600 | +| Section heading (H2) | `clamp(24px, 4vw, 40px)` | 600 | | Role title | 20px | 600 | | Company | 16px | 400 | -| Duration | 14px | 400 | -| Responsibility | 14px | 400 | -| Achievement title | 18px | 500 | -| Impact metric | 16px | 600 | +| Duration / Location | 14px (chrome) | 400 | +| Responsibility | `var(--text-meta)` 15px / `var(--leading-body)` 1.65 | 400 | + +Achievement title 18px and metric 14px/600 no longer appear on this section; `.achievement-metric` is chrome on the projects pages. --- ## Accessibility -- H2 section, H3 entry titles +- H2 section; entry titles hiện render bằng `div`, chưa phải `h3` - Semantic `