2026-10-06 14:14:01 +07:00
|
|
|
import { useParams, Link } from 'react-router'
|
2026-10-06 11:42:11 +07:00
|
|
|
import { Badge } from '@/components/ui/Badge'
|
|
|
|
|
import { Tag } from '@/components/ui/Tag'
|
|
|
|
|
import { projects } from '@/data/projects'
|
2026-10-14 11:15:48 +07:00
|
|
|
import { useLanguage } from '@/hooks/useLanguage'
|
|
|
|
|
import { strings } from '@/i18n/strings'
|
2026-10-14 14:50:27 +07:00
|
|
|
import { useField } from '@/i18n/useField'
|
2026-10-06 11:42:11 +07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
export function ProjectDetailPage() {
|
|
|
|
|
const { id } = useParams<{ id: string }>()
|
2026-10-14 11:15:48 +07:00
|
|
|
const { lang } = useLanguage()
|
2026-10-06 11:42:11 +07:00
|
|
|
const project = projects.find((p) => p.id === id)
|
|
|
|
|
|
|
|
|
|
if (!project) {
|
|
|
|
|
return (
|
|
|
|
|
<section className="section container-content">
|
2026-10-14 11:15:48 +07:00
|
|
|
<h2>{strings.projectDetail.notFound[lang]}</h2>
|
2026-10-06 11:42:11 +07:00
|
|
|
<p>
|
2026-10-14 11:15:48 +07:00
|
|
|
<Link to="/projects">{strings.projectDetail.backToProjects[lang]} ←</Link>
|
2026-10-06 11:42:11 +07:00
|
|
|
</p>
|
|
|
|
|
</section>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<section className="section container-content" aria-labelledby="project-title">
|
2026-10-16 21:29:40 +07:00
|
|
|
<Link to="/projects" className="back-link">
|
2026-10-14 11:15:48 +07:00
|
|
|
{strings.projectDetail.backToProjects[lang]} ←
|
2026-10-06 11:42:11 +07:00
|
|
|
</Link>
|
|
|
|
|
|
|
|
|
|
<div style={{ display: 'flex', alignItems: 'center', gap: '16px', marginBottom: '16px' }}>
|
|
|
|
|
<h1 id="project-title" style={{ flex: 1 }}>{project.title}</h1>
|
2026-10-14 11:15:48 +07:00
|
|
|
<Badge variant="outline">{strings.projects.categories[project.category][lang]}</Badge>
|
2026-10-06 11:42:11 +07:00
|
|
|
</div>
|
|
|
|
|
|
2026-10-16 21:29:40 +07:00
|
|
|
<p className="prose-lede">
|
2026-10-14 14:50:27 +07:00
|
|
|
{useField(project.summary, project.summaryEn)}
|
2026-10-06 11:42:11 +07:00
|
|
|
</p>
|
|
|
|
|
|
2026-10-16 21:29:40 +07:00
|
|
|
<div className="prose">
|
|
|
|
|
{project.metrics && project.metrics.length > 0 && (
|
|
|
|
|
<div>
|
|
|
|
|
<h3>{strings.projectDetail.impact[lang]}</h3>
|
|
|
|
|
<div style={{ display: 'flex', gap: '16px', flexWrap: 'wrap' }}>
|
|
|
|
|
{project.metrics.map((m) => (
|
|
|
|
|
<span key={m} className="achievement-metric">
|
|
|
|
|
{m}
|
|
|
|
|
</span>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<h3>{strings.projectDetail.role[lang]}</h3>
|
|
|
|
|
<p>{project.role}</p>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<h3>{strings.projectDetail.technologies[lang]}</h3>
|
|
|
|
|
<div className="philosophy-keywords">
|
|
|
|
|
{project.technologies.map((tech) => (
|
|
|
|
|
<Tag key={tech}>{tech}</Tag>
|
2026-10-06 11:42:11 +07:00
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-10-16 21:29:40 +07:00
|
|
|
{project.sections && project.sections.length > 0 && (
|
|
|
|
|
<div>
|
|
|
|
|
<h3>{strings.projectDetail.experiments[lang]}</h3>
|
|
|
|
|
{project.sections.map((section, idx) => (
|
|
|
|
|
<div key={idx} className="project-section">
|
|
|
|
|
<h4>{useField(section.title, section.titleEn)}</h4>
|
|
|
|
|
<p>{useField(section.content, section.contentEn)}</p>
|
|
|
|
|
<Tag accent>{section.type}</Tag>
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2026-10-06 11:42:11 +07:00
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
)
|
|
|
|
|
}
|