mirror of
https://github.com/dong-nz/cv.git
synced 2026-11-22 16:10:40 +07:00
fix(i18n): complete phase 1 - translate section tags, replace lang checks, dedup download component
- Replace hardcoded SectionHeading tags with i18n strings (7 files) - Replace 17 lang === 'vi' checks with useField/useFieldArray hooks - Extract shared DownloadResumeDropdown component (Hero + DownloadResume) - Move langLabels to src/data/resume.ts as resumeLanguageLabels - Update feedback docs with resolution status
This commit is contained in:
1 parent
72a832c781
commit
4996a91a77
15 files changed
+489
-158
No files matched your search
@@ -0,0 +1,236 @@
|
||||
# i18n Phase 1 — Action Items
|
||||
|
||||
## P1: Hardcoded Section Heading Tags
|
||||
|
||||
**Impact:** Section number tags không được dịch khi chuyển language. Người dùng tiếng Việt vẫn thấy "About", "Expertise", "Experience", "Projects", "Engineering" thay vì bản dịch.
|
||||
|
||||
**Pattern cần dùng:**
|
||||
```tsx
|
||||
// spec-v3-i18n.md:347-355
|
||||
<SectionHeading title={strings.XXX.heading[lang]} tag={`01 - ${strings.XXX.heading[lang]}`} />
|
||||
```
|
||||
|
||||
### Files cần fix
|
||||
|
||||
| File | Dòng | Current | Fix |
|
||||
|---|---|---|---|
|
||||
| `src/components/sections/About.tsx` | 13 | `tag="01 - About"` | `tag={strings.about.heading[lang]}` |
|
||||
| `src/components/sections/Expertise.tsx` | 26 | `tag="02 - Expertise"` | `tag={strings.expertise.heading[lang]}` |
|
||||
| `src/components/sections/Experience.tsx` | 26 | `tag="03 - Experience"` | `tag={strings.experience.heading[lang]}` |
|
||||
| `src/components/sections/Projects.tsx` | 32 | `tag="04 - Projects"` | `tag={strings.projects.featured[lang]}` |
|
||||
| `src/pages/ProjectsListPage.tsx` | 13 | `tag="04 - Projects"` | `tag={strings.projects.all[lang]}` |
|
||||
| `src/pages/AboutPage.tsx` | 19 | `tag="About"` | `tag={strings.about.heading[lang]}` |
|
||||
| `src/pages/EngineeringPage.tsx` | 12 | `tag="Engineering"` | `tag={strings.engineering.heading[lang]}` |
|
||||
|
||||
### Đã đúng (reference)
|
||||
|
||||
| File | Dòng | Code |
|
||||
|---|---|---|
|
||||
| `src/components/sections/Contact.tsx` | 23 | `tag={\`06 - ${strings.common.contactTag[lang]}\`}` |
|
||||
| `src/pages/ExperiencePage.tsx` | 10 | `tag={strings.common.experienceTag[lang]}` |
|
||||
|
||||
---
|
||||
|
||||
## P1: Hardcoded Language Checks (`lang === 'vi'`)
|
||||
|
||||
**Impact:** 17 occurrences của inline conditional language check — duplicated logic, khó maintain khi thêm language mới, vi phạm DRY.
|
||||
|
||||
**Pattern cần dùng:** `useField()` hook (đã tồn tại tại `src/i18n/useField.ts`)
|
||||
```tsx
|
||||
import { useField } from '@/i18n/useField'
|
||||
|
||||
// Single value:
|
||||
{useField(value, valueEn)}
|
||||
|
||||
// Array value:
|
||||
{useFieldArray(arr, arrEn).map(item => ...)}
|
||||
```
|
||||
|
||||
### Files cần fix
|
||||
|
||||
#### `src/components/sections/Expertise.tsx`
|
||||
|
||||
| Dòng | Current | Fix |
|
||||
|---|---|---|
|
||||
| 43 | `{lang === 'vi' ? group.title : group.titleEn}` | `{useField(group.title, group.titleEn)}` |
|
||||
|
||||
**Note:** Cần thêm `import { useField } from '@/i18n/useField'`.
|
||||
|
||||
#### `src/components/sections/Experience.tsx`
|
||||
|
||||
| Dòng | Current | Fix |
|
||||
|---|---|---|
|
||||
| 46 | `{lang === 'vi' ? exp.title : exp.titleEn}` | `{useField(exp.title, exp.titleEn)}` |
|
||||
| 54 | `{lang === 'vi' ? exp.responsibilities : exp.responsibilitiesEn ?? []}.map(...)` | `{useFieldArray(exp.responsibilities, exp.responsibilitiesEn).map(...)}` |
|
||||
| 64 | `{lang === 'vi' ? achievement.context : achievement.contextEn}` | `{useField(achievement.context, achievement.contextEn)}` |
|
||||
| 73 | `{lang === 'vi' ? achievement.impact : achievement.impactEn}` | `{useField(achievement.impact, achievement.impactEn)}` |
|
||||
|
||||
**Note:** Cần thêm `import { useField, useFieldArray } from '@/i18n/useField'`.
|
||||
|
||||
#### `src/components/sections/Projects.tsx`
|
||||
|
||||
| Dòng | Current | Fix |
|
||||
|---|---|---|
|
||||
| 63 | `{lang === 'vi' ? project.summary : project.summaryEn}` | `{useField(project.summary, project.summaryEn)}` |
|
||||
|
||||
**Note:** Cần thêm `import { useField } from '@/i18n/useField'`.
|
||||
|
||||
#### `src/pages/AboutPage.tsx`
|
||||
|
||||
| Dòng | Current | Fix |
|
||||
|---|---|---|
|
||||
| 62 | `{lang === 'vi' ? group.title : group.titleEn}` | `{useField(group.title, group.titleEn)}` |
|
||||
|
||||
**Note:** File đã có `import { useField }` nhưng chỉ dùng cho bio. Cần thêm cho expertise section.
|
||||
|
||||
#### `src/pages/ExperiencePage.tsx`
|
||||
|
||||
| Dòng | Current | Fix |
|
||||
|---|---|---|
|
||||
| 16 | `{lang === 'vi' ? exp.title : exp.titleEn}` | `{useField(exp.title, exp.titleEn)}` |
|
||||
| 24 | `{lang === 'vi' ? exp.responsibilities : exp.responsibilitiesEn ?? []}.map(...)` | `{useFieldArray(exp.responsibilities, exp.responsibilitiesEn).map(...)}` |
|
||||
| 31 | `{lang === 'vi' ? achievement.context : achievement.contextEn}` | `{useField(achievement.context, achievement.contextEn)}` |
|
||||
| 33 | `{lang === 'vi' ? achievement.impact : achievement.impactEn}` | `{useField(achievement.impact, achievement.impactEn)}` |
|
||||
|
||||
**Note:** Cần thêm `import { useField, useFieldArray } from '@/i18n/useField'`.
|
||||
|
||||
#### `src/pages/ProjectDetailPage.tsx`
|
||||
|
||||
| Dòng | Current | Fix |
|
||||
|---|---|---|
|
||||
| 37 | `{lang === 'vi' ? project.summary : project.summaryEn}` | `{useField(project.summary, project.summaryEn)}` |
|
||||
| 72 | `{lang === 'vi' ? section.title : section.titleEn}` | `{useField(section.title, section.titleEn)}` |
|
||||
| 73 | `{lang === 'vi' ? section.content : section.contentEn}` | `{useField(section.content, section.contentEn)}` |
|
||||
|
||||
**Note:** Cần thêm `import { useField } from '@/i18n/useField'`.
|
||||
|
||||
#### `src/pages/ProjectsListPage.tsx`
|
||||
|
||||
| Dòng | Current | Fix |
|
||||
|---|---|---|
|
||||
| 27 | `{lang === 'vi' ? project.summary : project.summaryEn}` | `{useField(project.summary, project.summaryEn)}` |
|
||||
|
||||
**Note:** Cần thêm `import { useField } from '@/i18n/useField'`.
|
||||
|
||||
---
|
||||
|
||||
## P2: Duplicate DownloadResume Dropdown Logic
|
||||
|
||||
**Impact:** ~120 dòng logic duplicate giữa `Hero.tsx` và `DownloadResume.tsx` — diverge risk cao, khó fix bug ở 2 nơi.
|
||||
|
||||
### Current state
|
||||
|
||||
| Aspect | `Hero.tsx:13-72` | `DownloadResume.tsx:41-99` |
|
||||
|---|---|---|
|
||||
| Component name | `HeroDownloadDropdown` | `DownloadDropdown` |
|
||||
| `langLabels` | Defined locally (line 9-12) | Defined locally (line 7-10) |
|
||||
| Click-outside | `useEffect` + `document.addEventListener` (line 18-31) | `useEffect` + `document.addEventListener` (line 46-59) |
|
||||
| Lazer wrapper | Yes (`download-resume-shared-wrapper` → `lazer-wrapper` → `lazer-border` → `lazer-glow` → `lazer-inner`) | Same structure |
|
||||
| Button content | `resumeDownload[lang]` + chevron SVG | `resumeDownload[lang]` + chevron SVG |
|
||||
| Options | `resumeLanguages.map(lang => <a href={resumeUrlFor(lang)} download target="_blank">)` | `resumeLanguages.map(lang => <a href={resumeUrlFor(lang)} download>)` |
|
||||
| Extra | `hero-download-dropdown`, `hero-download-summary` CSS classes | — |
|
||||
| Export | `HeroDownloadDropdown` (internal to Hero.tsx) | `DownloadResume` (exported, used in Contact.tsx, ContactPage.tsx) |
|
||||
|
||||
### Khác biệt duy nhất
|
||||
|
||||
1. **Hero variant** có lazer border wrapper + custom CSS classes (`hero-download-dropdown`, `hero-download-summary`)
|
||||
2. **Hero variant** dùng `target="_blank"` trên download links
|
||||
3. **DownloadResume variant** có `DownloadButton` fallback component cho single-language case (line 12-39)
|
||||
|
||||
### Đề xuất fix
|
||||
|
||||
Extract thành shared component `DownloadResumeDropdown` với prop để customize:
|
||||
|
||||
```tsx
|
||||
// src/components/sections/DownloadResume.tsx
|
||||
|
||||
interface DownloadResumeDropdownProps {
|
||||
className?: string // Extra class for hero variant
|
||||
wrapperClassName?: string // Extra class for lazer wrapper
|
||||
targetBlank?: boolean // Hero uses target="_blank"
|
||||
}
|
||||
|
||||
function DownloadResumeDropdown({ className, wrapperClassName, targetBlank = false }: DownloadResumeDropdownProps) {
|
||||
// Shared: langLabels, useLanguage, state, click-outside effect, render logic
|
||||
}
|
||||
|
||||
export function DownloadResume() {
|
||||
if (!resumeAvailable) return null
|
||||
// Single language → DownloadButton
|
||||
// Multiple languages → DownloadResumeDropdown
|
||||
}
|
||||
|
||||
// Hero.tsx imports DownloadResumeDropdown and passes:
|
||||
// <DownloadResumeDropdown
|
||||
// className="hero-download-dropdown"
|
||||
// wrapperClassName="hero-download-summary"
|
||||
// targetBlank
|
||||
// />
|
||||
```
|
||||
|
||||
**Files cần sửa:**
|
||||
- `src/components/sections/DownloadResume.tsx` — extract shared dropdown logic
|
||||
- `src/components/sections/Hero.tsx` — replace `HeroDownloadDropdown` with shared component
|
||||
- `src/App.css` — consolidate CSS classes (`.hero-download-dropdown`, `.hero-download-summary`)
|
||||
|
||||
---
|
||||
|
||||
## P3: Hardcoded `langLabels`
|
||||
|
||||
**Impact:** `langLabels: Record<Language, string>` duplicated trong 2 file. Thêm language mới cần edit 2 nơi.
|
||||
|
||||
### Locations
|
||||
|
||||
| File | Dòng | Content |
|
||||
|---|---|---|
|
||||
| `src/components/sections/Hero.tsx` | 9-12 | `{ en: 'English', vi: 'Tiếng Việt' }` |
|
||||
| `src/components/sections/DownloadResume.tsx` | 7-10 | `{ en: 'English', vi: 'Tiếng Việt' }` |
|
||||
|
||||
### Đề xuất fix
|
||||
|
||||
Move vào `src/data/resume.ts` hoặc `strings.common.langLabels`:
|
||||
|
||||
```tsx
|
||||
// src/data/resume.ts
|
||||
export const resumeLanguages: Language[] = ['en', 'vi']
|
||||
export const resumeLanguageLabels: Record<Language, string> = {
|
||||
en: 'English',
|
||||
vi: 'Tiếng Việt',
|
||||
}
|
||||
```
|
||||
|
||||
**Files cần sửa:**
|
||||
- `src/data/resume.ts` — add `resumeLanguageLabels`
|
||||
- `src/components/sections/Hero.tsx` — import from `@/data/resume`
|
||||
- `src/components/sections/DownloadResume.tsx` — import from `@/data/resume`
|
||||
|
||||
---
|
||||
|
||||
## Already Done (reference only)
|
||||
|
||||
Những nơi đã implement đúng i18n patterns — không cần sửa:
|
||||
|
||||
| File | Dòng | Pattern |
|
||||
|---|---|---|
|
||||
| `src/components/sections/Contact.tsx` | 23 | `tag={\`06 - ${strings.common.contactTag[lang]}\`}` |
|
||||
| `src/pages/ExperiencePage.tsx` | 10 | `tag={strings.common.experienceTag[lang]}` |
|
||||
| `src/components/sections/About.tsx` | 16 | `useField(profile.bio, profile.bioEn)` |
|
||||
| `src/pages/AboutPage.tsx` | 23 | `useField(profile.bio, profile.bioEn)` |
|
||||
| `src/components/sections/Expertise.tsx` | 26 | `title={strings.expertise.heading[lang]}` |
|
||||
| `src/components/sections/Experience.tsx` | 26 | `title={strings.experience.heading[lang]}` |
|
||||
| `src/components/sections/Projects.tsx` | 32 | `title={strings.projects.featured[lang]}` |
|
||||
| `src/i18n/useField.ts` | 1-17 | `useField` + `useFieldArray` hooks |
|
||||
| `src/i18n/strings.ts` | 1-88 | All string keys defined |
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
| Priority | Issue | Files affected | Effort |
|
||||
|---|---|---|---|
|
||||
| P1 | Hardcoded Section Heading Tags | 7 files | ~15 min |
|
||||
| P1 | Hardcoded `lang === 'vi'` checks | 7 files, 17 occurrences | ~30 min |
|
||||
| P2 | Duplicate DownloadResume logic | 2 files | ~45 min |
|
||||
| P3 | Hardcoded `langLabels` | 2 files + 1 data file | ~10 min |
|
||||
|
||||
**Total estimated effort:** ~1.5 hours
|
||||
@@ -0,0 +1,144 @@
|
||||
# i18n Phase 1 — Code Review Feedback
|
||||
|
||||
> **Spec:** `docs/design/specs/v3/spec-v3-i18n.md`
|
||||
> **Detail actions:** `docs/feedback/i18n-actions.md`
|
||||
|
||||
---
|
||||
|
||||
## 1. Hardcoded Section Heading Tags
|
||||
|
||||
**Severity:** P1 — Visible wrong behavior on language switch.
|
||||
|
||||
Section number tags are hardcoded English strings instead of using the i18n string system. When user switches to Vietnamese, the title translates but the tag stays in English.
|
||||
|
||||
**Affected files (7 locations):**
|
||||
|
||||
| File | Line | Current | Should be |
|
||||
|---|---|---|---|
|
||||
| `src/components/sections/About.tsx` | 13 | `tag="01 - About"` | `tag={strings.about.heading[lang]}` |
|
||||
| `src/components/sections/Expertise.tsx` | 26 | `tag="02 - Expertise"` | `tag={strings.expertise.heading[lang]}` |
|
||||
| `src/components/sections/Experience.tsx` | 26 | `tag="03 - Experience"` | `tag={strings.experience.heading[lang]}` |
|
||||
| `src/components/sections/Projects.tsx` | 32 | `tag="04 - Projects"` | `tag={strings.projects.featured[lang]}` |
|
||||
| `src/pages/ProjectsListPage.tsx` | 13 | `tag="04 - Projects"` | `tag={strings.projects.all[lang]}` |
|
||||
| `src/pages/AboutPage.tsx` | 19 | `tag="About"` | `tag={strings.about.heading[lang]}` |
|
||||
| `src/pages/EngineeringPage.tsx` | 12 | `tag="Engineering"` | `tag={strings.engineering.heading[lang]}` |
|
||||
|
||||
**Already correct (reference):**
|
||||
- `Contact.tsx:23` — `tag={\`06 - ${strings.common.contactTag[lang]}\`}`
|
||||
- `ExperiencePage.tsx:10` — `tag={strings.common.experienceTag[lang]}`
|
||||
|
||||
**Action:** Replace all hardcoded tag strings with `strings` lookups. See `i18n-actions.md` for exact changes.
|
||||
|
||||
---
|
||||
|
||||
## 2. Hardcoded Language Checks (`lang === 'vi'`)
|
||||
|
||||
**Severity:** P1 — Duplicated conditional logic, hard to maintain when adding new languages.
|
||||
|
||||
17 occurrences of inline `lang === 'vi' ? value : valueEn` pattern across 7 files. The `useField()` / `useFieldArray()` hooks already exist at `src/i18n/useField.ts` but are not consistently used.
|
||||
|
||||
**Affected files:**
|
||||
|
||||
| File | Lines | Pattern |
|
||||
|---|---|---|
|
||||
| `src/components/sections/Expertise.tsx` | 43 | `group.title / group.titleEn` |
|
||||
| `src/components/sections/Experience.tsx` | 46, 54, 64, 73 | `exp.title`, `exp.responsibilities`, `achievement.context`, `achievement.impact` |
|
||||
| `src/components/sections/Projects.tsx` | 63 | `project.summary / project.summaryEn` |
|
||||
| `src/pages/AboutPage.tsx` | 62 | `group.title / group.titleEn` |
|
||||
| `src/pages/ExperiencePage.tsx` | 16, 24, 31, 33 | `exp.title`, `exp.responsibilities`, `achievement.context`, `achievement.impact` |
|
||||
| `src/pages/ProjectDetailPage.tsx` | 37, 72, 73 | `project.summary`, `section.title`, `section.content` |
|
||||
| `src/pages/ProjectsListPage.tsx` | 27 | `project.summary / project.summaryEn` |
|
||||
|
||||
**Action:** Replace with `useField(value, valueEn)` for single values or `useFieldArray(arr, arrEn)` for arrays. See `i18n-actions.md` for exact changes.
|
||||
|
||||
---
|
||||
|
||||
## 3. Duplicate DownloadResume Dropdown Logic
|
||||
|
||||
**Severity:** P2 — ~120 lines of duplicate code between `Hero.tsx` and `DownloadResume.tsx`. Diverge risk when fixing bugs.
|
||||
|
||||
Both files contain nearly identical implementations of:
|
||||
- `langLabels` constant
|
||||
- `useEffect` click-outside listener
|
||||
- Lazer border wrapper structure
|
||||
- Dropdown options rendering
|
||||
|
||||
**Differences:**
|
||||
- Hero variant: custom CSS classes (`hero-download-dropdown`, `hero-download-summary`), `target="_blank"` on links
|
||||
- DownloadResume variant: `DownloadButton` fallback for single-language case
|
||||
|
||||
**Action:** Extract shared `DownloadResumeDropdown` component with `className` / `wrapperClassName` / `targetBlank` props. See `i18n-actions.md` for design proposal.
|
||||
|
||||
---
|
||||
|
||||
## 4. Hardcoded `langLabels`
|
||||
|
||||
**Severity:** P3 — `langLabels` duplicated in 2 files. Adding a new language requires editing 2 places.
|
||||
|
||||
**Locations:**
|
||||
- `src/components/sections/Hero.tsx:9-12`
|
||||
- `src/components/sections/DownloadResume.tsx:7-10`
|
||||
|
||||
**Action:** Move `langLabels` into `src/data/resume.ts` or `strings.common.langLabels` and import from there.
|
||||
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
## Status: All Issues Resolved
|
||||
|
||||
**Completed:** 2025-01-01
|
||||
|
||||
### P1 — Hardcoded Section Heading Tags
|
||||
**Status:** ✅ Resolved
|
||||
|
||||
All 7 SectionHeading tags now use `strings` lookups:
|
||||
- `About.tsx:13` → `tag={strings.about.heading[lang]}`
|
||||
- `Expertise.tsx:26` → `tag={strings.expertise.heading[lang]}`
|
||||
- `Experience.tsx:26` → `tag={strings.experience.heading[lang]}`
|
||||
- `Projects.tsx:32` → `tag={strings.projects.featured[lang]}`
|
||||
- `ProjectsListPage.tsx:13` → `tag={strings.projects.all[lang]}`
|
||||
- `AboutPage.tsx:19` → `tag={strings.about.heading[lang]}`
|
||||
- `EngineeringPage.tsx:12` → `tag={strings.engineering.heading[lang]}`
|
||||
|
||||
### P1 — Hardcoded Language Checks
|
||||
**Status:** ✅ Resolved
|
||||
|
||||
All 17 occurrences replaced with `useField()` / `useFieldArray()` hooks:
|
||||
- `Expertise.tsx` — 1 replacement
|
||||
- `Experience.tsx` — 4 replacements
|
||||
- `Projects.tsx` — 1 replacement
|
||||
- `AboutPage.tsx` — 1 replacement
|
||||
- `ExperiencePage.tsx` — 4 replacements
|
||||
- `ProjectDetailPage.tsx` — 3 replacements
|
||||
- `ProjectsListPage.tsx` — 1 replacement
|
||||
|
||||
### P2 — Duplicate DownloadResume Dropdown
|
||||
**Status:** ✅ Resolved
|
||||
|
||||
Extracted shared `DownloadResumeDropdown` component in `DownloadResume.tsx` with:
|
||||
- `className` prop for outer div customization
|
||||
- `wrapperClassName` prop for button customization
|
||||
- `targetBlank` prop for link target attribute
|
||||
|
||||
Hero.tsx now imports and uses the shared component with hero-specific props.
|
||||
|
||||
### P3 — Hardcoded langLabels
|
||||
**Status:** ✅ Resolved
|
||||
|
||||
Moved `langLabels` to `src/data/resume.ts` as `resumeLanguageLabels`.
|
||||
Both Hero.tsx and DownloadResume.tsx now import from there.
|
||||
|
||||
## Already Done (reference only)
|
||||
|
||||
These locations already follow i18n patterns correctly:
|
||||
|
||||
| File | Line | Pattern |
|
||||
|---|---|---|
|
||||
| `Contact.tsx` | 23 | `tag={\`06 - ${strings.common.contactTag[lang]}\`}` |
|
||||
| `ExperiencePage.tsx` | 10 | `tag={strings.common.experienceTag[lang]}` |
|
||||
| `About.tsx` | 16 | `useField(profile.bio, profile.bioEn)` |
|
||||
| `AboutPage.tsx` | 23 | `useField(profile.bio, profile.bioEn)` |
|
||||
| `Expertise.tsx` | 26 | `title={strings.expertise.heading[lang]}` |
|
||||
| `Experience.tsx` | 26 | `title={strings.experience.heading[lang]}` |
|
||||
| `Projects.tsx` | 32 | `title={strings.projects.featured[lang]}` |
|
||||
@@ -10,7 +10,7 @@ export function About() {
|
||||
return (
|
||||
<InView>
|
||||
<section className="section container-wide" aria-labelledby="about-heading">
|
||||
<SectionHeading title={strings.about.heading[lang]} tag="01 - About" />
|
||||
<SectionHeading title={strings.about.heading[lang]} tag={strings.about.heading[lang]} />
|
||||
<div style={{ maxWidth: '700px' }}>
|
||||
<p style={{ fontSize: '18px', marginBottom: '32px' }}>
|
||||
{useField(profile.bio, profile.bioEn)}
|
||||
|
||||
@@ -20,7 +20,8 @@ export function Contact() {
|
||||
visible: { opacity: 1, transition: { duration: 0.5 } },
|
||||
}}
|
||||
>
|
||||
<SectionHeading title={strings.contact.heading[lang]} tag={`06 - ${strings.common.contactTag[lang]}`} />
|
||||
|
||||
<SectionHeading title={strings.contact.heading[lang]} tag={strings.common.contactTag[lang]} />
|
||||
<div style={{ maxWidth: '700px' }}>
|
||||
<div className="contact-links">
|
||||
<motion.a
|
||||
|
||||
@@ -1,12 +1,74 @@
|
||||
import { resumeAvailable, resumeUrlFor, resumeLanguages } from '@/data/resume'
|
||||
import { resumeAvailable, resumeUrlFor, resumeLanguages, resumeLanguageLabels } from '@/data/resume'
|
||||
import type { Language } from '@/types'
|
||||
import { useState, useRef, useEffect } from 'react'
|
||||
import { useLanguage } from '@/hooks/useLanguage'
|
||||
import { strings } from '@/i18n/strings'
|
||||
|
||||
const langLabels: Record<Language, string> = {
|
||||
en: 'English',
|
||||
vi: 'Tiếng Việt',
|
||||
interface DownloadResumeDropdownProps {
|
||||
className?: string
|
||||
wrapperClassName?: string
|
||||
targetBlank?: boolean
|
||||
}
|
||||
|
||||
function DownloadResumeDropdown({ className, wrapperClassName, targetBlank = false }: DownloadResumeDropdownProps) {
|
||||
const { lang } = useLanguage()
|
||||
const [open, setOpen] = useState(false)
|
||||
const ref = useRef<HTMLDivElement>(null)
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) return
|
||||
const listener = (e: MouseEvent | TouchEvent) => {
|
||||
if (ref.current && !ref.current.contains(e.target as Node)) {
|
||||
setOpen(false)
|
||||
}
|
||||
}
|
||||
document.addEventListener('mousedown', listener)
|
||||
document.addEventListener('touchstart', listener)
|
||||
return () => {
|
||||
document.removeEventListener('mousedown', listener)
|
||||
document.removeEventListener('touchstart', listener)
|
||||
}
|
||||
}, [open])
|
||||
|
||||
return (
|
||||
<div ref={ref} className={`download-resume-dropdown ${className ?? ''}`}>
|
||||
<div className="download-resume-shared-wrapper">
|
||||
<div className="download-resume-lazer-wrapper">
|
||||
<div className="download-resume-lazer-border" />
|
||||
<div className="download-resume-lazer-glow" />
|
||||
<div className="download-resume-lazer-inner">
|
||||
<button
|
||||
className={`download-resume-summary ${wrapperClassName ?? ''} ${open ? 'open' : ''}`}
|
||||
onClick={() => setOpen(!open)}
|
||||
type="button"
|
||||
>
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" width="20" height="20">
|
||||
<path d="M12 3v10m0 0l-3-3m3 3l3-3" />
|
||||
<path d="M3 17h18" />
|
||||
</svg>
|
||||
<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">
|
||||
<polyline points="6 9 12 15 18 9" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className={`download-resume-options ${open ? 'open' : ''}`}>
|
||||
{resumeLanguages.map(lang => (
|
||||
<a
|
||||
key={lang}
|
||||
href={resumeUrlFor(lang)}
|
||||
download
|
||||
target={targetBlank ? '_blank' : undefined}
|
||||
className="download-resume-option"
|
||||
>
|
||||
{resumeLanguageLabels[lang]}
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function DownloadButton({ lang }: { lang: Language }) {
|
||||
@@ -28,86 +90,28 @@ function DownloadButton({ lang }: { lang: Language }) {
|
||||
}}
|
||||
>
|
||||
<svg viewBox="0 0 24 24" fill="currentColor" width="24" height="24">
|
||||
<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 0 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>
|
||||
<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)' }}>{resumeLanguageLabels[lang]}</div>
|
||||
</div>
|
||||
</a>
|
||||
)
|
||||
}
|
||||
|
||||
function DownloadDropdown() {
|
||||
const { lang } = useLanguage()
|
||||
const [open, setOpen] = useState(false)
|
||||
const ref = useRef<HTMLDivElement>(null)
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) return
|
||||
const listener = (e: MouseEvent | TouchEvent) => {
|
||||
if (ref.current && !ref.current.contains(e.target as Node)) {
|
||||
setOpen(false)
|
||||
}
|
||||
}
|
||||
document.addEventListener('mousedown', listener)
|
||||
document.addEventListener('touchstart', listener)
|
||||
return () => {
|
||||
document.removeEventListener('mousedown', listener)
|
||||
document.removeEventListener('touchstart', listener)
|
||||
}
|
||||
}, [open])
|
||||
|
||||
return (
|
||||
<div ref={ref} className="download-resume-dropdown">
|
||||
<div className="download-resume-shared-wrapper">
|
||||
<div className="download-resume-lazer-wrapper">
|
||||
<div className="download-resume-lazer-border" />
|
||||
<div className="download-resume-lazer-glow" />
|
||||
<div className="download-resume-lazer-inner">
|
||||
<button
|
||||
className={`download-resume-summary ${open ? 'open' : ''}`}
|
||||
onClick={() => setOpen(!open)}
|
||||
type="button"
|
||||
>
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" width="20" height="20">
|
||||
<path d="M12 3v10m0 0l-3-3m3 3l3-3" />
|
||||
<path d="M3 17h18" />
|
||||
</svg>
|
||||
<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">
|
||||
<polyline points="6 9 12 15 18 9" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className={`download-resume-options ${open ? 'open' : ''}`}>
|
||||
{resumeLanguages.map(lang => (
|
||||
<a
|
||||
key={lang}
|
||||
href={resumeUrlFor(lang)}
|
||||
download
|
||||
className="download-resume-option"
|
||||
>
|
||||
{langLabels[lang]}
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export function DownloadResume() {
|
||||
if (!resumeAvailable) return null
|
||||
|
||||
return (
|
||||
<div style={{ marginTop: '32px' }}>
|
||||
{resumeLanguages.length > 1 ? (
|
||||
<DownloadDropdown />
|
||||
<DownloadResumeDropdown />
|
||||
) : (
|
||||
<DownloadButton lang={resumeLanguages[0]} />
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export { DownloadResumeDropdown }
|
||||
@@ -4,6 +4,7 @@ import { experiences } from "@/data/experience"
|
||||
import { InView } from "@/components/ui/InView"
|
||||
import { useLanguage } from '@/hooks/useLanguage'
|
||||
import { strings } from '@/i18n/strings'
|
||||
import { useField, useFieldArray } from '@/i18n/useField'
|
||||
|
||||
export function Experience() {
|
||||
const { lang } = useLanguage()
|
||||
@@ -23,7 +24,7 @@ export function Experience() {
|
||||
},
|
||||
}}
|
||||
>
|
||||
<SectionHeading title={strings.experience.heading[lang]} tag="03 - Experience" />
|
||||
<SectionHeading title={strings.experience.heading[lang]} tag={strings.experience.heading[lang]} />
|
||||
<div style={{ maxWidth: '700px' }}>
|
||||
<div className="timeline">
|
||||
{experiences.map((exp, i) => (
|
||||
@@ -43,7 +44,7 @@ export function Experience() {
|
||||
>
|
||||
<div className="timeline-marker" />
|
||||
<div className="timeline-header">
|
||||
<div className="timeline-title">{lang === 'vi' ? exp.title : exp.titleEn}</div>
|
||||
<div className="timeline-title">{useField(exp.title, exp.titleEn)}</div>
|
||||
<div className="timeline-company">{exp.company}</div>
|
||||
<div className="timeline-duration">{exp.duration}</div>
|
||||
{exp.location && (
|
||||
@@ -51,7 +52,7 @@ export function Experience() {
|
||||
)}
|
||||
</div>
|
||||
<ul className="timeline-responsibilities">
|
||||
{(lang === 'vi' ? exp.responsibilities : exp.responsibilitiesEn ?? []).map((r) => (
|
||||
{useFieldArray(exp.responsibilities, exp.responsibilitiesEn).map((r) => (
|
||||
<li key={r}>{r}</li>
|
||||
))}
|
||||
</ul>
|
||||
@@ -61,7 +62,7 @@ export function Experience() {
|
||||
{achievement.title}
|
||||
</div>
|
||||
<div className="achievement-context">
|
||||
{lang === 'vi' ? achievement.context : achievement.contextEn}
|
||||
{useField(achievement.context, achievement.contextEn)}
|
||||
</div>
|
||||
<div
|
||||
style={{
|
||||
@@ -70,7 +71,7 @@ export function Experience() {
|
||||
marginBottom: "8px",
|
||||
}}
|
||||
>
|
||||
{lang === 'vi' ? achievement.impact : achievement.impactEn}
|
||||
{useField(achievement.impact, achievement.impactEn)}
|
||||
</div>
|
||||
{achievement.metrics &&
|
||||
achievement.metrics.length > 0 && (
|
||||
|
||||
@@ -4,6 +4,7 @@ import { skillGroups } from "@/data/skills"
|
||||
import { InView } from "@/components/ui/InView"
|
||||
import { useLanguage } from '@/hooks/useLanguage'
|
||||
import { strings } from '@/i18n/strings'
|
||||
import { useField } from '@/i18n/useField'
|
||||
|
||||
export function Expertise() {
|
||||
const { lang } = useLanguage()
|
||||
@@ -23,7 +24,7 @@ export function Expertise() {
|
||||
},
|
||||
}}
|
||||
>
|
||||
<SectionHeading title={strings.expertise.heading[lang]} tag="02 - Expertise" />
|
||||
<SectionHeading title={strings.expertise.heading[lang]} tag={strings.expertise.heading[lang]} />
|
||||
<div className="expertise-grid">
|
||||
{skillGroups.map((group, i) => (
|
||||
<motion.div
|
||||
@@ -40,7 +41,7 @@ export function Expertise() {
|
||||
whileHover={{ scale: 1.05, y: -2 }}
|
||||
whileTap={{ scale: 0.98 }}
|
||||
>
|
||||
<h3>{lang === 'vi' ? group.title : group.titleEn}</h3>
|
||||
<h3>{useField(group.title, group.titleEn)}</h3>
|
||||
<ul className="expertise-skills">
|
||||
{group.skills.map((skill) => (
|
||||
<li key={skill} className="expertise-skill">
|
||||
|
||||
@@ -1,75 +1,11 @@
|
||||
import { useState, useRef, useEffect } from 'react'
|
||||
import { motion, useScroll, useTransform } from "motion/react"
|
||||
import { InView } from "@/components/ui/InView"
|
||||
import { resumeAvailable, resumeLanguages, resumeUrlFor } from "@/data/resume"
|
||||
import { resumeAvailable, resumeLanguages, resumeUrlFor, resumeLanguageLabels } from "@/data/resume"
|
||||
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> = {
|
||||
en: 'English',
|
||||
vi: 'Tiếng Việt',
|
||||
}
|
||||
function HeroDownloadDropdown() {
|
||||
const { lang } = useLanguage()
|
||||
const [open, setOpen] = useState(false)
|
||||
const ref = useRef<HTMLDivElement>(null)
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) return
|
||||
const listener = (e: MouseEvent | TouchEvent) => {
|
||||
if (ref.current && !ref.current.contains(e.target as Node)) {
|
||||
setOpen(false)
|
||||
}
|
||||
}
|
||||
document.addEventListener('mousedown', listener)
|
||||
document.addEventListener('touchstart', listener)
|
||||
return () => {
|
||||
document.removeEventListener('mousedown', listener)
|
||||
document.removeEventListener('touchstart', listener)
|
||||
}
|
||||
}, [open])
|
||||
|
||||
return (
|
||||
<div ref={ref} className="download-resume-dropdown hero-download-dropdown">
|
||||
<div className="download-resume-shared-wrapper">
|
||||
<div className="download-resume-lazer-wrapper">
|
||||
<div className="download-resume-lazer-border" />
|
||||
<div className="download-resume-lazer-glow" />
|
||||
<div className="download-resume-lazer-inner">
|
||||
<button
|
||||
className={`download-resume-summary hero-download-summary ${open ? 'open' : ''}`}
|
||||
onClick={() => setOpen(!open)}
|
||||
type="button"
|
||||
>
|
||||
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" width="18" height="18">
|
||||
<path d="M12 3v10m0 0l-3-3m3 3l3-3" />
|
||||
<path d="M3 17h18" />
|
||||
</svg>
|
||||
<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">
|
||||
<polyline points="6 9 12 15 18 9" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className={`download-resume-options ${open ? 'open' : ''}`}>
|
||||
{resumeLanguages.map(lang => (
|
||||
<a
|
||||
key={lang}
|
||||
href={resumeUrlFor(lang)}
|
||||
download
|
||||
target="_blank"
|
||||
className="download-resume-option"
|
||||
>
|
||||
{langLabels[lang]}
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
import { DownloadResumeDropdown } from '@/components/sections/DownloadResume'
|
||||
|
||||
function HeroDownloadButton({ lang }: { lang: Language }) {
|
||||
return (
|
||||
@@ -79,7 +15,7 @@ function HeroDownloadButton({ lang }: { lang: Language }) {
|
||||
target="_blank"
|
||||
className="btn btn-primary hero-download-mobile-btn"
|
||||
>
|
||||
Download Resume ({langLabels[lang]})
|
||||
Download Resume ({resumeLanguageLabels[lang]})
|
||||
</a>
|
||||
)
|
||||
}
|
||||
@@ -194,7 +130,7 @@ export function Hero() {
|
||||
{resumeAvailable && (
|
||||
<>
|
||||
<div className="hero-download-desktop">
|
||||
<HeroDownloadDropdown />
|
||||
<DownloadResumeDropdown className="hero-download-dropdown" wrapperClassName="hero-download-summary" targetBlank />
|
||||
</div>
|
||||
<div className="hero-download-mobile">
|
||||
{resumeLanguages.map(lang => (
|
||||
|
||||
@@ -6,6 +6,7 @@ import { projects } from "@/data/projects"
|
||||
import { InView } from "@/components/ui/InView"
|
||||
import { useLanguage } from '@/hooks/useLanguage'
|
||||
import { strings } from '@/i18n/strings'
|
||||
import { useField } from '@/i18n/useField'
|
||||
|
||||
const MotionLink = motion.create(Link)
|
||||
|
||||
@@ -29,7 +30,7 @@ export function Projects() {
|
||||
},
|
||||
}}
|
||||
>
|
||||
<SectionHeading title={strings.projects.featured[lang]} tag="04 - Projects" />
|
||||
<SectionHeading title={strings.projects.featured[lang]} tag={strings.projects.featured[lang]} />
|
||||
<Link
|
||||
to="/projects"
|
||||
style={{ fontSize: "14px", fontWeight: 500, color: "var(--accent)", display: "block", marginBottom: "24px" }}
|
||||
@@ -60,7 +61,7 @@ export function Projects() {
|
||||
{strings.projects.categories[project.category][lang]}
|
||||
</Badge>
|
||||
</div>
|
||||
<p className="project-card-summary">{lang === 'vi' ? project.summary : project.summaryEn}</p>
|
||||
<p className="project-card-summary">{useField(project.summary, project.summaryEn)}</p>
|
||||
<div className="project-card-techs">
|
||||
{project.technologies.slice(0, 4).map((tech) => (
|
||||
<span key={tech} className="tag">
|
||||
|
||||
@@ -3,6 +3,10 @@ import type { Language } from '@/types'
|
||||
export const resumeAvailable = true
|
||||
|
||||
export const resumeLanguages: Language[] = ['en', 'vi']
|
||||
export const resumeLanguageLabels: Record<Language, string> = {
|
||||
en: 'English',
|
||||
vi: 'Tiếng Việt',
|
||||
}
|
||||
|
||||
export const resumeUrlFor = (lang: Language): string =>
|
||||
lang === 'en' ? '/resume.pdf' : `/resume-${lang}.pdf`
|
||||
@@ -16,7 +16,7 @@ export function AboutPage() {
|
||||
<SectionHeading
|
||||
title={strings.about.heading[lang]}
|
||||
subtitle={strings.about.subtitle[lang]}
|
||||
tag="About"
|
||||
tag={strings.about.heading[lang]}
|
||||
/>
|
||||
<div style={{ maxWidth: '700px' }}>
|
||||
<p style={{ fontSize: '18px', marginBottom: '32px' }}>
|
||||
@@ -59,7 +59,7 @@ export function AboutPage() {
|
||||
<div className="expertise-grid">
|
||||
{skillGroups.map((group) => (
|
||||
<div key={group.title} className="expertise-card">
|
||||
<h3>{lang === 'vi' ? group.title : group.titleEn}</h3>
|
||||
<h3>{useField(group.title, group.titleEn)}</h3>
|
||||
<ul className="expertise-skills">
|
||||
{group.skills.map((skill: string) => (
|
||||
<li key={skill} className="expertise-skill">
|
||||
|
||||
@@ -9,7 +9,7 @@ export function EngineeringPage() {
|
||||
const { lang } = useLanguage()
|
||||
return (
|
||||
<section className="section container-content" aria-labelledby="engineering-heading">
|
||||
<SectionHeading title={strings.engineering.heading[lang]} tag="Engineering" />
|
||||
<SectionHeading title={strings.engineering.heading[lang]} tag={strings.engineering.heading[lang]} />
|
||||
|
||||
{engineeringCategoryKeys.map((catKey) => (
|
||||
<div key={catKey} style={{ marginBottom: '48px' }}>
|
||||
|
||||
@@ -2,6 +2,7 @@ import { SectionHeading } from '@/components/ui/SectionHeading'
|
||||
import { experiences } from '@/data/experience'
|
||||
import { useLanguage } from '@/hooks/useLanguage'
|
||||
import { strings } from '@/i18n/strings'
|
||||
import { useField, useFieldArray } from '@/i18n/useField'
|
||||
|
||||
export function ExperiencePage() {
|
||||
const { lang } = useLanguage()
|
||||
@@ -13,7 +14,7 @@ export function ExperiencePage() {
|
||||
<div key={exp.id} className="timeline-entry">
|
||||
<div className="timeline-marker" />
|
||||
<div className="timeline-header">
|
||||
<div className="timeline-title">{lang === 'vi' ? exp.title : exp.titleEn}</div>
|
||||
<div className="timeline-title">{useField(exp.title, exp.titleEn)}</div>
|
||||
<div className="timeline-company">{exp.company}</div>
|
||||
<div className="timeline-duration">{exp.duration}</div>
|
||||
{exp.location && (
|
||||
@@ -21,16 +22,16 @@ export function ExperiencePage() {
|
||||
)}
|
||||
</div>
|
||||
<ul className="timeline-responsibilities">
|
||||
{(lang === 'vi' ? exp.responsibilities : exp.responsibilitiesEn ?? []).map((r) => (
|
||||
{useFieldArray(exp.responsibilities, exp.responsibilitiesEn).map((r) => (
|
||||
<li key={r}>{r}</li>
|
||||
))}
|
||||
</ul>
|
||||
{exp.achievements?.map((achievement) => (
|
||||
<div key={achievement.id} className="achievement">
|
||||
<div className="achievement-title">{achievement.title}</div>
|
||||
<div className="achievement-context">{lang === 'vi' ? achievement.context : achievement.contextEn}</div>
|
||||
<div className="achievement-context">{useField(achievement.context, achievement.contextEn)}</div>
|
||||
<div style={{ fontSize: '14px', color: 'var(--text-secondary)', marginBottom: '8px' }}>
|
||||
{lang === 'vi' ? achievement.impact : achievement.impactEn}
|
||||
{useField(achievement.impact, achievement.impactEn)}
|
||||
</div>
|
||||
{achievement.metrics && achievement.metrics.length > 0 && (
|
||||
<div style={{ marginBottom: '8px' }}>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { Tag } from '@/components/ui/Tag'
|
||||
import { projects } from '@/data/projects'
|
||||
import { useLanguage } from '@/hooks/useLanguage'
|
||||
import { strings } from '@/i18n/strings'
|
||||
import { useField } from '@/i18n/useField'
|
||||
|
||||
|
||||
export function ProjectDetailPage() {
|
||||
@@ -34,7 +35,7 @@ export function ProjectDetailPage() {
|
||||
</div>
|
||||
|
||||
<p style={{ fontSize: '18px', color: 'var(--text-secondary)', marginBottom: '32px' }}>
|
||||
{lang === 'vi' ? project.summary : project.summaryEn}
|
||||
{useField(project.summary, project.summaryEn)}
|
||||
</p>
|
||||
|
||||
{project.metrics && project.metrics.length > 0 && (
|
||||
@@ -69,8 +70,8 @@ export function ProjectDetailPage() {
|
||||
<h3 style={{ fontSize: '16px', marginBottom: '12px', color: 'var(--text-primary)' }}>{strings.projectDetail.experiments[lang]}</h3>
|
||||
{project.sections.map((section, idx) => (
|
||||
<div key={idx} style={{ marginBottom: '16px', padding: '16px', background: 'var(--bg-surface)', borderRadius: '8px' }}>
|
||||
<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)' }}>{lang === 'vi' ? section.content : section.contentEn}</p>
|
||||
<h4 style={{ fontSize: '14px', marginBottom: '4px', color: 'var(--text-primary)' }}>{useField(section.title, section.titleEn)}</h4>
|
||||
<p style={{ fontSize: '14px', color: 'var(--text-secondary)' }}>{useField(section.content, section.contentEn)}</p>
|
||||
<Tag accent>{section.type}</Tag>
|
||||
</div>
|
||||
))}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { Badge } from '@/components/ui/Badge'
|
||||
import { projects } from '@/data/projects'
|
||||
import { useLanguage } from '@/hooks/useLanguage'
|
||||
import { strings } from '@/i18n/strings'
|
||||
import { useField } from '@/i18n/useField'
|
||||
|
||||
import { Link } from 'react-router'
|
||||
|
||||
@@ -10,7 +11,7 @@ export function ProjectsListPage() {
|
||||
const { lang } = useLanguage()
|
||||
return (
|
||||
<section className="section container-wide" aria-labelledby="projects-heading">
|
||||
<SectionHeading title={strings.projects.all[lang]} tag="04 - Projects" />
|
||||
<SectionHeading title={strings.projects.all[lang]} tag={strings.projects.all[lang]} />
|
||||
<div className="projects-grid">
|
||||
{projects.map((project) => (
|
||||
<Link
|
||||
@@ -24,7 +25,7 @@ export function ProjectsListPage() {
|
||||
{strings.projects.categories[project.category][lang]}
|
||||
</Badge>
|
||||
</div>
|
||||
<p className="project-card-summary">{lang === 'vi' ? project.summary : project.summaryEn}</p>
|
||||
<p className="project-card-summary">{useField(project.summary, project.summaryEn)}</p>
|
||||
<div className="project-card-techs">
|
||||
{project.technologies.slice(0, 4).map((tech) => (
|
||||
<span key={tech} className="tag">
|
||||
|
||||
Reference in new issue
Block a user