mirror of
https://github.com/dong-nz/cv.git
synced 2026-11-22 16:10:40 +07:00
support multi languages
This commit is contained in:
1 parent
ca8ff2f983
commit
72a832c781
24 files changed
+995
-175
No files matched your search
@@ -0,0 +1,600 @@
|
|||||||
|
# Specification - v3 i18n (Multi-language)
|
||||||
|
|
||||||
|
> **Parent:** `spec-v2.md`
|
||||||
|
> **Status:** Phase 1 Complete — awaiting Phase 2
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
Add full English/Vietnamese bilingual support to the portfolio. Users can toggle between languages; the choice persists via localStorage. All user-facing text switches dynamically without page reload.
|
||||||
|
|
||||||
|
## Architecture Philosophy
|
||||||
|
|
||||||
|
**Content lives in data, not in layout.** Every user-facing string must be defined in a centralized module — never hardcoded in JSX. This ensures:
|
||||||
|
|
||||||
|
1. **Phase 1 (frontend):** All strings in `src/i18n/strings.ts`, consumed via `useLanguage()` hook
|
||||||
|
2. **Phase 2 (backend):** Replace `src/i18n/strings.ts` with API calls — zero component changes
|
||||||
|
3. **Future-proof:** Adding a new language requires only updating the strings module and data layer, not touching components
|
||||||
|
|
||||||
|
|
||||||
|
## Implementation Progress
|
||||||
|
|
||||||
|
| # | Task | Phase | Status |
|
||||||
|
|---|------|-------|--------|
|
||||||
|
| 1 | Create `src/i18n/strings.ts` (centralized UI strings) | 1 | ✅ Completed |
|
||||||
|
| 2 | Create `src/hooks/useLanguage.ts` (context + hook) | 1 | ✅ Completed |
|
||||||
|
| 3 | Create `src/i18n/useField.ts` (bilingual data helpers) | 1 | ✅ Completed |
|
||||||
|
| 4 | Wrap App with `LanguageProvider` | 1 | ✅ Completed |
|
||||||
|
| 5 | Update `Navigation.tsx` (nav items + toggle button) | 1 | ✅ Completed |
|
||||||
|
| 6 | Update `Footer.tsx` (labels + copyright) | 1 | ✅ Completed |
|
||||||
|
| 7 | Update `Hero.tsx` (greeting, CTA, scroll, tagline) | 1 | ✅ Completed |
|
||||||
|
| 8 | Update `About.tsx` (headings, bio) | 1 | ✅ Completed |
|
||||||
|
| 9 | Update `Expertise.tsx` (section heading) | 1 | ✅ Completed |
|
||||||
|
| 10 | Update `Experience.tsx` (heading, responsibilities, achievements) | 1 | ✅ Completed |
|
||||||
|
| 11 | Update `Projects.tsx` (headings, categories, summary) | 1 | ✅ Completed |
|
||||||
|
| 12 | Update `Contact.tsx` (section heading) | 1 | ✅ Completed |
|
||||||
|
| 13 | Update `AboutPage.tsx` (headings, subtitle, expertise) | 1 | ✅ Completed |
|
||||||
|
| 14 | Update `ExperiencePage.tsx` (heading, responsibilities, achievements) | 1 | ✅ Completed |
|
||||||
|
| 15 | Update `ProjectsListPage.tsx` (heading, categories, view details) | 1 | ✅ Completed |
|
||||||
|
| 16 | Update `ProjectDetailPage.tsx` (categories, back link, headers) | 1 | ✅ Completed |
|
||||||
|
| 17 | Update `EngineeringPage.tsx` (heading, categories, coming soon) | 1 | ✅ Completed |
|
||||||
|
| 18 | Update `ContactPage.tsx` (heading, labels) | 1 | ✅ Completed |
|
||||||
|
| 19 | Update `profile.ts` (fix tagline to VI) | 1 | ✅ Completed |
|
||||||
|
| 20 | Update `skills.ts` (add `titleEn` to skillGroups) | 1 | ✅ Completed |
|
||||||
|
| 21 | Add `.lang-toggle` CSS styles | 1 | ✅ Completed |
|
||||||
|
| 22 | **Phase 1 Complete** | | ✅ Completed |
|
||||||
|
| 23 | Create `src/i18n/useLocaleData.ts` (API fetch + fallback) | 2 | ⬜ Pending |
|
||||||
|
| 24 | Update all components to use `useLocaleData()` | 2 | ⬜ Pending |
|
||||||
|
| 25 | Remove `src/i18n/strings.ts` | 2 | ⬜ Pending |
|
||||||
|
| 26 | Remove `src/i18n/useField.ts` | 2 | ⬜ Pending |
|
||||||
|
| 27 | **Phase 2 Complete** | | ⬜ Pending |
|
||||||
|
|
||||||
|
## Current State Analysis
|
||||||
|
|
||||||
|
### Data Layer — `src/data/`
|
||||||
|
|
||||||
|
| File | Bilingual Fields | Status |
|
||||||
|
|------|-----------------|--------|
|
||||||
|
| `profile.ts` | `bio`, `bioEn`, `tagline`, `taglineEn`, `philosophy[].title`, `titleEn`, `description`, `descriptionEn` | ✅ Ready |
|
||||||
|
| `skills.ts` | `skillGroups[].title`, `titleEn` (added) | ✅ Ready |
|
||||||
|
| `experience.ts` | `title`, `titleEn`, `responsibilities`, `responsibilitiesEn`, `achievements[].title`, `titleEn`, `context`, `contextEn`, `impact`, `impactEn` | ✅ Ready |
|
||||||
|
| `projects.ts` | `title`, `titleEn`, `summary`, `summaryEn`, `sections[].title`, `titleEn`, `content`, `contentEn` | ✅ Ready |
|
||||||
|
| `resume.ts` | `resumeLanguages: ['en', 'vi']` | ✅ Already working |
|
||||||
|
|
||||||
|
**Data pattern:** Primary fields = Vietnamese, `*En` fields = English. Some `*En` fields are redundant (identical to primary).
|
||||||
|
|
||||||
|
### Layout Layer — Hardcoded Strings (✅ Resolved)
|
||||||
|
|
||||||
|
All previously hardcoded strings have been migrated to `src/i18n/strings.ts`:
|
||||||
|
|
||||||
|
| Component | Strings Migrated |
|
||||||
|
|-----------|-----------------|
|
||||||
|
| `Navigation.tsx` | Nav items + toggle button |
|
||||||
|
| `Footer.tsx` | Footer links + copyright |
|
||||||
|
| `Hero.tsx` | greeting, CTA, scroll, resume download |
|
||||||
|
| `About.tsx` | headings, bio |
|
||||||
|
| `AboutPage.tsx` | headings, subtitle, expertise |
|
||||||
|
| `Expertise.tsx` | section heading |
|
||||||
|
| `Experience.tsx` | heading, responsibilities, achievements |
|
||||||
|
| `ExperiencePage.tsx` | heading, responsibilities, achievements |
|
||||||
|
| `Projects.tsx` | headings, categories, summary |
|
||||||
|
| `ProjectsListPage.tsx` | heading, categories, view details |
|
||||||
|
| `ProjectDetailPage.tsx` | categories, back link, headers |
|
||||||
|
| `EngineeringPage.tsx` | heading, categories, coming soon |
|
||||||
|
| `Contact.tsx` | heading, social labels |
|
||||||
|
| `ContactPage.tsx` | heading, labels |
|
||||||
|
| `Layout.tsx` | skip link |
|
||||||
|
| `DownloadResume.tsx` | download button text |
|
||||||
|
|
||||||
|
### Remaining — Non-UI Fields (No Translation Needed)
|
||||||
|
|
||||||
|
The following data fields are technical terms or professional titles that should remain in English only:
|
||||||
|
|
||||||
|
| Field | Reason |
|
||||||
|
|-------|--------|
|
||||||
|
| `skills.ts` → `skillGroups[].skills` | Technical terms (Java, Docker, CI/CD) |
|
||||||
|
| `profile.ts` → `keywords` | Technical terms |
|
||||||
|
| `profile.ts` → `currentInterests` | Technical terms |
|
||||||
|
| `profile.ts` → `roles` | Professional titles |
|
||||||
|
| `experience.ts` → `company`, `duration`, `location`, `technologies` | Metadata |
|
||||||
|
| `projects.ts` → `role`, `technologies`, `metrics` | Technical metadata |
|
||||||
|
|
||||||
|
### Accessibility Labels (No Translation Needed)
|
||||||
|
|
||||||
|
| Label | Reason |
|
||||||
|
|-------|--------|
|
||||||
|
| `aria-label` on nav, sections | Structural identifiers, not user-facing |
|
||||||
|
| `skipLink` | ✅ Translated via `strings.common.skipLink` |
|
||||||
|
| Social link aria-labels | ✅ Translated via `strings.common.socialAriaLabels` |
|
||||||
|
|
||||||
|
## Bilingual Data Pattern
|
||||||
|
|
||||||
|
Data layer uses a consistent pattern: **primary fields = Vietnamese, `*En` fields = English**. Components use `useLanguage()` hook to select the right field.
|
||||||
|
|
||||||
|
### Pattern: `getField(lang, value, valueEn)`
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// In components:
|
||||||
|
const { lang } = useLanguage()
|
||||||
|
// Instead of: profile.bio
|
||||||
|
// Use: getField(lang, profile.bio, profile.bioEn!)
|
||||||
|
|
||||||
|
// Or via hook:
|
||||||
|
const { field } = useLanguage()
|
||||||
|
const bio = field(profile.bio, profile.bioEn)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Field Mapping by Module
|
||||||
|
|
||||||
|
| Module | Field | Vietnamese | English | Status |
|
||||||
|
|--------|-------|-----------|---------|--------|
|
||||||
|
| `profile.ts` | `bio` | ✅ | `bioEn` ✅ | Ready |
|
||||||
|
| `profile.ts` | `tagline` | ✅ (updated) | `taglineEn` ✅ | Ready |
|
||||||
|
| `profile.ts` | `philosophy[].title` | ✅ | `titleEn` ✅ | Ready |
|
||||||
|
| `profile.ts` | `philosophy[].description` | ✅ | `descriptionEn` ✅ | Ready |
|
||||||
|
| `profile.ts` | `philosophy[].keywords` | — | — | English only (no translation) |
|
||||||
|
| `profile.ts` | `currentInterests` | — | — | English only (technical terms) |
|
||||||
|
| `profile.ts` | `roles` | — | — | English only (professional titles) |
|
||||||
|
| `skills.ts` | `skillGroups[].title` | ✅ | `titleEn` ✅ | ✅ Ready |
|
||||||
|
| `skills.ts` | `skillGroups[].skills` | — | — | English only (technical terms) |
|
||||||
|
| `experience.ts` | `title` | ✅ | `titleEn` ✅ | Ready |
|
||||||
|
| `experience.ts` | `responsibilities` | ✅ | `responsibilitiesEn` ✅ | Ready |
|
||||||
|
| `experience.ts` | `context` | ✅ | `contextEn` ✅ | Ready |
|
||||||
|
| `experience.ts` | `impact` | ✅ | `impactEn` ✅ | Ready |
|
||||||
|
| `experience.ts` | `technicalWork` | — | — | English only |
|
||||||
|
| `experience.ts` | `company` | — | — | English only |
|
||||||
|
| `experience.ts` | `duration` | — | — | English only |
|
||||||
|
| `experience.ts` | `location` | — | — | English only |
|
||||||
|
| `experience.ts` | `metrics` | — | — | English only |
|
||||||
|
| `experience.ts` | `technologies` | — | — | English only |
|
||||||
|
| `projects.ts` | `title` | ✅ | `titleEn` ✅ | Ready |
|
||||||
|
| `projects.ts` | `summary` | ✅ | `summaryEn` ✅ | Ready |
|
||||||
|
| `projects.ts` | `sections[].title` | ✅ | `titleEn` ✅ | Ready |
|
||||||
|
| `projects.ts` | `sections[].content` | ✅ | `contentEn` ✅ | Ready |
|
||||||
|
| `projects.ts` | `role` | — | — | English only |
|
||||||
|
| `projects.ts` | `technologies` | — | — | English only |
|
||||||
|
| `projects.ts` | `metrics` | — | — | English only |
|
||||||
|
|
||||||
|
### Fields That Don't Need Translation
|
||||||
|
|
||||||
|
These fields are already in English or are technical terms that don't change by language:
|
||||||
|
|
||||||
|
- **Professional titles:** `roles`, `title` (same in both languages)
|
||||||
|
- **Technical terms:** `skills`, `technologies`, `metrics`, `keywords`, `technicalWork`
|
||||||
|
- **Metadata:** `company`, `duration`, `location`
|
||||||
|
- **Names:** `firstName`, `lastName`, `name`
|
||||||
|
|
||||||
|
### Implementation: `src/i18n/useField.ts`
|
||||||
|
|
||||||
|
A helper hook to select the right field based on language:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// src/i18n/useField.ts
|
||||||
|
import { useLanguage } from './useLanguage'
|
||||||
|
|
||||||
|
export function useField<T>(value: T, valueEn: T | undefined): T {
|
||||||
|
const { lang } = useLanguage()
|
||||||
|
return lang === 'vi' ? value : (valueEn ?? value)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Array support (e.g., responsibilities, technicalWork):
|
||||||
|
export function useFieldArray<T>(value: T[], valueEn: T[] | undefined): T[] {
|
||||||
|
const { lang } = useLanguage()
|
||||||
|
return lang === 'vi' ? value : (valueEn ?? value)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Usage in components:
|
||||||
|
const bio = useField(profile.bio, profile.bioEn)
|
||||||
|
const title = useField(experience.title, experience.titleEn)
|
||||||
|
const summary = useField(project.summary, project.summaryEn)
|
||||||
|
const responsibilities = useFieldArray(exp.responsibilities, exp.responsibilitiesEn)
|
||||||
|
const context = useField(achievement.context, achievement.contextEn)
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Solution: Centralized Strings Module
|
||||||
|
|
||||||
|
### Phase 1: `src/i18n/strings.ts` — Frontend i18n
|
||||||
|
|
||||||
|
All UI strings collected in one typed module:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// src/i18n/strings.ts
|
||||||
|
export const strings = {
|
||||||
|
nav: {
|
||||||
|
home: { en: 'Home', vi: 'Trang chủ' },
|
||||||
|
about: { en: 'About', vi: 'Giới thiệu' },
|
||||||
|
experience: { en: 'Experience', vi: 'Kinh nghiệm' },
|
||||||
|
projects: { en: 'Projects', vi: 'Dự án' },
|
||||||
|
engineering: { en: 'Engineering', vi: 'Kỹ sư' },
|
||||||
|
contact: { en: 'Contact', vi: 'Liên hệ' },
|
||||||
|
},
|
||||||
|
footer: {
|
||||||
|
copyright: { en: 'All rights reserved', vi: 'Bảo lưu mọi quyền' },
|
||||||
|
links: {
|
||||||
|
home: { en: 'Home', vi: 'Trang chủ' },
|
||||||
|
about: { en: 'About', vi: 'Giới thiệu' },
|
||||||
|
projects: { en: 'Projects', vi: 'Dự án' },
|
||||||
|
contact: { en: 'Contact', vi: 'Liên hệ' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
hero: {
|
||||||
|
greeting: { en: "Hi, I'm", vi: 'Xin chào, tôi là' },
|
||||||
|
ctaProjects: { en: 'View Projects', vi: 'Xem dự án' },
|
||||||
|
ctaContact: { en: 'Contact Me', vi: 'Liên hệ' },
|
||||||
|
downloadResume: { en: 'Download Resume', vi: 'Tải CV' },
|
||||||
|
scroll: { en: 'Scroll', vi: 'Cuộn' },
|
||||||
|
},
|
||||||
|
about: {
|
||||||
|
heading: { en: 'About Me', vi: 'Giới thiệu' },
|
||||||
|
subtitle: { en: 'Senior Software Engineer with deep expertise in distributed systems, logistics technology, and practical AI applications.', vi: '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.' },
|
||||||
|
engineeringTitle: { en: 'How I Think About Engineering', vi: 'Cách tôi tư duy về kỹ thuật' },
|
||||||
|
exploringTitle: { en: "What I'm Exploring", vi: 'Những điều tôi đang tìm hiểu' },
|
||||||
|
exploringTitlePage: { en: "What I'm Currently Exploring", vi: 'Những điều tôi đang tìm hiểu' },
|
||||||
|
expertise: { en: 'Core Expertise', vi: 'Chuyên môn' },
|
||||||
|
},
|
||||||
|
expertise: {
|
||||||
|
heading: { en: 'Core Expertise', vi: 'Chuyên môn' },
|
||||||
|
},
|
||||||
|
experience: {
|
||||||
|
heading: { en: 'Experience', vi: 'Kinh nghiệm' },
|
||||||
|
},
|
||||||
|
projects: {
|
||||||
|
featured: { en: 'Featured Projects', vi: 'Dự án nổi bật' },
|
||||||
|
all: { en: 'Projects', vi: 'Dự án' },
|
||||||
|
viewAll: { en: 'View All', vi: 'Xem tất cả' },
|
||||||
|
viewDetails: { en: 'View Details', vi: 'Xem chi tiết' },
|
||||||
|
categories: {
|
||||||
|
'software-engineering': { en: 'Software Engineering', vi: 'Kỹ thuật phần mềm' },
|
||||||
|
logistics: { en: 'Logistics', vi: 'Logistics' },
|
||||||
|
'ai-ml': { en: 'AI / ML', vi: 'AI / ML' },
|
||||||
|
'computer-vision': { en: 'Computer Vision', vi: 'Computer Vision' },
|
||||||
|
architecture: { en: 'Architecture', vi: 'Kiến trúc' },
|
||||||
|
experiment: { en: 'Experiment', vi: 'Thử nghiệm' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
contact: {
|
||||||
|
heading: { en: 'Contact', vi: 'Liên hệ' },
|
||||||
|
email: { en: 'Email', vi: 'Email' },
|
||||||
|
github: { en: 'GitHub', vi: 'GitHub' },
|
||||||
|
linkedin: { en: 'LinkedIn', vi: 'LinkedIn' },
|
||||||
|
},
|
||||||
|
projectDetail: {
|
||||||
|
notFound: { en: 'Project Not Found', vi: 'Không tìm thấy dự án' },
|
||||||
|
backToProjects: { en: 'Back to Projects', vi: 'Quay lại dự án' },
|
||||||
|
impact: { en: 'Impact', vi: 'Tác động' },
|
||||||
|
role: { en: 'Role', vi: 'Vai trò' },
|
||||||
|
technologies: { en: 'Technologies', vi: 'Công nghệ' },
|
||||||
|
experiments: { en: 'Engineering Experiments', vi: 'Thí nghiệm kỹ thuật' },
|
||||||
|
},
|
||||||
|
engineering: {
|
||||||
|
heading: { en: 'Engineering', vi: 'Kỹ sư' },
|
||||||
|
categories: {
|
||||||
|
architecture: { en: 'Architecture', vi: 'Kiến trúc' },
|
||||||
|
ai_ml: { en: 'AI / ML', vi: 'AI / ML' },
|
||||||
|
experiments: { en: 'Experiments', vi: 'Thử nghiệm' },
|
||||||
|
},
|
||||||
|
comingSoon: { en: 'Content coming soon. This section will showcase deep technical exploration in %s.', vi: 'Nội dung sắp ra mắt. Phần này sẽ giới thiệu các khám phá kỹ thuật chuyên sâu về %s.' },
|
||||||
|
},
|
||||||
|
common: {
|
||||||
|
backTo: { en: 'Back to %s', vi: 'Quay lại %s' },
|
||||||
|
skipLink: { en: 'Skip to content', vi: 'Bỏ qua nội dung' },
|
||||||
|
resumeDownload: { en: 'Download Resume', vi: 'Tải CV' },
|
||||||
|
socialAriaLabels: {
|
||||||
|
github: { en: 'View GitHub profile', vi: 'Xem hồ sơ GitHub' },
|
||||||
|
linkedin: { en: 'View LinkedIn profile', vi: 'Xem hồ sơ LinkedIn' },
|
||||||
|
email: { en: 'Send email', vi: 'Gửi email' },
|
||||||
|
},
|
||||||
|
contactTag: { en: 'Contact', vi: 'Liên hệ' },
|
||||||
|
experienceTag: { en: 'Experience', vi: 'Kinh nghiệm' },
|
||||||
|
},
|
||||||
|
} as const
|
||||||
|
```
|
||||||
|
|
||||||
|
**Usage pattern:**
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
const { lang } = useLanguage()
|
||||||
|
// Access: strings.nav.home[lang] → 'Home' or 'Trang chủ'
|
||||||
|
```
|
||||||
|
|
||||||
|
### Arrow Convention
|
||||||
|
|
||||||
|
Text strings MUST NOT contain arrow characters (←, →). Arrows are rendered as SVG icons in components, not translated.
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
// Component code (NOT in strings.ts):
|
||||||
|
<Link to="/projects">
|
||||||
|
<ArrowLeftIcon />
|
||||||
|
<span>{strings.projectDetail.backToProjects[lang]}</span>
|
||||||
|
</Link>
|
||||||
|
|
||||||
|
// View Details with right arrow icon:
|
||||||
|
<span>
|
||||||
|
{strings.projects.viewDetails[lang]}
|
||||||
|
<ArrowRightIcon />
|
||||||
|
</span>
|
||||||
|
```
|
||||||
|
|
||||||
|
**Rationale:** Arrow direction is language-independent. Text-only translations keep strings clean and translatable.
|
||||||
|
|
||||||
|
### Social Links Aria-Labels (Accessibility)
|
||||||
|
|
||||||
|
Social link `aria-label` attributes in `Footer.tsx` and `Contact.tsx` should use `strings.common.socialAriaLabels`:
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
// Footer.tsx / Contact.tsx:
|
||||||
|
<a href={profile.githubUrl} aria-label={strings.common.socialAriaLabels.github[lang]}>
|
||||||
|
<svg>...</svg>
|
||||||
|
</a>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Skip Link (Accessibility)
|
||||||
|
|
||||||
|
The "Skip to content" link in `Layout.tsx` should use `strings.common.skipLink`:
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
// Layout.tsx:
|
||||||
|
<a href="#main-content" className="skip-link">
|
||||||
|
{strings.common.skipLink[lang]}
|
||||||
|
</a>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Section Tags (Accessibility)
|
||||||
|
|
||||||
|
Section `tag` props in `SectionHeading` should use `strings.common.contactTag` and `strings.common.experienceTag`:
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
// Contact.tsx / ContactPage.tsx:
|
||||||
|
<SectionHeading title={strings.contact.heading[lang]} tag={`06 - ${strings.common.contactTag[lang]}`} />
|
||||||
|
|
||||||
|
// ExperiencePage.tsx:
|
||||||
|
<SectionHeading title={strings.experience.heading[lang]} tag={`03 - ${strings.common.experienceTag[lang]}`} />
|
||||||
|
```
|
||||||
|
|
||||||
|
### Download Resume Button
|
||||||
|
|
||||||
|
The "Download Resume" text in `Hero.tsx`'s `HeroDownloadDropdown` and `DownloadResume.tsx` should use `strings.common.resumeDownload`:
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
// Hero.tsx / DownloadResume.tsx:
|
||||||
|
<span>{strings.common.resumeDownload[lang]}</span>
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 2: Backend i18n
|
||||||
|
|
||||||
|
### `src/i18n/useLocaleData.ts` — API Integration
|
||||||
|
|
||||||
|
Replace static `strings.ts` with dynamic API calls:
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// src/i18n/useLocaleData.ts
|
||||||
|
import { useLanguage } from './useLanguage'
|
||||||
|
|
||||||
|
// Fetch locale data from API
|
||||||
|
async function fetchLocaleData(lang: Language): Promise<LocaleData> {
|
||||||
|
const response = await fetch(`/api/locales/${lang}`)
|
||||||
|
return response.json()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hook that manages locale data loading
|
||||||
|
export function useLocaleData() {
|
||||||
|
const { lang } = useLanguage()
|
||||||
|
const [data, setData] = useState<LocaleData | null>(null)
|
||||||
|
const [loading, setLoading] = useState(true)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setLoading(true)
|
||||||
|
fetchLocaleData(lang)
|
||||||
|
.then(setData)
|
||||||
|
.catch(() => {
|
||||||
|
// Fallback to static strings
|
||||||
|
import('./strings')
|
||||||
|
.then(module => setData(module.default))
|
||||||
|
.finally(() => setLoading(false))
|
||||||
|
})
|
||||||
|
}, [lang])
|
||||||
|
|
||||||
|
return { data, loading }
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Migration Strategy
|
||||||
|
|
||||||
|
1. Create `useLocaleData.ts` with API fetch + `strings.ts` fallback
|
||||||
|
2. Update all components to use `useLocaleData()` instead of `strings`
|
||||||
|
3. Remove `strings.ts` (no more static strings)
|
||||||
|
4. Remove `useField.ts` (API returns properly structured data)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## CSS
|
||||||
|
|
||||||
|
### Language Toggle Button
|
||||||
|
|
||||||
|
```css
|
||||||
|
/* src/index.css */
|
||||||
|
.lang-toggle {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 4px;
|
||||||
|
padding: 6px 10px;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 6px;
|
||||||
|
background: var(--bg-surface);
|
||||||
|
color: var(--text-primary);
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lang-toggle:hover {
|
||||||
|
border-color: var(--accent);
|
||||||
|
color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.lang-toggle .lang-label {
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lang-toggle .lang-icon {
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Checklist
|
||||||
|
|
||||||
|
- [x] Phase 1: Frontend i18n complete
|
||||||
|
- [ ] Phase 2: Backend i18n with API
|
||||||
|
- [ ] Testing: Verify all strings render correctly in both languages
|
||||||
|
- [ ] Testing: Verify language toggle persists across page navigation
|
||||||
|
- [ ] Testing: Verify language preference persists across sessions (localStorage)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Decisions
|
||||||
|
|
||||||
|
| Decision | Choice | Rationale |
|
||||||
|
|----------|--------|-----------|
|
||||||
|
| Language selection | `localStorage` key `portfolio-lang` | Consistent with existing `portfolio-theme` |
|
||||||
|
| Default language | Browser language (`navigator.language`) | No server-side detection needed |
|
||||||
|
| Fallback language | English (`en`) | Portfolio content is English-first |
|
||||||
|
| Data pattern | Primary = Vietnamese, `*En` = English | Matches existing profile/experience structure |
|
||||||
|
| Arrow characters | ❌ Not in strings | SVG icons for arrows, not translated |
|
||||||
|
| Section tags | Structural IDs, not translated | `01 - About` → `01 - Gioi thieu` (keep numbering) |
|
||||||
|
| Technical terms | English only | Skills, tools, frameworks don't need translation |
|
||||||
|
| Professional titles | English only | Industry-standard terms |
|
||||||
|
| Social link labels | ✅ Translated | Accessibility labels are user-facing |
|
||||||
|
| Skip link | ✅ Translated | Accessibility label is user-facing |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Appendix: Complete Strings Inventory
|
||||||
|
|
||||||
|
### Navigation
|
||||||
|
|
||||||
|
| Key | English | Vietnamese |
|
||||||
|
|-----|---------|-----------|
|
||||||
|
| `nav.home` | Home | Trang chủ |
|
||||||
|
| `nav.about` | About | Giới thiệu |
|
||||||
|
| `nav.experience` | Experience | Kinh nghiệm |
|
||||||
|
| `nav.projects` | Projects | Dự án |
|
||||||
|
| `nav.engineering` | Engineering | Kỹ sư |
|
||||||
|
| `nav.contact` | Contact | Liên hệ |
|
||||||
|
|
||||||
|
### Footer
|
||||||
|
|
||||||
|
| Key | English | Vietnamese |
|
||||||
|
|-----|---------|-----------|
|
||||||
|
| `footer.copyright` | All rights reserved | Bảo lưu mọi quyền |
|
||||||
|
| `footer.links.home` | Home | Trang chủ |
|
||||||
|
| `footer.links.about` | About | Giới thiệu |
|
||||||
|
| `footer.links.projects` | Projects | Dự án |
|
||||||
|
| `footer.links.contact` | Contact | Liên hệ |
|
||||||
|
|
||||||
|
### Hero
|
||||||
|
|
||||||
|
| Key | English | Vietnamese |
|
||||||
|
|-----|---------|-----------|
|
||||||
|
| `hero.greeting` | Hi, I'm | Xin chào, tôi là |
|
||||||
|
| `hero.ctaProjects` | View Projects | Xem dự án |
|
||||||
|
| `hero.ctaContact` | Contact Me | Liên hệ |
|
||||||
|
| `hero.downloadResume` | Download Resume | Tải CV |
|
||||||
|
| `hero.scroll` | Scroll | Cuộn |
|
||||||
|
|
||||||
|
### About
|
||||||
|
|
||||||
|
| Key | English | Vietnamese |
|
||||||
|
|-----|---------|-----------|
|
||||||
|
| `about.heading` | About Me | Giới thiệu |
|
||||||
|
| `about.subtitle` | Senior Software Engineer with deep expertise... | Kỹ sư phần mềm cao cấp với chuyên môn sâu... |
|
||||||
|
| `about.engineeringTitle` | How I Think About Engineering | Cách tôi tư duy về kỹ thuật |
|
||||||
|
| `about.exploringTitle` | What I'm Exploring | Những điều tôi đang tìm hiểu |
|
||||||
|
| `about.exploringTitlePage` | What I'm Currently Exploring | Những điều tôi đang tìm hiểu |
|
||||||
|
| `about.expertise` | Core Expertise | Chuyên môn |
|
||||||
|
|
||||||
|
### Expertise
|
||||||
|
|
||||||
|
| Key | English | Vietnamese |
|
||||||
|
|-----|---------|-----------|
|
||||||
|
| `expertise.heading` | Core Expertise | Chuyên môn |
|
||||||
|
|
||||||
|
### Experience
|
||||||
|
|
||||||
|
| Key | English | Vietnamese |
|
||||||
|
|-----|---------|-----------|
|
||||||
|
| `experience.heading` | Experience | Kinh nghiệm |
|
||||||
|
|
||||||
|
### Projects
|
||||||
|
|
||||||
|
| Key | English | Vietnamese |
|
||||||
|
|-----|---------|-----------|
|
||||||
|
| `projects.featured` | Featured Projects | Dự án nổi bật |
|
||||||
|
| `projects.all` | Projects | Dự án |
|
||||||
|
| `projects.viewAll` | View All | Xem tất cả |
|
||||||
|
| `projects.viewDetails` | View Details | Xem chi tiết |
|
||||||
|
| `projects.categories.software-engineering` | Software Engineering | Kỹ thuật phần mềm |
|
||||||
|
| `projects.categories.logistics` | Logistics | Logistics |
|
||||||
|
| `projects.categories.ai-ml` | AI / ML | AI / ML |
|
||||||
|
| `projects.categories.computer-vision` | Computer Vision | Computer Vision |
|
||||||
|
| `projects.categories.architecture` | Architecture | Kiến trúc |
|
||||||
|
| `projects.categories.experiment` | Experiment | Thử nghiệm |
|
||||||
|
|
||||||
|
### Contact
|
||||||
|
|
||||||
|
| Key | English | Vietnamese |
|
||||||
|
|-----|---------|-----------|
|
||||||
|
| `contact.heading` | Contact | Liên hệ |
|
||||||
|
| `contact.email` | Email | Email |
|
||||||
|
| `contact.github` | GitHub | GitHub |
|
||||||
|
| `contact.linkedin` | LinkedIn | LinkedIn |
|
||||||
|
|
||||||
|
### Project Detail
|
||||||
|
|
||||||
|
| Key | English | Vietnamese |
|
||||||
|
|-----|---------|-----------|
|
||||||
|
| `projectDetail.notFound` | Project Not Found | Không tìm thấy dự án |
|
||||||
|
| `projectDetail.backToProjects` | Back to Projects | Quay lại dự án |
|
||||||
|
| `projectDetail.impact` | Impact | Tác động |
|
||||||
|
| `projectDetail.role` | Role | Vai trò |
|
||||||
|
| `projectDetail.technologies` | Technologies | Công nghệ |
|
||||||
|
| `projectDetail.experiments` | Engineering Experiments | Thí nghiệm kỹ thuật |
|
||||||
|
|
||||||
|
### Engineering
|
||||||
|
|
||||||
|
| Key | English | Vietnamese |
|
||||||
|
|-----|---------|-----------|
|
||||||
|
| `engineering.heading` | Engineering | Kỹ sư |
|
||||||
|
| `engineering.categories.architecture` | Architecture | Kiến trúc |
|
||||||
|
| `engineering.categories.ai_ml` | AI / ML | AI / ML |
|
||||||
|
| `engineering.categories.experiments` | Experiments | Thử nghiệm |
|
||||||
|
| `engineering.comingSoon` | Content coming soon. This section will showcase deep technical exploration in %s. | Nội dung sắp ra mắt. Phần này sẽ giới thiệu các khám phá kỹ thuật chuyên sâu về %s. |
|
||||||
|
|
||||||
|
### Common
|
||||||
|
|
||||||
|
| Key | English | Vietnamese |
|
||||||
|
|-----|---------|-----------|
|
||||||
|
| `common.backTo` | Back to %s | Quay lại %s |
|
||||||
|
| `common.skipLink` | Skip to content | Bỏ qua nội dung |
|
||||||
|
| `common.resumeDownload` | Download Resume | Tải CV |
|
||||||
|
| `common.socialAriaLabels.github` | View GitHub profile | Xem hồ sơ GitHub |
|
||||||
|
| `common.socialAriaLabels.linkedin` | View LinkedIn profile | Xem hồ sơ LinkedIn |
|
||||||
|
| `common.socialAriaLabels.email` | Send email | Gửi email |
|
||||||
|
| `common.contactTag` | Contact | Liên hệ |
|
||||||
|
| `common.experienceTag` | Experience | Kinh nghiệm |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Open Questions
|
||||||
|
|
||||||
|
None remaining. All decisions made.
|
||||||
+15
-12
@@ -2,6 +2,7 @@ import './App.css'
|
|||||||
import { BrowserRouter, Routes, Route } from 'react-router'
|
import { BrowserRouter, Routes, Route } from 'react-router'
|
||||||
import { ThemeProvider } from '@/hooks/useTheme'
|
import { ThemeProvider } from '@/hooks/useTheme'
|
||||||
import { Layout } from '@/components/layout/Layout'
|
import { Layout } from '@/components/layout/Layout'
|
||||||
|
import { LanguageProvider } from '@/hooks/useLanguage'
|
||||||
import {
|
import {
|
||||||
HomePage,
|
HomePage,
|
||||||
AboutPage,
|
AboutPage,
|
||||||
@@ -14,21 +15,23 @@ import {
|
|||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
return (
|
return (
|
||||||
<ThemeProvider>
|
<BrowserRouter>
|
||||||
<BrowserRouter>
|
<ThemeProvider>
|
||||||
<Layout>
|
<LanguageProvider>
|
||||||
<Routes>
|
<Layout>
|
||||||
<Route path="/" element={<HomePage />} />
|
<Routes>
|
||||||
<Route path="/about" element={<AboutPage />} />
|
<Route path="/" element={<HomePage />} />
|
||||||
<Route path="/experience" element={<ExperiencePage />} />
|
<Route path="/about" element={<AboutPage />} />
|
||||||
<Route path="/projects" element={<ProjectsListPage />} />
|
<Route path="/experience" element={<ExperiencePage />} />
|
||||||
<Route path="/projects/:id" element={<ProjectDetailPage />} />
|
<Route path="/projects" element={<ProjectsListPage />} />
|
||||||
<Route path="/engineering" element={<EngineeringPage />} />
|
<Route path="/projects/:id" element={<ProjectDetailPage />} />
|
||||||
<Route path="/contact" element={<ContactPage />} />
|
<Route path="/engineering" element={<EngineeringPage />} />
|
||||||
|
<Route path="/contact" element={<ContactPage />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
</Layout>
|
</Layout>
|
||||||
</BrowserRouter>
|
</LanguageProvider>
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
|
</BrowserRouter>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,31 +1,32 @@
|
|||||||
import { Link } from 'react-router'
|
import { Link } from 'react-router'
|
||||||
import { profile } from '@/data/profile'
|
import { profile } from '@/data/profile'
|
||||||
|
import { useLanguage } from '@/hooks/useLanguage'
|
||||||
const footerLinks = [
|
import { strings } from '@/i18n/strings'
|
||||||
{ label: 'Home', path: '/' },
|
const footerPaths = ['/', '/about', '/projects', '/contact'] as const
|
||||||
{ label: 'About', path: '/about' },
|
|
||||||
{ label: 'Projects', path: '/projects' },
|
|
||||||
{ label: 'Contact', path: '/contact' },
|
|
||||||
]
|
|
||||||
|
|
||||||
export function Footer() {
|
export function Footer() {
|
||||||
const year = new Date().getFullYear()
|
const year = new Date().getFullYear()
|
||||||
|
const { lang } = useLanguage()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<footer className="footer" role="contentinfo">
|
<footer className="footer" role="contentinfo">
|
||||||
<div className="footer-container">
|
<div className="footer-container">
|
||||||
<p className="footer-text">
|
<p className="footer-text">
|
||||||
© {year} {profile.name}. All rights reserved.
|
© {year} {profile.name}. {strings.footer.copyright[lang]}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<ul className="footer-links">
|
<ul className="footer-links">
|
||||||
{footerLinks.map((link) => (
|
{footerPaths.map((path) => {
|
||||||
<li key={link.path}>
|
const key = path === '/' ? 'home' : path.replace('/', '') as keyof typeof strings.footer.links
|
||||||
<Link to={link.path} className="footer-link">
|
const label = strings.footer.links[key][lang]
|
||||||
{link.label}
|
return (
|
||||||
</Link>
|
<li key={path}>
|
||||||
</li>
|
<Link to={path} className="footer-link">
|
||||||
))}
|
{label}
|
||||||
|
</Link>
|
||||||
|
</li>
|
||||||
|
)
|
||||||
|
})}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div className="social-links">
|
<div className="social-links">
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import { useLanguage } from '@/hooks/useLanguage'
|
||||||
|
import { strings } from '@/i18n/strings'
|
||||||
import { Navigation } from './Navigation'
|
import { Navigation } from './Navigation'
|
||||||
import { BackToTop } from '@/components/ui/BackToTop'
|
import { BackToTop } from '@/components/ui/BackToTop'
|
||||||
import { Footer } from './Footer'
|
import { Footer } from './Footer'
|
||||||
@@ -7,10 +9,11 @@ interface LayoutProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function Layout({ children }: LayoutProps) {
|
export function Layout({ children }: LayoutProps) {
|
||||||
|
const { lang } = useLanguage()
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<a href="#main-content" className="skip-link">
|
<a href="#main-content" className="skip-link">
|
||||||
Skip to content
|
{strings.common.skipLink[lang]}
|
||||||
</a>
|
</a>
|
||||||
<Navigation />
|
<Navigation />
|
||||||
<main id="main-content" style={{ flex: 1 }}>
|
<main id="main-content" style={{ flex: 1 }}>
|
||||||
|
|||||||
@@ -1,19 +1,13 @@
|
|||||||
import { useState, useEffect } from 'react'
|
import { useState, useEffect } from 'react'
|
||||||
import { Link, useLocation } from 'react-router'
|
import { Link, useLocation } from 'react-router'
|
||||||
import { useTheme } from '@/hooks/useTheme'
|
import { useTheme } from '@/hooks/useTheme'
|
||||||
|
import { useLanguage } from '@/hooks/useLanguage'
|
||||||
|
import { strings } from '@/i18n/strings'
|
||||||
import { RollingTextLink } from '@/components/ui/RollingTextLink'
|
import { RollingTextLink } from '@/components/ui/RollingTextLink'
|
||||||
|
const navPaths = ['/', '/about', '/experience', '/projects', '/engineering', '/contact'] as const
|
||||||
const navItems = [
|
|
||||||
{ label: 'Home', path: '/' },
|
|
||||||
{ label: 'About', path: '/about' },
|
|
||||||
{ label: 'Experience', path: '/experience' },
|
|
||||||
{ label: 'Projects', path: '/projects' },
|
|
||||||
{ label: 'Engineering', path: '/engineering' },
|
|
||||||
{ label: 'Contact', path: '/contact' },
|
|
||||||
]
|
|
||||||
|
|
||||||
export function Navigation() {
|
export function Navigation() {
|
||||||
const { cycleTheme, resolvedTheme } = useTheme()
|
const { cycleTheme, resolvedTheme } = useTheme()
|
||||||
|
const { lang, toggleLang } = useLanguage()
|
||||||
const [mobileOpen, setMobileOpen] = useState(false)
|
const [mobileOpen, setMobileOpen] = useState(false)
|
||||||
const location = useLocation()
|
const location = useLocation()
|
||||||
|
|
||||||
@@ -43,16 +37,20 @@ export function Navigation() {
|
|||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
<ul className="nav-menu">
|
<ul className="nav-menu">
|
||||||
{navItems.map((item) => (
|
{navPaths.map((path) => {
|
||||||
<li key={item.path}>
|
const navKey = path === '/' ? 'home' : path.replace('/', '') as keyof typeof strings.nav
|
||||||
<RollingTextLink
|
const label = strings.nav[navKey][lang]
|
||||||
to={item.path}
|
return (
|
||||||
className={item.path === location.pathname ? 'nav-link active' : 'nav-link'}
|
<li key={path}>
|
||||||
>
|
<RollingTextLink
|
||||||
{item.label}
|
to={path}
|
||||||
</RollingTextLink>
|
className={path === location.pathname ? 'nav-link active' : 'nav-link'}
|
||||||
</li>
|
>
|
||||||
))}
|
{label}
|
||||||
|
</RollingTextLink>
|
||||||
|
</li>
|
||||||
|
)
|
||||||
|
})}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div className="nav-actions">
|
<div className="nav-actions">
|
||||||
@@ -74,6 +72,14 @@ export function Navigation() {
|
|||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
className="lang-toggle"
|
||||||
|
onClick={toggleLang}
|
||||||
|
aria-label="Switch language"
|
||||||
|
title={`Switch to ${lang === 'en' ? 'Tiếng Việt' : 'English'}`}
|
||||||
|
>
|
||||||
|
{lang === 'en' ? 'VI' : 'EN'}
|
||||||
|
</button>
|
||||||
<button
|
<button
|
||||||
className="mobile-menu-btn"
|
className="mobile-menu-btn"
|
||||||
onClick={() => setMobileOpen(!mobileOpen)}
|
onClick={() => setMobileOpen(!mobileOpen)}
|
||||||
@@ -96,17 +102,21 @@ export function Navigation() {
|
|||||||
|
|
||||||
<div className={`mobile-menu ${mobileOpen ? 'open' : ''}`} role="dialog" aria-label="Mobile navigation">
|
<div className={`mobile-menu ${mobileOpen ? 'open' : ''}`} role="dialog" aria-label="Mobile navigation">
|
||||||
<ul className="mobile-menu-list">
|
<ul className="mobile-menu-list">
|
||||||
{navItems.map((item) => (
|
{navPaths.map((path) => {
|
||||||
<li key={item.path}>
|
const navKey = path === '/' ? 'home' : path.replace('/', '') as keyof typeof strings.nav
|
||||||
<RollingTextLink
|
const label = strings.nav[navKey][lang]
|
||||||
to={item.path}
|
return (
|
||||||
className={item.path === location.pathname ? 'mobile-menu-link active' : 'mobile-menu-link'}
|
<li key={path}>
|
||||||
onClick={() => setMobileOpen(false)}
|
<RollingTextLink
|
||||||
>
|
to={path}
|
||||||
{item.label}
|
className={path === location.pathname ? 'mobile-menu-link active' : 'mobile-menu-link'}
|
||||||
</RollingTextLink>
|
onClick={() => setMobileOpen(false)}
|
||||||
</li>
|
>
|
||||||
))}
|
{label}
|
||||||
|
</RollingTextLink>
|
||||||
|
</li>
|
||||||
|
)
|
||||||
|
})}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -2,21 +2,23 @@ import { SectionHeading } from '@/components/ui/SectionHeading'
|
|||||||
import { InView } from '@/components/ui/InView'
|
import { InView } from '@/components/ui/InView'
|
||||||
import { Tag } from '@/components/ui/Tag'
|
import { Tag } from '@/components/ui/Tag'
|
||||||
import { profile } from '@/data/profile'
|
import { profile } from '@/data/profile'
|
||||||
|
import { useLanguage } from '@/hooks/useLanguage'
|
||||||
|
import { strings } from '@/i18n/strings'
|
||||||
|
import { useField } from '@/i18n/useField'
|
||||||
export function About() {
|
export function About() {
|
||||||
|
const { lang } = useLanguage()
|
||||||
return (
|
return (
|
||||||
<InView>
|
<InView>
|
||||||
<section className="section container-wide" aria-labelledby="about-heading">
|
<section className="section container-wide" aria-labelledby="about-heading">
|
||||||
<SectionHeading title="About Me" tag="01 - About" />
|
<SectionHeading title={strings.about.heading[lang]} tag="01 - About" />
|
||||||
<div style={{ maxWidth: '700px' }}>
|
<div style={{ maxWidth: '700px' }}>
|
||||||
<p style={{ fontSize: '18px', marginBottom: '32px' }}>
|
<p style={{ fontSize: '18px', marginBottom: '32px' }}>
|
||||||
{profile.bio}
|
{useField(profile.bio, profile.bioEn)}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h3 style={{ fontSize: '20px', marginBottom: '16px', color: 'var(--text-primary)' }}>
|
<h3 style={{ fontSize: '20px', marginBottom: '16px', color: 'var(--text-primary)' }}>
|
||||||
How I Think About Engineering
|
{strings.about.engineeringTitle[lang]}
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<div className="philosophy-grid">
|
<div className="philosophy-grid">
|
||||||
{profile.philosophy.map((point) => (
|
{profile.philosophy.map((point) => (
|
||||||
<div key={point.title} className="philosophy-card">
|
<div key={point.title} className="philosophy-card">
|
||||||
@@ -32,7 +34,7 @@ export function About() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h3 style={{ fontSize: '20px', marginTop: '32px', marginBottom: '12px', color: 'var(--text-primary)' }}>
|
<h3 style={{ fontSize: '20px', marginTop: '32px', marginBottom: '12px', color: 'var(--text-primary)' }}>
|
||||||
What I'm Exploring
|
{strings.about.exploringTitle[lang]}
|
||||||
</h3>
|
</h3>
|
||||||
<div className="interests-list">
|
<div className="interests-list">
|
||||||
{profile.currentInterests.map((interest) => (
|
{profile.currentInterests.map((interest) => (
|
||||||
|
|||||||
@@ -3,8 +3,10 @@ import { DownloadResume } from "@/components/sections/DownloadResume"
|
|||||||
import { SectionHeading } from "@/components/ui/SectionHeading"
|
import { SectionHeading } from "@/components/ui/SectionHeading"
|
||||||
import { profile } from "@/data/profile"
|
import { profile } from "@/data/profile"
|
||||||
import { InView } from "@/components/ui/InView"
|
import { InView } from "@/components/ui/InView"
|
||||||
|
import { useLanguage } from '@/hooks/useLanguage'
|
||||||
|
import { strings } from '@/i18n/strings'
|
||||||
export function Contact() {
|
export function Contact() {
|
||||||
|
const { lang } = useLanguage()
|
||||||
return (
|
return (
|
||||||
<InView>
|
<InView>
|
||||||
<motion.section
|
<motion.section
|
||||||
@@ -18,7 +20,7 @@ export function Contact() {
|
|||||||
visible: { opacity: 1, transition: { duration: 0.5 } },
|
visible: { opacity: 1, transition: { duration: 0.5 } },
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<SectionHeading title="Contact" tag="06 - Contact" />
|
<SectionHeading title={strings.contact.heading[lang]} tag={`06 - ${strings.common.contactTag[lang]}`} />
|
||||||
<div style={{ maxWidth: '700px' }}>
|
<div style={{ maxWidth: '700px' }}>
|
||||||
<div className="contact-links">
|
<div className="contact-links">
|
||||||
<motion.a
|
<motion.a
|
||||||
@@ -40,7 +42,7 @@ export function Contact() {
|
|||||||
</svg>
|
</svg>
|
||||||
<div>
|
<div>
|
||||||
<div style={{ fontWeight: 500, color: "var(--text-primary)" }}>
|
<div style={{ fontWeight: 500, color: "var(--text-primary)" }}>
|
||||||
Email
|
{strings.contact.email[lang]}
|
||||||
</div>
|
</div>
|
||||||
<div style={{ fontSize: "14px", color: "var(--text-muted)" }}>
|
<div style={{ fontSize: "14px", color: "var(--text-muted)" }}>
|
||||||
{profile.email}
|
{profile.email}
|
||||||
@@ -65,7 +67,7 @@ export function Contact() {
|
|||||||
</svg>
|
</svg>
|
||||||
<div>
|
<div>
|
||||||
<div style={{ fontWeight: 500, color: "var(--text-primary)" }}>
|
<div style={{ fontWeight: 500, color: "var(--text-primary)" }}>
|
||||||
GitHub
|
{strings.contact.github[lang]}
|
||||||
</div>
|
</div>
|
||||||
<div style={{ fontSize: "14px", color: "var(--text-muted)" }}>
|
<div style={{ fontSize: "14px", color: "var(--text-muted)" }}>
|
||||||
@yourusername
|
@yourusername
|
||||||
@@ -90,7 +92,7 @@ export function Contact() {
|
|||||||
</svg>
|
</svg>
|
||||||
<div>
|
<div>
|
||||||
<div style={{ fontWeight: 500, color: "var(--text-primary)" }}>
|
<div style={{ fontWeight: 500, color: "var(--text-primary)" }}>
|
||||||
LinkedIn
|
{strings.contact.linkedin[lang]}
|
||||||
</div>
|
</div>
|
||||||
<div style={{ fontSize: "14px", color: "var(--text-muted)" }}>
|
<div style={{ fontSize: "14px", color: "var(--text-muted)" }}>
|
||||||
Your Name
|
Your Name
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import { resumeAvailable, resumeUrlFor, resumeLanguages } from '@/data/resume'
|
import { resumeAvailable, resumeUrlFor, resumeLanguages } from '@/data/resume'
|
||||||
import type { Language } from '@/types'
|
import type { Language } from '@/types'
|
||||||
import { useState, useRef, useEffect } from 'react'
|
import { useState, useRef, useEffect } from 'react'
|
||||||
|
import { useLanguage } from '@/hooks/useLanguage'
|
||||||
|
import { strings } from '@/i18n/strings'
|
||||||
|
|
||||||
const langLabels: Record<Language, string> = {
|
const langLabels: Record<Language, string> = {
|
||||||
en: 'English',
|
en: 'English',
|
||||||
@@ -8,6 +10,7 @@ const langLabels: Record<Language, string> = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function DownloadButton({ lang }: { lang: Language }) {
|
function DownloadButton({ lang }: { lang: Language }) {
|
||||||
|
const { lang: currentLang } = useLanguage()
|
||||||
return (
|
return (
|
||||||
<a
|
<a
|
||||||
href={resumeUrlFor(lang)}
|
href={resumeUrlFor(lang)}
|
||||||
@@ -28,7 +31,7 @@ function DownloadButton({ lang }: { lang: Language }) {
|
|||||||
<path d="M12 2a1 1 0 0 1 1 1v9.586l2.707-2.707a1 1 0 1 1 1.414 1.414l-4.5 4.5a1 1 0 0 1-1.414 0l-4.5-4.5a1 1 0 1 1 1.414-1.414L11 12.586V3a1 1 0 0 1 1-1zm-7 16a1 1 0 1 1 0 2h14a1 1 0 1 1 0-2H5z" />
|
<path d="M12 2a1 1 0 0 1 1 1v9.586l2.707-2.707a1 1 0 1 1 1.414 1.414l-4.5 4.5a1 1 0 0 1-1.414 0l-4.5-4.5a1 1 0 1 1 1.414-1.414L11 12.586V3a1 1 0 0 1 1-1zm-7 16a1 1 0 1 1 0 2h14a1 1 0 1 1 0-2H5z" />
|
||||||
</svg>
|
</svg>
|
||||||
<div>
|
<div>
|
||||||
<div style={{ fontWeight: 500, color: 'var(--text-primary)' }}>Download Resume</div>
|
<div style={{ fontWeight: 500, color: 'var(--text-primary)' }}>{strings.common.resumeDownload[currentLang]}</div>
|
||||||
<div style={{ fontSize: '14px', color: 'var(--text-muted)' }}>{langLabels[lang]}</div>
|
<div style={{ fontSize: '14px', color: 'var(--text-muted)' }}>{langLabels[lang]}</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
@@ -36,6 +39,7 @@ function DownloadButton({ lang }: { lang: Language }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function DownloadDropdown() {
|
function DownloadDropdown() {
|
||||||
|
const { lang } = useLanguage()
|
||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
const ref = useRef<HTMLDivElement>(null)
|
const ref = useRef<HTMLDivElement>(null)
|
||||||
|
|
||||||
@@ -70,7 +74,7 @@ function DownloadDropdown() {
|
|||||||
<path d="M12 3v10m0 0l-3-3m3 3l3-3" />
|
<path d="M12 3v10m0 0l-3-3m3 3l3-3" />
|
||||||
<path d="M3 17h18" />
|
<path d="M3 17h18" />
|
||||||
</svg>
|
</svg>
|
||||||
<span>Download Resume</span>
|
<span>{strings.common.resumeDownload[lang]}</span>
|
||||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" width="16" height="16" className="chevron">
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" width="16" height="16" className="chevron">
|
||||||
<polyline points="6 9 12 15 18 9" />
|
<polyline points="6 9 12 15 18 9" />
|
||||||
</svg>
|
</svg>
|
||||||
@@ -99,18 +103,11 @@ export function DownloadResume() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ marginTop: '32px' }}>
|
<div style={{ marginTop: '32px' }}>
|
||||||
{/* Desktop: dropdown */}
|
{resumeLanguages.length > 1 ? (
|
||||||
<div className="download-resume-desktop">
|
|
||||||
<DownloadDropdown />
|
<DownloadDropdown />
|
||||||
</div>
|
) : (
|
||||||
{/* Mobile: 2 buttons */}
|
<DownloadButton lang={resumeLanguages[0]} />
|
||||||
<div className="download-resume-mobile">
|
)}
|
||||||
<div style={{ display: 'flex', flexDirection: 'column', gap: '12px' }}>
|
|
||||||
{resumeLanguages.map(lang => (
|
|
||||||
<DownloadButton key={lang} lang={lang} />
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -2,8 +2,11 @@ import { SectionHeading } from '@/components/ui/SectionHeading'
|
|||||||
import { motion } from "motion/react"
|
import { motion } from "motion/react"
|
||||||
import { experiences } from "@/data/experience"
|
import { experiences } from "@/data/experience"
|
||||||
import { InView } from "@/components/ui/InView"
|
import { InView } from "@/components/ui/InView"
|
||||||
|
import { useLanguage } from '@/hooks/useLanguage'
|
||||||
|
import { strings } from '@/i18n/strings'
|
||||||
|
|
||||||
export function Experience() {
|
export function Experience() {
|
||||||
|
const { lang } = useLanguage()
|
||||||
return (
|
return (
|
||||||
<InView>
|
<InView>
|
||||||
<motion.section
|
<motion.section
|
||||||
@@ -20,7 +23,7 @@ export function Experience() {
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<SectionHeading title="Experience" tag="03 - Experience" />
|
<SectionHeading title={strings.experience.heading[lang]} tag="03 - Experience" />
|
||||||
<div style={{ maxWidth: '700px' }}>
|
<div style={{ maxWidth: '700px' }}>
|
||||||
<div className="timeline">
|
<div className="timeline">
|
||||||
{experiences.map((exp, i) => (
|
{experiences.map((exp, i) => (
|
||||||
@@ -40,7 +43,7 @@ export function Experience() {
|
|||||||
>
|
>
|
||||||
<div className="timeline-marker" />
|
<div className="timeline-marker" />
|
||||||
<div className="timeline-header">
|
<div className="timeline-header">
|
||||||
<div className="timeline-title">{exp.title}</div>
|
<div className="timeline-title">{lang === 'vi' ? exp.title : exp.titleEn}</div>
|
||||||
<div className="timeline-company">{exp.company}</div>
|
<div className="timeline-company">{exp.company}</div>
|
||||||
<div className="timeline-duration">{exp.duration}</div>
|
<div className="timeline-duration">{exp.duration}</div>
|
||||||
{exp.location && (
|
{exp.location && (
|
||||||
@@ -48,7 +51,7 @@ export function Experience() {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<ul className="timeline-responsibilities">
|
<ul className="timeline-responsibilities">
|
||||||
{exp.responsibilities.map((r) => (
|
{(lang === 'vi' ? exp.responsibilities : exp.responsibilitiesEn ?? []).map((r) => (
|
||||||
<li key={r}>{r}</li>
|
<li key={r}>{r}</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
@@ -58,7 +61,7 @@ export function Experience() {
|
|||||||
{achievement.title}
|
{achievement.title}
|
||||||
</div>
|
</div>
|
||||||
<div className="achievement-context">
|
<div className="achievement-context">
|
||||||
{achievement.context}
|
{lang === 'vi' ? achievement.context : achievement.contextEn}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
@@ -67,7 +70,7 @@ export function Experience() {
|
|||||||
marginBottom: "8px",
|
marginBottom: "8px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{achievement.impact}
|
{lang === 'vi' ? achievement.impact : achievement.impactEn}
|
||||||
</div>
|
</div>
|
||||||
{achievement.metrics &&
|
{achievement.metrics &&
|
||||||
achievement.metrics.length > 0 && (
|
achievement.metrics.length > 0 && (
|
||||||
|
|||||||
@@ -2,8 +2,11 @@ import { motion } from "motion/react"
|
|||||||
import { SectionHeading } from "@/components/ui/SectionHeading"
|
import { SectionHeading } from "@/components/ui/SectionHeading"
|
||||||
import { skillGroups } from "@/data/skills"
|
import { skillGroups } from "@/data/skills"
|
||||||
import { InView } from "@/components/ui/InView"
|
import { InView } from "@/components/ui/InView"
|
||||||
|
import { useLanguage } from '@/hooks/useLanguage'
|
||||||
|
import { strings } from '@/i18n/strings'
|
||||||
|
|
||||||
export function Expertise() {
|
export function Expertise() {
|
||||||
|
const { lang } = useLanguage()
|
||||||
return (
|
return (
|
||||||
<InView>
|
<InView>
|
||||||
<motion.section
|
<motion.section
|
||||||
@@ -20,7 +23,7 @@ export function Expertise() {
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<SectionHeading title="Core Expertise" tag="02 - Expertise" />
|
<SectionHeading title={strings.expertise.heading[lang]} tag="02 - Expertise" />
|
||||||
<div className="expertise-grid">
|
<div className="expertise-grid">
|
||||||
{skillGroups.map((group, i) => (
|
{skillGroups.map((group, i) => (
|
||||||
<motion.div
|
<motion.div
|
||||||
@@ -37,7 +40,7 @@ export function Expertise() {
|
|||||||
whileHover={{ scale: 1.05, y: -2 }}
|
whileHover={{ scale: 1.05, y: -2 }}
|
||||||
whileTap={{ scale: 0.98 }}
|
whileTap={{ scale: 0.98 }}
|
||||||
>
|
>
|
||||||
<h3>{group.title}</h3>
|
<h3>{lang === 'vi' ? group.title : group.titleEn}</h3>
|
||||||
<ul className="expertise-skills">
|
<ul className="expertise-skills">
|
||||||
{group.skills.map((skill) => (
|
{group.skills.map((skill) => (
|
||||||
<li key={skill} className="expertise-skill">
|
<li key={skill} className="expertise-skill">
|
||||||
|
|||||||
@@ -3,12 +3,15 @@ import { motion, useScroll, useTransform } from "motion/react"
|
|||||||
import { InView } from "@/components/ui/InView"
|
import { InView } from "@/components/ui/InView"
|
||||||
import { resumeAvailable, resumeLanguages, resumeUrlFor } from "@/data/resume"
|
import { resumeAvailable, resumeLanguages, resumeUrlFor } from "@/data/resume"
|
||||||
import type { Language } from '@/types'
|
import type { Language } from '@/types'
|
||||||
|
import { useLanguage } from '@/hooks/useLanguage'
|
||||||
|
import { strings } from '@/i18n/strings'
|
||||||
|
import { useField } from '@/i18n/useField'
|
||||||
const langLabels: Record<Language, string> = {
|
const langLabels: Record<Language, string> = {
|
||||||
en: 'English',
|
en: 'English',
|
||||||
vi: 'Tiếng Việt',
|
vi: 'Tiếng Việt',
|
||||||
}
|
}
|
||||||
function HeroDownloadDropdown() {
|
function HeroDownloadDropdown() {
|
||||||
|
const { lang } = useLanguage()
|
||||||
const [open, setOpen] = useState(false)
|
const [open, setOpen] = useState(false)
|
||||||
const ref = useRef<HTMLDivElement>(null)
|
const ref = useRef<HTMLDivElement>(null)
|
||||||
|
|
||||||
@@ -43,7 +46,7 @@ function HeroDownloadDropdown() {
|
|||||||
<path d="M12 3v10m0 0l-3-3m3 3l3-3" />
|
<path d="M12 3v10m0 0l-3-3m3 3l3-3" />
|
||||||
<path d="M3 17h18" />
|
<path d="M3 17h18" />
|
||||||
</svg>
|
</svg>
|
||||||
<span>Download Resume</span>
|
<span>{strings.common.resumeDownload[lang]}</span>
|
||||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" width="14" height="14" className="chevron">
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" width="14" height="14" className="chevron">
|
||||||
<polyline points="6 9 12 15 18 9" />
|
<polyline points="6 9 12 15 18 9" />
|
||||||
</svg>
|
</svg>
|
||||||
@@ -122,6 +125,7 @@ const socialLinks = [
|
|||||||
|
|
||||||
export function Hero() {
|
export function Hero() {
|
||||||
const { scrollY } = useScroll()
|
const { scrollY } = useScroll()
|
||||||
|
const { lang } = useLanguage()
|
||||||
const y = useTransform(scrollY, [0, 300], [0, -80])
|
const y = useTransform(scrollY, [0, 300], [0, -80])
|
||||||
return (
|
return (
|
||||||
<InView>
|
<InView>
|
||||||
@@ -147,7 +151,7 @@ export function Hero() {
|
|||||||
>
|
>
|
||||||
<span className="hero-greeting">
|
<span className="hero-greeting">
|
||||||
<span className="greeting-dot" />
|
<span className="greeting-dot" />
|
||||||
Hi, I'm
|
{strings.hero.greeting[lang]}
|
||||||
</span>
|
</span>
|
||||||
</motion.div>
|
</motion.div>
|
||||||
<motion.h1
|
<motion.h1
|
||||||
@@ -173,7 +177,7 @@ export function Hero() {
|
|||||||
animate={{ opacity: 1, y: 0 }}
|
animate={{ opacity: 1, y: 0 }}
|
||||||
transition={{ duration: 0.5, delay: 0.5 }}
|
transition={{ duration: 0.5, delay: 0.5 }}
|
||||||
>
|
>
|
||||||
{profile.tagline}
|
{useField(profile.tagline, profile.taglineEn)}
|
||||||
</motion.p>
|
</motion.p>
|
||||||
<motion.div
|
<motion.div
|
||||||
className="hero-cta"
|
className="hero-cta"
|
||||||
@@ -182,10 +186,10 @@ export function Hero() {
|
|||||||
transition={{ duration: 0.5, delay: 0.6 }}
|
transition={{ duration: 0.5, delay: 0.6 }}
|
||||||
>
|
>
|
||||||
<Button href="/projects" variant="primary">
|
<Button href="/projects" variant="primary">
|
||||||
View Projects
|
{strings.hero.ctaProjects[lang]}
|
||||||
</Button>
|
</Button>
|
||||||
<Button href="/contact" variant="primary">
|
<Button href="/contact" variant="primary">
|
||||||
Contact Me
|
{strings.hero.ctaContact[lang]}
|
||||||
</Button>
|
</Button>
|
||||||
{resumeAvailable && (
|
{resumeAvailable && (
|
||||||
<>
|
<>
|
||||||
@@ -206,7 +210,7 @@ export function Hero() {
|
|||||||
<div className="scroll-mouse">
|
<div className="scroll-mouse">
|
||||||
<div className="scroll-wheel" />
|
<div className="scroll-wheel" />
|
||||||
</div>
|
</div>
|
||||||
<span>Scroll</span>
|
<span>{strings.hero.scroll[lang]}</span>
|
||||||
</div>
|
</div>
|
||||||
<motion.div
|
<motion.div
|
||||||
className="hero-visual"
|
className="hero-visual"
|
||||||
|
|||||||
@@ -4,18 +4,13 @@ import { motion } from "motion/react"
|
|||||||
import { Badge } from "@/components/ui/Badge"
|
import { Badge } from "@/components/ui/Badge"
|
||||||
import { projects } from "@/data/projects"
|
import { projects } from "@/data/projects"
|
||||||
import { InView } from "@/components/ui/InView"
|
import { InView } from "@/components/ui/InView"
|
||||||
|
import { useLanguage } from '@/hooks/useLanguage'
|
||||||
|
import { strings } from '@/i18n/strings'
|
||||||
|
|
||||||
const MotionLink = motion.create(Link)
|
const MotionLink = motion.create(Link)
|
||||||
|
|
||||||
const categoryLabels: Record<string, string> = {
|
|
||||||
"software-engineering": "Software Engineering",
|
|
||||||
logistics: "Logistics",
|
|
||||||
"ai-ml": "AI / ML",
|
|
||||||
"computer-vision": "Computer Vision",
|
|
||||||
architecture: "Architecture",
|
|
||||||
experiment: "Experiment",
|
|
||||||
}
|
|
||||||
|
|
||||||
export function Projects() {
|
export function Projects() {
|
||||||
|
const { lang } = useLanguage()
|
||||||
const featured = projects.filter((p) => p.featured).slice(0, 4)
|
const featured = projects.filter((p) => p.featured).slice(0, 4)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -34,12 +29,12 @@ export function Projects() {
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<SectionHeading title="Featured Projects" tag="04 - Projects" />
|
<SectionHeading title={strings.projects.featured[lang]} tag="04 - Projects" />
|
||||||
<Link
|
<Link
|
||||||
to="/projects"
|
to="/projects"
|
||||||
style={{ fontSize: "14px", fontWeight: 500, color: "var(--accent)", display: "block", marginBottom: "24px" }}
|
style={{ fontSize: "14px", fontWeight: 500, color: "var(--accent)", display: "block", marginBottom: "24px" }}
|
||||||
>
|
>
|
||||||
View All →
|
{strings.projects.viewAll[lang]} →
|
||||||
</Link>
|
</Link>
|
||||||
<div className="projects-grid">
|
<div className="projects-grid">
|
||||||
{featured.map((project, i) => (
|
{featured.map((project, i) => (
|
||||||
@@ -62,10 +57,10 @@ export function Projects() {
|
|||||||
<div className="project-card-header">
|
<div className="project-card-header">
|
||||||
<h3>{project.title}</h3>
|
<h3>{project.title}</h3>
|
||||||
<Badge variant="outline">
|
<Badge variant="outline">
|
||||||
{categoryLabels[project.category] || project.category}
|
{strings.projects.categories[project.category][lang]}
|
||||||
</Badge>
|
</Badge>
|
||||||
</div>
|
</div>
|
||||||
<p className="project-card-summary">{project.summary}</p>
|
<p className="project-card-summary">{lang === 'vi' ? project.summary : project.summaryEn}</p>
|
||||||
<div className="project-card-techs">
|
<div className="project-card-techs">
|
||||||
{project.technologies.slice(0, 4).map((tech) => (
|
{project.technologies.slice(0, 4).map((tech) => (
|
||||||
<span key={tech} className="tag">
|
<span key={tech} className="tag">
|
||||||
@@ -82,7 +77,7 @@ export function Projects() {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<span className="project-card-cta">View Details →</span>
|
<span className="project-card-cta">{strings.projects.viewDetails[lang]} →</span>
|
||||||
</div>
|
</div>
|
||||||
</MotionLink>
|
</MotionLink>
|
||||||
))}
|
))}
|
||||||
|
|||||||
+4
-4
@@ -7,14 +7,14 @@ export const profile: Profile = {
|
|||||||
title: "Senior Software Engineer",
|
title: "Senior Software Engineer",
|
||||||
titleEn: "Senior Software Engineer",
|
titleEn: "Senior Software Engineer",
|
||||||
tagline:
|
tagline:
|
||||||
"Building scalable software systems,\nintelligent logistics solutions,\nand practical AI applications.",
|
"Xây dựng hệ thống phần mềm có khả năng mở rộng,\ngiải pháp logistics thông minh,\nvà ứng dụng AI thực tiễn.",
|
||||||
taglineEn:
|
taglineEn:
|
||||||
"Building scalable software systems,\nintelligent logistics solutions,\nand practical AI applications.",
|
"Building scalable software systems,\nintelligent logistics solutions,\nand practical AI applications.",
|
||||||
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.",
|
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.",
|
||||||
bioEn: "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.",
|
bioEn: "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.",
|
||||||
email: "your.email@example.com",
|
email: "nguyendong_bkdn@yahoo.com",
|
||||||
githubUrl: "https://github.com/yourusername",
|
githubUrl: "https://github.com/dong-nz",
|
||||||
linkedinUrl: "https://linkedin.com/in/yourusername",
|
linkedinUrl: "https://www.linkedin.com/in/dong-nz",
|
||||||
currentInterests: [
|
currentInterests: [
|
||||||
"AI in logistics",
|
"AI in logistics",
|
||||||
"Digital twins",
|
"Digital twins",
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import type { SkillGroup } from "@/types";
|
|||||||
export const skillGroups: SkillGroup[] = [
|
export const skillGroups: SkillGroup[] = [
|
||||||
{
|
{
|
||||||
title: "Software Engineering",
|
title: "Software Engineering",
|
||||||
|
titleEn: "Software Engineering",
|
||||||
skills: [
|
skills: [
|
||||||
"Java",
|
"Java",
|
||||||
"Go",
|
"Go",
|
||||||
@@ -14,6 +15,7 @@ export const skillGroups: SkillGroup[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "System Architecture",
|
title: "System Architecture",
|
||||||
|
titleEn: "System Architecture",
|
||||||
skills: [
|
skills: [
|
||||||
"System Design",
|
"System Design",
|
||||||
"Integration Architecture",
|
"Integration Architecture",
|
||||||
@@ -24,6 +26,7 @@ export const skillGroups: SkillGroup[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Logistics Technology",
|
title: "Logistics Technology",
|
||||||
|
titleEn: "Logistics Technology",
|
||||||
skills: [
|
skills: [
|
||||||
"Sortation",
|
"Sortation",
|
||||||
"Warehouse / Facility Operations",
|
"Warehouse / Facility Operations",
|
||||||
@@ -34,6 +37,7 @@ export const skillGroups: SkillGroup[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "AI / ML",
|
title: "AI / ML",
|
||||||
|
titleEn: "AI / ML",
|
||||||
skills: [
|
skills: [
|
||||||
"Computer Vision",
|
"Computer Vision",
|
||||||
"Object Detection",
|
"Object Detection",
|
||||||
@@ -45,10 +49,12 @@ export const skillGroups: SkillGroup[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Infrastructure",
|
title: "Infrastructure",
|
||||||
|
titleEn: "Infrastructure",
|
||||||
skills: ["Docker", "Linux", "CI/CD", "Networking", "Middleware"],
|
skills: ["Docker", "Linux", "CI/CD", "Networking", "Middleware"],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Engineering Practices",
|
title: "Engineering Practices",
|
||||||
|
titleEn: "Engineering Practices",
|
||||||
skills: [
|
skills: [
|
||||||
"Agile / Scrum",
|
"Agile / Scrum",
|
||||||
"Technical Documentation",
|
"Technical Documentation",
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
import {createContext, useCallback, useContext, useEffect, useState} from 'react'
|
||||||
|
|
||||||
|
type Language = 'en' | 'vi'
|
||||||
|
|
||||||
|
interface LanguageContextValue {
|
||||||
|
lang: Language
|
||||||
|
setLang: (lang: Language) => void
|
||||||
|
toggleLang: () => void
|
||||||
|
}
|
||||||
|
|
||||||
|
const STORAGE_KEY = 'portfolio-lang'
|
||||||
|
|
||||||
|
function getInitialLanguage(): Language {
|
||||||
|
try {
|
||||||
|
const stored = localStorage.getItem(STORAGE_KEY)
|
||||||
|
if (stored === 'en' || stored === 'vi') {
|
||||||
|
return stored
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// localStorage unavailable
|
||||||
|
}
|
||||||
|
// Detect browser language
|
||||||
|
return navigator.language?.toLowerCase().startsWith('vi') ? 'vi' : 'en'
|
||||||
|
}
|
||||||
|
|
||||||
|
const LanguageContext = createContext<LanguageContextValue | undefined>(undefined)
|
||||||
|
|
||||||
|
export function LanguageProvider({ children }: { children: React.ReactNode }) {
|
||||||
|
const [lang, setLangState] = useState<Language>(getInitialLanguage)
|
||||||
|
|
||||||
|
// Set <html lang> during render (synchronous, before paint)
|
||||||
|
document.documentElement.setAttribute('lang', lang)
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
try {
|
||||||
|
localStorage.setItem(STORAGE_KEY, lang)
|
||||||
|
} catch {
|
||||||
|
// localStorage unavailable
|
||||||
|
}
|
||||||
|
}, [lang])
|
||||||
|
|
||||||
|
const setLang = useCallback((newLang: Language) => {
|
||||||
|
setLangState(newLang)
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
const toggleLang = useCallback(() => {
|
||||||
|
setLangState((prev) => (prev === 'en' ? 'vi' : 'en'))
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
return (
|
||||||
|
<LanguageContext.Provider value={{ lang, setLang, toggleLang }}>
|
||||||
|
{children}
|
||||||
|
</LanguageContext.Provider>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function useLanguage() {
|
||||||
|
const context = useContext(LanguageContext)
|
||||||
|
if (!context) {
|
||||||
|
throw new Error('useLanguage must be used within LanguageProvider')
|
||||||
|
}
|
||||||
|
return context
|
||||||
|
}
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
export const strings = {
|
||||||
|
nav: {
|
||||||
|
home: { en: 'Home', vi: 'Trang chủ' },
|
||||||
|
about: { en: 'About', vi: 'Giới thiệu' },
|
||||||
|
experience: { en: 'Experience', vi: 'Kinh nghiệm' },
|
||||||
|
projects: { en: 'Projects', vi: 'Dự án' },
|
||||||
|
engineering: { en: 'Engineering', vi: 'Kỹ sư' },
|
||||||
|
contact: { en: 'Contact', vi: 'Liên hệ' },
|
||||||
|
},
|
||||||
|
footer: {
|
||||||
|
copyright: { en: 'All rights reserved', vi: 'Bảo lưu mọi quyền' },
|
||||||
|
links: {
|
||||||
|
home: { en: 'Home', vi: 'Trang chủ' },
|
||||||
|
about: { en: 'About', vi: 'Giới thiệu' },
|
||||||
|
projects: { en: 'Projects', vi: 'Dự án' },
|
||||||
|
contact: { en: 'Contact', vi: 'Liên hệ' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
hero: {
|
||||||
|
greeting: { en: "Hi, I'm", vi: 'Xin chào, tôi là' },
|
||||||
|
ctaProjects: { en: 'View Projects', vi: 'Xem dự án' },
|
||||||
|
ctaContact: { en: 'Contact Me', vi: 'Liên hệ' },
|
||||||
|
downloadResume: { en: 'Download Resume', vi: 'Tải CV' },
|
||||||
|
scroll: { en: 'Scroll', vi: 'Cuộn' },
|
||||||
|
},
|
||||||
|
about: {
|
||||||
|
heading: { en: 'About Me', vi: 'Giới thiệu' },
|
||||||
|
subtitle: { en: 'Senior Software Engineer with deep expertise in distributed systems, logistics technology, and practical AI applications.', vi: '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.' },
|
||||||
|
engineeringTitle: { en: 'How I Think About Engineering', vi: 'Cách tôi tư duy về kỹ thuật' },
|
||||||
|
exploringTitle: { en: "What I'm Exploring", vi: 'Những điều tôi đang tìm hiểu' },
|
||||||
|
exploringTitlePage: { en: "What I'm Currently Exploring", vi: 'Những điều tôi đang tìm hiểu' },
|
||||||
|
expertise: { en: 'Core Expertise', vi: 'Chuyên môn' },
|
||||||
|
},
|
||||||
|
expertise: {
|
||||||
|
heading: { en: 'Core Expertise', vi: 'Chuyên môn' },
|
||||||
|
},
|
||||||
|
experience: {
|
||||||
|
heading: { en: 'Experience', vi: 'Kinh nghiệm' },
|
||||||
|
},
|
||||||
|
projects: {
|
||||||
|
featured: { en: 'Featured Projects', vi: 'Dự án nổi bật' },
|
||||||
|
all: { en: 'Projects', vi: 'Dự án' },
|
||||||
|
viewAll: { en: 'View All', vi: 'Xem tất cả' },
|
||||||
|
viewDetails: { en: 'View Details', vi: 'Xem chi tiết' },
|
||||||
|
categories: {
|
||||||
|
'software-engineering': { en: 'Software Engineering', vi: 'Kỹ thuật phần mềm' },
|
||||||
|
logistics: { en: 'Logistics', vi: 'Logistics' },
|
||||||
|
'ai-ml': { en: 'AI / ML', vi: 'AI / ML' },
|
||||||
|
'computer-vision': { en: 'Computer Vision', vi: 'Computer Vision' },
|
||||||
|
architecture: { en: 'Architecture', vi: 'Kiến trúc' },
|
||||||
|
experiment: { en: 'Experiment', vi: 'Thử nghiệm' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
contact: {
|
||||||
|
heading: { en: 'Contact', vi: 'Liên hệ' },
|
||||||
|
email: { en: 'Email', vi: 'Email' },
|
||||||
|
github: { en: 'GitHub', vi: 'GitHub' },
|
||||||
|
linkedin: { en: 'LinkedIn', vi: 'LinkedIn' },
|
||||||
|
},
|
||||||
|
projectDetail: {
|
||||||
|
notFound: { en: 'Project Not Found', vi: 'Không tìm thấy dự án' },
|
||||||
|
backToProjects: { en: 'Back to Projects', vi: 'Quay lại dự án' },
|
||||||
|
impact: { en: 'Impact', vi: 'Tác động' },
|
||||||
|
role: { en: 'Role', vi: 'Vai trò' },
|
||||||
|
technologies: { en: 'Technologies', vi: 'Công nghệ' },
|
||||||
|
experiments: { en: 'Engineering Experiments', vi: 'Thí nghiệm kỹ thuật' },
|
||||||
|
},
|
||||||
|
engineering: {
|
||||||
|
heading: { en: 'Engineering', vi: 'Kỹ sư' },
|
||||||
|
categories: {
|
||||||
|
architecture: { en: 'Architecture', vi: 'Kiến trúc' },
|
||||||
|
ai_ml: { en: 'AI / ML', vi: 'AI / ML' },
|
||||||
|
experiments: { en: 'Experiments', vi: 'Thử nghiệm' },
|
||||||
|
},
|
||||||
|
comingSoon: { en: 'Content coming soon. This section will showcase deep technical exploration in %s.', vi: 'Nội dung sắp ra mắt. Phần này sẽ giới thiệu các khám phá kỹ thuật chuyên sâu về %s.' },
|
||||||
|
},
|
||||||
|
common: {
|
||||||
|
backTo: { en: 'Back to %s', vi: 'Quay lại %s' },
|
||||||
|
skipLink: { en: 'Skip to content', vi: 'Bỏ qua nội dung' },
|
||||||
|
resumeDownload: { en: 'Download Resume', vi: 'Tải CV' },
|
||||||
|
socialAriaLabels: {
|
||||||
|
github: { en: 'View GitHub profile', vi: 'Xem hồ sơ GitHub' },
|
||||||
|
linkedin: { en: 'View LinkedIn profile', vi: 'Xem hồ sơ LinkedIn' },
|
||||||
|
email: { en: 'Send email', vi: 'Gửi email' },
|
||||||
|
},
|
||||||
|
contactTag: { en: 'Contact', vi: 'Liên hệ' },
|
||||||
|
experienceTag: { en: 'Experience', vi: 'Kinh nghiệm' },
|
||||||
|
},
|
||||||
|
} as const
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { useLanguage } from '@/hooks/useLanguage'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* React hook: select field by language. Must be called at component top level.
|
||||||
|
*/
|
||||||
|
export function useField<T>(value: T, valueEn: T | undefined): T {
|
||||||
|
const { lang } = useLanguage()
|
||||||
|
return lang === 'vi' ? value : (valueEn ?? value)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* React hook: select array field by language. Must be called at component top level.
|
||||||
|
*/
|
||||||
|
export function useFieldArray<T>(value: T[], valueEn: T[] | undefined): T[] {
|
||||||
|
const { lang } = useLanguage()
|
||||||
|
return lang === 'vi' ? value : (valueEn ?? value)
|
||||||
|
}
|
||||||
@@ -277,3 +277,22 @@ pre code {
|
|||||||
.skip-link:focus {
|
.skip-link:focus {
|
||||||
top: 16px;
|
top: 16px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Language toggle button */
|
||||||
|
.lang-toggle {
|
||||||
|
background: transparent;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
color: var(--text-primary);
|
||||||
|
padding: 6px 10px;
|
||||||
|
border-radius: var(--radius-md);
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: 0.5px;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lang-toggle:hover {
|
||||||
|
border-color: var(--accent);
|
||||||
|
color: var(--accent);
|
||||||
|
}
|
||||||
+13
-10
@@ -3,24 +3,28 @@ import { SectionHeading } from '@/components/ui/SectionHeading'
|
|||||||
import { Tag } from '@/components/ui/Tag'
|
import { Tag } from '@/components/ui/Tag'
|
||||||
import { profile } from '@/data/profile'
|
import { profile } from '@/data/profile'
|
||||||
import { skillGroups } from '@/data/skills'
|
import { skillGroups } from '@/data/skills'
|
||||||
|
import { useLanguage } from '@/hooks/useLanguage'
|
||||||
|
import { strings } from '@/i18n/strings'
|
||||||
|
import { useField } from '@/i18n/useField'
|
||||||
|
|
||||||
export function AboutPage() {
|
export function AboutPage() {
|
||||||
|
const { lang } = useLanguage()
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AnimatedSection>
|
<AnimatedSection>
|
||||||
<section className="section container-content" aria-labelledby="about-heading">
|
<section className="section container-content" aria-labelledby="about-heading">
|
||||||
<SectionHeading
|
<SectionHeading
|
||||||
title="About Me"
|
title={strings.about.heading[lang]}
|
||||||
subtitle="Senior Software Engineer with deep expertise in distributed systems, logistics technology, and practical AI applications."
|
subtitle={strings.about.subtitle[lang]}
|
||||||
tag="01 - About"
|
tag="About"
|
||||||
/>
|
/>
|
||||||
<div style={{ maxWidth: '700px' }}>
|
<div style={{ maxWidth: '700px' }}>
|
||||||
<p style={{ fontSize: '18px', marginBottom: '32px' }}>
|
<p style={{ fontSize: '18px', marginBottom: '32px' }}>
|
||||||
{profile.bio}
|
{useField(profile.bio, profile.bioEn)}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h3 style={{ fontSize: '20px', marginBottom: '16px', color: 'var(--text-primary)' }}>
|
<h3 style={{ fontSize: '20px', marginBottom: '16px', color: 'var(--text-primary)' }}>
|
||||||
How I Think About Engineering
|
{strings.about.engineeringTitle[lang]}
|
||||||
</h3>
|
</h3>
|
||||||
<div className="philosophy-grid">
|
<div className="philosophy-grid">
|
||||||
{profile.philosophy.map((point) => (
|
{profile.philosophy.map((point) => (
|
||||||
@@ -37,7 +41,7 @@ export function AboutPage() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h3 style={{ fontSize: '20px', marginTop: '32px', marginBottom: '12px', color: 'var(--text-primary)' }}>
|
<h3 style={{ fontSize: '20px', marginTop: '32px', marginBottom: '12px', color: 'var(--text-primary)' }}>
|
||||||
What I'm Currently Exploring
|
{strings.about.exploringTitlePage[lang]}
|
||||||
</h3>
|
</h3>
|
||||||
<div className="interests-list">
|
<div className="interests-list">
|
||||||
{profile.currentInterests.map((interest) => (
|
{profile.currentInterests.map((interest) => (
|
||||||
@@ -49,14 +53,13 @@ export function AboutPage() {
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</AnimatedSection>
|
</AnimatedSection>
|
||||||
|
|
||||||
<AnimatedSection>
|
<AnimatedSection>
|
||||||
<section className="section container-wide" aria-labelledby="expertise-heading">
|
<section className="section container-wide" aria-labelledby="expertise-heading">
|
||||||
<SectionHeading title="Core Expertise" />
|
<SectionHeading title={strings.about.expertise[lang]} />
|
||||||
<div className="expertise-grid">
|
<div className="expertise-grid">
|
||||||
{skillGroups.map((group: { title: string; skills: string[] }) => (
|
{skillGroups.map((group) => (
|
||||||
<div key={group.title} className="expertise-card">
|
<div key={group.title} className="expertise-card">
|
||||||
<h3>{group.title}</h3>
|
<h3>{lang === 'vi' ? group.title : group.titleEn}</h3>
|
||||||
<ul className="expertise-skills">
|
<ul className="expertise-skills">
|
||||||
{group.skills.map((skill: string) => (
|
{group.skills.map((skill: string) => (
|
||||||
<li key={skill} className="expertise-skill">
|
<li key={skill} className="expertise-skill">
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
import { SectionHeading } from '@/components/ui/SectionHeading'
|
import { SectionHeading } from '@/components/ui/SectionHeading'
|
||||||
import { DownloadResume } from '@/components/sections/DownloadResume'
|
import { DownloadResume } from '@/components/sections/DownloadResume'
|
||||||
import { profile } from '@/data/profile'
|
import { profile } from '@/data/profile'
|
||||||
|
import { useLanguage } from '@/hooks/useLanguage'
|
||||||
|
import { strings } from '@/i18n/strings'
|
||||||
export function ContactPage() {
|
export function ContactPage() {
|
||||||
|
const { lang } = useLanguage()
|
||||||
return (
|
return (
|
||||||
<section className="section container-content" aria-labelledby="contact-heading">
|
<section className="section container-content" aria-labelledby="contact-heading">
|
||||||
<SectionHeading title="Contact" tag="06 - Contact" />
|
<SectionHeading title={strings.contact.heading[lang]} tag={strings.common.contactTag[lang]} />
|
||||||
<div className="contact-links">
|
<div className="contact-links">
|
||||||
<a href={`mailto:${profile.email}`} className="contact-link">
|
<a href={`mailto:${profile.email}`} className="contact-link">
|
||||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" width="24" height="24">
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" width="24" height="24">
|
||||||
@@ -13,7 +15,7 @@ export function ContactPage() {
|
|||||||
<path d="M22 4l-10 8L2 4" />
|
<path d="M22 4l-10 8L2 4" />
|
||||||
</svg>
|
</svg>
|
||||||
<div>
|
<div>
|
||||||
<div style={{ fontWeight: 500, color: 'var(--text-primary)' }}>Email</div>
|
<div style={{ fontWeight: 500, color: 'var(--text-primary)' }}>{strings.contact.email[lang]}</div>
|
||||||
<div style={{ fontSize: '14px', color: 'var(--text-muted)' }}>{profile.email}</div>
|
<div style={{ fontSize: '14px', color: 'var(--text-muted)' }}>{profile.email}</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
@@ -22,7 +24,7 @@ export function ContactPage() {
|
|||||||
<path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z" />
|
<path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z" />
|
||||||
</svg>
|
</svg>
|
||||||
<div>
|
<div>
|
||||||
<div style={{ fontWeight: 500, color: 'var(--text-primary)' }}>GitHub</div>
|
<div style={{ fontWeight: 500, color: 'var(--text-primary)' }}>{strings.contact.github[lang]}</div>
|
||||||
<div style={{ fontSize: '14px', color: 'var(--text-muted)' }}>@yourusername</div>
|
<div style={{ fontSize: '14px', color: 'var(--text-muted)' }}>@yourusername</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
@@ -31,7 +33,7 @@ export function ContactPage() {
|
|||||||
<path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 0 1-2.063-2.065 2.064 2.064 0 1 1 2.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z" />
|
<path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433a2.062 2.062 0 0 1-2.063-2.065 2.064 2.064 0 1 1 2.063 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z" />
|
||||||
</svg>
|
</svg>
|
||||||
<div>
|
<div>
|
||||||
<div style={{ fontWeight: 500, color: 'var(--text-primary)' }}>LinkedIn</div>
|
<div style={{ fontWeight: 500, color: 'var(--text-primary)' }}>{strings.contact.linkedin[lang]}</div>
|
||||||
<div style={{ fontSize: '14px', color: 'var(--text-muted)' }}>Your Name</div>
|
<div style={{ fontSize: '14px', color: 'var(--text-muted)' }}>Your Name</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -2,22 +2,26 @@ import { SectionHeading } from '@/components/ui/SectionHeading'
|
|||||||
import { Tag } from '@/components/ui/Tag'
|
import { Tag } from '@/components/ui/Tag'
|
||||||
import { profile } from '@/data/profile'
|
import { profile } from '@/data/profile'
|
||||||
|
|
||||||
|
import { useLanguage } from '@/hooks/useLanguage'
|
||||||
|
import { strings } from '@/i18n/strings'
|
||||||
|
const engineeringCategoryKeys = ['architecture', 'ai_ml', 'experiments'] as const
|
||||||
export function EngineeringPage() {
|
export function EngineeringPage() {
|
||||||
|
const { lang } = useLanguage()
|
||||||
return (
|
return (
|
||||||
<section className="section container-content" aria-labelledby="engineering-heading">
|
<section className="section container-content" aria-labelledby="engineering-heading">
|
||||||
<SectionHeading title="Engineering" tag="05 - Engineering" />
|
<SectionHeading title={strings.engineering.heading[lang]} tag="Engineering" />
|
||||||
|
|
||||||
{['Architecture', 'AI / ML', 'Experiments'].map((category) => (
|
{engineeringCategoryKeys.map((catKey) => (
|
||||||
<div key={category} style={{ marginBottom: '48px' }}>
|
<div key={catKey} style={{ marginBottom: '48px' }}>
|
||||||
<h3 style={{ fontSize: '20px', marginBottom: '24px', color: 'var(--text-primary)' }}>
|
<h3 style={{ fontSize: '20px', marginBottom: '24px', color: 'var(--text-primary)' }}>
|
||||||
{category}
|
{strings.engineering.categories[catKey][lang]}
|
||||||
</h3>
|
</h3>
|
||||||
{/* Placeholder for expanded content */}
|
{/* Placeholder for expanded content */}
|
||||||
<p style={{ color: 'var(--text-secondary)' }}>
|
<p style={{ color: 'var(--text-secondary)' }}>
|
||||||
Content coming soon. This section will showcase deep technical exploration in {category.toLowerCase()}.
|
{strings.engineering.comingSoon[lang].replace('%s', strings.engineering.categories[catKey][lang])}
|
||||||
</p>
|
</p>
|
||||||
<div className="philosophy-keywords" style={{ marginTop: '16px' }}>
|
<div className="philosophy-keywords" style={{ marginTop: '16px' }}>
|
||||||
{profile.currentInterests.filter((i) => i.includes(category)).map((kw) => (
|
{profile.currentInterests.filter((i) => i.includes(catKey)).map((kw) => (
|
||||||
<Tag key={kw} accent>{kw}</Tag>
|
<Tag key={kw} accent>{kw}</Tag>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,16 +1,19 @@
|
|||||||
import { SectionHeading } from '@/components/ui/SectionHeading'
|
import { SectionHeading } from '@/components/ui/SectionHeading'
|
||||||
import { experiences } from '@/data/experience'
|
import { experiences } from '@/data/experience'
|
||||||
|
import { useLanguage } from '@/hooks/useLanguage'
|
||||||
|
import { strings } from '@/i18n/strings'
|
||||||
|
|
||||||
export function ExperiencePage() {
|
export function ExperiencePage() {
|
||||||
|
const { lang } = useLanguage()
|
||||||
return (
|
return (
|
||||||
<section className="section container-content" aria-labelledby="experience-heading">
|
<section className="section container-content" aria-labelledby="experience-heading">
|
||||||
<SectionHeading title="Experience" tag="03 - Experience" />
|
<SectionHeading title={strings.experience.heading[lang]} tag={strings.common.experienceTag[lang]} />
|
||||||
<div className="timeline">
|
<div className="timeline">
|
||||||
{experiences.map((exp) => (
|
{experiences.map((exp) => (
|
||||||
<div key={exp.id} className="timeline-entry">
|
<div key={exp.id} className="timeline-entry">
|
||||||
<div className="timeline-marker" />
|
<div className="timeline-marker" />
|
||||||
<div className="timeline-header">
|
<div className="timeline-header">
|
||||||
<div className="timeline-title">{exp.title}</div>
|
<div className="timeline-title">{lang === 'vi' ? exp.title : exp.titleEn}</div>
|
||||||
<div className="timeline-company">{exp.company}</div>
|
<div className="timeline-company">{exp.company}</div>
|
||||||
<div className="timeline-duration">{exp.duration}</div>
|
<div className="timeline-duration">{exp.duration}</div>
|
||||||
{exp.location && (
|
{exp.location && (
|
||||||
@@ -18,16 +21,16 @@ export function ExperiencePage() {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<ul className="timeline-responsibilities">
|
<ul className="timeline-responsibilities">
|
||||||
{exp.responsibilities.map((r) => (
|
{(lang === 'vi' ? exp.responsibilities : exp.responsibilitiesEn ?? []).map((r) => (
|
||||||
<li key={r}>{r}</li>
|
<li key={r}>{r}</li>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
{exp.achievements?.map((achievement) => (
|
{exp.achievements?.map((achievement) => (
|
||||||
<div key={achievement.id} className="achievement">
|
<div key={achievement.id} className="achievement">
|
||||||
<div className="achievement-title">{achievement.title}</div>
|
<div className="achievement-title">{achievement.title}</div>
|
||||||
<div className="achievement-context">{achievement.context}</div>
|
<div className="achievement-context">{lang === 'vi' ? achievement.context : achievement.contextEn}</div>
|
||||||
<div style={{ fontSize: '14px', color: 'var(--text-secondary)', marginBottom: '8px' }}>
|
<div style={{ fontSize: '14px', color: 'var(--text-secondary)', marginBottom: '8px' }}>
|
||||||
{achievement.impact}
|
{lang === 'vi' ? achievement.impact : achievement.impactEn}
|
||||||
</div>
|
</div>
|
||||||
{achievement.metrics && achievement.metrics.length > 0 && (
|
{achievement.metrics && achievement.metrics.length > 0 && (
|
||||||
<div style={{ marginBottom: '8px' }}>
|
<div style={{ marginBottom: '8px' }}>
|
||||||
|
|||||||
@@ -2,26 +2,21 @@ import { useParams, Link } from 'react-router'
|
|||||||
import { Badge } from '@/components/ui/Badge'
|
import { Badge } from '@/components/ui/Badge'
|
||||||
import { Tag } from '@/components/ui/Tag'
|
import { Tag } from '@/components/ui/Tag'
|
||||||
import { projects } from '@/data/projects'
|
import { projects } from '@/data/projects'
|
||||||
|
import { useLanguage } from '@/hooks/useLanguage'
|
||||||
|
import { strings } from '@/i18n/strings'
|
||||||
|
|
||||||
const categoryLabels: Record<string, string> = {
|
|
||||||
'software-engineering': 'Software Engineering',
|
|
||||||
logistics: 'Logistics',
|
|
||||||
'ai-ml': 'AI / ML',
|
|
||||||
'computer-vision': 'Computer Vision',
|
|
||||||
architecture: 'Architecture',
|
|
||||||
experiment: 'Experiment',
|
|
||||||
}
|
|
||||||
|
|
||||||
export function ProjectDetailPage() {
|
export function ProjectDetailPage() {
|
||||||
const { id } = useParams<{ id: string }>()
|
const { id } = useParams<{ id: string }>()
|
||||||
|
const { lang } = useLanguage()
|
||||||
const project = projects.find((p) => p.id === id)
|
const project = projects.find((p) => p.id === id)
|
||||||
|
|
||||||
if (!project) {
|
if (!project) {
|
||||||
return (
|
return (
|
||||||
<section className="section container-content">
|
<section className="section container-content">
|
||||||
<h2>Project Not Found</h2>
|
<h2>{strings.projectDetail.notFound[lang]}</h2>
|
||||||
<p>
|
<p>
|
||||||
<Link to="/projects">← Back to Projects</Link>
|
<Link to="/projects">{strings.projectDetail.backToProjects[lang]} ←</Link>
|
||||||
</p>
|
</p>
|
||||||
</section>
|
</section>
|
||||||
)
|
)
|
||||||
@@ -30,21 +25,21 @@ export function ProjectDetailPage() {
|
|||||||
return (
|
return (
|
||||||
<section className="section container-content" aria-labelledby="project-title">
|
<section className="section container-content" aria-labelledby="project-title">
|
||||||
<Link to="/projects" style={{ fontSize: '14px', fontWeight: 500, color: 'var(--accent)', marginBottom: '32px', display: 'inline-block' }}>
|
<Link to="/projects" style={{ fontSize: '14px', fontWeight: 500, color: 'var(--accent)', marginBottom: '32px', display: 'inline-block' }}>
|
||||||
← Back to Projects
|
{strings.projectDetail.backToProjects[lang]} ←
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
<div style={{ display: 'flex', alignItems: 'center', gap: '16px', marginBottom: '16px' }}>
|
<div style={{ display: 'flex', alignItems: 'center', gap: '16px', marginBottom: '16px' }}>
|
||||||
<h1 id="project-title" style={{ flex: 1 }}>{project.title}</h1>
|
<h1 id="project-title" style={{ flex: 1 }}>{project.title}</h1>
|
||||||
<Badge variant="outline">{categoryLabels[project.category] || project.category}</Badge>
|
<Badge variant="outline">{strings.projects.categories[project.category][lang]}</Badge>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p style={{ fontSize: '18px', color: 'var(--text-secondary)', marginBottom: '32px' }}>
|
<p style={{ fontSize: '18px', color: 'var(--text-secondary)', marginBottom: '32px' }}>
|
||||||
{project.summary}
|
{lang === 'vi' ? project.summary : project.summaryEn}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{project.metrics && project.metrics.length > 0 && (
|
{project.metrics && project.metrics.length > 0 && (
|
||||||
<div style={{ marginBottom: '32px' }}>
|
<div style={{ marginBottom: '32px' }}>
|
||||||
<h3 style={{ fontSize: '16px', marginBottom: '12px', color: 'var(--text-primary)' }}>Impact</h3>
|
<h3 style={{ fontSize: '16px', marginBottom: '12px', color: 'var(--text-primary)' }}>{strings.projectDetail.impact[lang]}</h3>
|
||||||
<div style={{ display: 'flex', gap: '16px', flexWrap: 'wrap' }}>
|
<div style={{ display: 'flex', gap: '16px', flexWrap: 'wrap' }}>
|
||||||
{project.metrics.map((m) => (
|
{project.metrics.map((m) => (
|
||||||
<span key={m} className="achievement-metric">
|
<span key={m} className="achievement-metric">
|
||||||
@@ -56,12 +51,12 @@ export function ProjectDetailPage() {
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<div style={{ marginBottom: '32px' }}>
|
<div style={{ marginBottom: '32px' }}>
|
||||||
<h3 style={{ fontSize: '16px', marginBottom: '12px', color: 'var(--text-primary)' }}>Role</h3>
|
<h3 style={{ fontSize: '16px', marginBottom: '12px', color: 'var(--text-primary)' }}>{strings.projectDetail.role[lang]}</h3>
|
||||||
<p>{project.role}</p>
|
<p>{project.role}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style={{ marginBottom: '32px' }}>
|
<div style={{ marginBottom: '32px' }}>
|
||||||
<h3 style={{ fontSize: '16px', marginBottom: '12px', color: 'var(--text-primary)' }}>Technologies</h3>
|
<h3 style={{ fontSize: '16px', marginBottom: '12px', color: 'var(--text-primary)' }}>{strings.projectDetail.technologies[lang]}</h3>
|
||||||
<div className="philosophy-keywords">
|
<div className="philosophy-keywords">
|
||||||
{project.technologies.map((tech) => (
|
{project.technologies.map((tech) => (
|
||||||
<Tag key={tech}>{tech}</Tag>
|
<Tag key={tech}>{tech}</Tag>
|
||||||
@@ -71,11 +66,11 @@ export function ProjectDetailPage() {
|
|||||||
|
|
||||||
{project.sections && project.sections.length > 0 && (
|
{project.sections && project.sections.length > 0 && (
|
||||||
<div style={{ marginBottom: '32px' }}>
|
<div style={{ marginBottom: '32px' }}>
|
||||||
<h3 style={{ fontSize: '16px', marginBottom: '12px', color: 'var(--text-primary)' }}>Engineering Experiments</h3>
|
<h3 style={{ fontSize: '16px', marginBottom: '12px', color: 'var(--text-primary)' }}>{strings.projectDetail.experiments[lang]}</h3>
|
||||||
{project.sections.map((section, idx) => (
|
{project.sections.map((section, idx) => (
|
||||||
<div key={idx} style={{ marginBottom: '16px', padding: '16px', background: 'var(--bg-surface)', borderRadius: '8px' }}>
|
<div key={idx} style={{ marginBottom: '16px', padding: '16px', background: 'var(--bg-surface)', borderRadius: '8px' }}>
|
||||||
<h4 style={{ fontSize: '14px', marginBottom: '4px', color: 'var(--text-primary)' }}>{section.title}</h4>
|
<h4 style={{ fontSize: '14px', marginBottom: '4px', color: 'var(--text-primary)' }}>{lang === 'vi' ? section.title : section.titleEn}</h4>
|
||||||
<p style={{ fontSize: '14px', color: 'var(--text-secondary)' }}>{section.content}</p>
|
<p style={{ fontSize: '14px', color: 'var(--text-secondary)' }}>{lang === 'vi' ? section.content : section.contentEn}</p>
|
||||||
<Tag accent>{section.type}</Tag>
|
<Tag accent>{section.type}</Tag>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -1,34 +1,30 @@
|
|||||||
import { SectionHeading } from '@/components/ui/SectionHeading'
|
import { SectionHeading } from '@/components/ui/SectionHeading'
|
||||||
import { Badge } from '@/components/ui/Badge'
|
import { Badge } from '@/components/ui/Badge'
|
||||||
import { projects } from '@/data/projects'
|
import { projects } from '@/data/projects'
|
||||||
|
import { useLanguage } from '@/hooks/useLanguage'
|
||||||
|
import { strings } from '@/i18n/strings'
|
||||||
|
|
||||||
const categoryLabels: Record<string, string> = {
|
import { Link } from 'react-router'
|
||||||
'software-engineering': 'Software Engineering',
|
|
||||||
logistics: 'Logistics',
|
|
||||||
'ai-ml': 'AI / ML',
|
|
||||||
'computer-vision': 'Computer Vision',
|
|
||||||
architecture: 'Architecture',
|
|
||||||
experiment: 'Experiment',
|
|
||||||
}
|
|
||||||
|
|
||||||
export function ProjectsListPage() {
|
export function ProjectsListPage() {
|
||||||
|
const { lang } = useLanguage()
|
||||||
return (
|
return (
|
||||||
<section className="section container-wide" aria-labelledby="projects-heading">
|
<section className="section container-wide" aria-labelledby="projects-heading">
|
||||||
<SectionHeading title="Projects" tag="04 - Projects" />
|
<SectionHeading title={strings.projects.all[lang]} tag="04 - Projects" />
|
||||||
<div className="projects-grid">
|
<div className="projects-grid">
|
||||||
{projects.map((project) => (
|
{projects.map((project) => (
|
||||||
<a
|
<Link
|
||||||
key={project.id}
|
key={project.id}
|
||||||
href={`/projects/${project.id}`}
|
to={`/projects/${project.id}`}
|
||||||
className="project-card"
|
className="project-card"
|
||||||
>
|
>
|
||||||
<div className="project-card-header">
|
<div className="project-card-header">
|
||||||
<h3>{project.title}</h3>
|
<h3>{project.title}</h3>
|
||||||
<Badge variant="outline">
|
<Badge variant="outline">
|
||||||
{categoryLabels[project.category] || project.category}
|
{strings.projects.categories[project.category][lang]}
|
||||||
</Badge>
|
</Badge>
|
||||||
</div>
|
</div>
|
||||||
<p className="project-card-summary">{project.summary}</p>
|
<p className="project-card-summary">{lang === 'vi' ? project.summary : project.summaryEn}</p>
|
||||||
<div className="project-card-techs">
|
<div className="project-card-techs">
|
||||||
{project.technologies.slice(0, 4).map((tech) => (
|
{project.technologies.slice(0, 4).map((tech) => (
|
||||||
<span key={tech} className="tag">
|
<span key={tech} className="tag">
|
||||||
@@ -36,8 +32,8 @@ export function ProjectsListPage() {
|
|||||||
</span>
|
</span>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<span className="project-card-cta">View Details →</span>
|
<span className="project-card-cta">{strings.projects.viewDetails[lang]} →</span>
|
||||||
</a>
|
</Link>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
Reference in new issue
Block a user