2026-10-06 14:14:01 +07:00
|
|
|
import { useParams, Link } from 'react-router'
|
2026-10-17 20:02:47 +07:00
|
|
|
import { motion, type Transition } from 'motion/react'
|
2026-10-06 11:42:11 +07:00
|
|
|
import { Badge } from '@/components/ui/Badge'
|
|
|
|
|
import { Tag } from '@/components/ui/Tag'
|
2026-10-22 09:55:24 +07:00
|
|
|
import { EditableText } from '@/components/ui/EditableText'
|
2026-10-17 20:02:47 +07:00
|
|
|
import { InView } from '@/components/ui/InView'
|
2026-10-22 07:29:06 +07:00
|
|
|
import { useI18n } from '@/i18n/provider'
|
2026-10-06 11:42:11 +07:00
|
|
|
|
2026-10-17 20:02:47 +07:00
|
|
|
const sectionVariants = {
|
|
|
|
|
hidden: { opacity: 0 },
|
|
|
|
|
visible: { opacity: 1, transition: { duration: 0.5 } },
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const itemTransition = (delay: number): Transition => ({
|
|
|
|
|
duration: 0.45,
|
|
|
|
|
ease: 'easeOut',
|
|
|
|
|
delay,
|
|
|
|
|
})
|
2026-10-06 11:42:11 +07:00
|
|
|
|
|
|
|
|
export function ProjectDetailPage() {
|
|
|
|
|
const { id } = useParams<{ id: string }>()
|
2026-10-22 07:29:06 +07:00
|
|
|
const { ui: s, content: c } = useI18n()
|
|
|
|
|
const project = c.projects.find((p) => p.id === id)
|
2026-10-06 11:42:11 +07:00
|
|
|
|
|
|
|
|
if (!project) {
|
|
|
|
|
return (
|
2026-10-17 20:02:47 +07:00
|
|
|
<InView>
|
|
|
|
|
<motion.section
|
|
|
|
|
className="section container-content"
|
|
|
|
|
initial="hidden"
|
|
|
|
|
whileInView="visible"
|
|
|
|
|
viewport={{ once: true, amount: 0.1 }}
|
|
|
|
|
variants={sectionVariants}
|
|
|
|
|
>
|
2026-10-22 07:29:06 +07:00
|
|
|
<h2>{s.projectDetail.notFound}</h2>
|
2026-10-17 20:02:47 +07:00
|
|
|
<p>
|
2026-10-22 07:29:06 +07:00
|
|
|
<Link to="/projects">{s.projectDetail.backToProjects} ←</Link>
|
2026-10-17 20:02:47 +07:00
|
|
|
</p>
|
|
|
|
|
</motion.section>
|
|
|
|
|
</InView>
|
2026-10-06 11:42:11 +07:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
2026-10-17 20:02:47 +07:00
|
|
|
<InView>
|
|
|
|
|
<motion.section
|
|
|
|
|
className="section container-content"
|
|
|
|
|
aria-labelledby="project-title"
|
|
|
|
|
initial="hidden"
|
|
|
|
|
whileInView="visible"
|
|
|
|
|
viewport={{ once: true, amount: 0.1 }}
|
|
|
|
|
variants={sectionVariants}
|
|
|
|
|
>
|
|
|
|
|
<Link to="/projects" className="back-link">
|
2026-10-22 07:29:06 +07:00
|
|
|
{s.projectDetail.backToProjects} ←
|
2026-10-17 20:02:47 +07:00
|
|
|
</Link>
|
2026-10-06 11:42:11 +07:00
|
|
|
|
2026-10-17 20:02:47 +07:00
|
|
|
<motion.div
|
|
|
|
|
style={{ display: 'flex', alignItems: 'center', gap: '16px', marginBottom: '16px' }}
|
|
|
|
|
initial={{ opacity: 0, y: 24 }}
|
|
|
|
|
whileInView={{ opacity: 1, y: 0 }}
|
|
|
|
|
viewport={{ once: true, amount: 0.2 }}
|
|
|
|
|
transition={itemTransition(0)}
|
|
|
|
|
>
|
2026-10-22 09:55:24 +07:00
|
|
|
<EditableText as="h1" id="project-title" style={{ flex: 1 }} path={`projects.${project.id}.title`} label={s.edit.fields.title}>
|
|
|
|
|
{project.title}
|
|
|
|
|
</EditableText>
|
2026-10-22 07:29:06 +07:00
|
|
|
<Badge variant="outline">{s.projects.categories[project.category]}</Badge>
|
2026-10-17 20:02:47 +07:00
|
|
|
</motion.div>
|
2026-10-06 11:42:11 +07:00
|
|
|
|
2026-10-22 09:55:24 +07:00
|
|
|
<EditableText
|
|
|
|
|
as={motion.p}
|
2026-10-17 20:02:47 +07:00
|
|
|
className="prose-lede"
|
|
|
|
|
initial={{ opacity: 0, y: 24 }}
|
|
|
|
|
whileInView={{ opacity: 1, y: 0 }}
|
|
|
|
|
viewport={{ once: true, amount: 0.2 }}
|
|
|
|
|
transition={itemTransition(0.08)}
|
2026-10-22 09:55:24 +07:00
|
|
|
path={`projects.${project.id}.summary`}
|
|
|
|
|
label={`${project.title} — ${s.edit.fields.summary}`}
|
|
|
|
|
multiline
|
2026-10-17 20:02:47 +07:00
|
|
|
>
|
2026-10-22 07:29:06 +07:00
|
|
|
{project.summary}
|
2026-10-22 09:55:24 +07:00
|
|
|
</EditableText>
|
2026-10-06 11:42:11 +07:00
|
|
|
|
2026-10-17 20:02:47 +07:00
|
|
|
<div className="prose">
|
|
|
|
|
{project.metrics && project.metrics.length > 0 && (
|
|
|
|
|
<motion.div
|
|
|
|
|
initial={{ opacity: 0, y: 24 }}
|
|
|
|
|
whileInView={{ opacity: 1, y: 0 }}
|
|
|
|
|
viewport={{ once: true, amount: 0.2 }}
|
|
|
|
|
transition={itemTransition(0.16)}
|
|
|
|
|
>
|
2026-10-22 07:29:06 +07:00
|
|
|
<h3>{s.projectDetail.impact}</h3>
|
2026-10-17 20:02:47 +07:00
|
|
|
<div style={{ display: 'flex', gap: '16px', flexWrap: 'wrap' }}>
|
|
|
|
|
{project.metrics.map((m) => (
|
|
|
|
|
<span key={m} className="achievement-metric">
|
|
|
|
|
{m}
|
|
|
|
|
</span>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
</motion.div>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
<motion.div
|
|
|
|
|
initial={{ opacity: 0, y: 24 }}
|
|
|
|
|
whileInView={{ opacity: 1, y: 0 }}
|
|
|
|
|
viewport={{ once: true, amount: 0.2 }}
|
|
|
|
|
transition={itemTransition(0.24)}
|
|
|
|
|
>
|
2026-10-22 07:29:06 +07:00
|
|
|
<h3>{s.projectDetail.role}</h3>
|
2026-10-17 20:02:47 +07:00
|
|
|
<p>{project.role}</p>
|
|
|
|
|
</motion.div>
|
|
|
|
|
|
|
|
|
|
<motion.div
|
|
|
|
|
initial={{ opacity: 0, y: 24 }}
|
|
|
|
|
whileInView={{ opacity: 1, y: 0 }}
|
|
|
|
|
viewport={{ once: true, amount: 0.2 }}
|
|
|
|
|
transition={itemTransition(0.32)}
|
|
|
|
|
>
|
2026-10-22 07:29:06 +07:00
|
|
|
<h3>{s.projectDetail.technologies}</h3>
|
2026-10-17 20:02:47 +07:00
|
|
|
<div className="philosophy-keywords">
|
|
|
|
|
{project.technologies.map((tech) => (
|
|
|
|
|
<Tag key={tech}>{tech}</Tag>
|
2026-10-16 21:29:40 +07:00
|
|
|
))}
|
|
|
|
|
</div>
|
2026-10-17 20:02:47 +07:00
|
|
|
</motion.div>
|
2026-10-16 21:29:40 +07:00
|
|
|
|
2026-10-17 20:02:47 +07:00
|
|
|
{project.sections && project.sections.length > 0 && (
|
|
|
|
|
<div>
|
|
|
|
|
<motion.h3
|
|
|
|
|
initial={{ opacity: 0, y: 24 }}
|
|
|
|
|
whileInView={{ opacity: 1, y: 0 }}
|
|
|
|
|
viewport={{ once: true, amount: 0.2 }}
|
|
|
|
|
transition={itemTransition(0.4)}
|
|
|
|
|
>
|
2026-10-22 07:29:06 +07:00
|
|
|
{s.projectDetail.experiments}
|
2026-10-17 20:02:47 +07:00
|
|
|
</motion.h3>
|
|
|
|
|
{project.sections.map((section, idx) => (
|
|
|
|
|
<motion.div
|
|
|
|
|
key={idx}
|
|
|
|
|
className="project-section"
|
|
|
|
|
initial={{ opacity: 0, y: 24 }}
|
|
|
|
|
whileInView={{ opacity: 1, y: 0 }}
|
|
|
|
|
viewport={{ once: true, amount: 0.2 }}
|
|
|
|
|
transition={itemTransition(0.48 + idx * 0.08)}
|
|
|
|
|
>
|
2026-10-22 09:55:24 +07:00
|
|
|
<EditableText as="h4" path={`projects.${project.id}.sections.${section.id}.title`} label={`${section.title} — ${s.edit.fields.sectionTitle}`}>
|
|
|
|
|
{section.title}
|
|
|
|
|
</EditableText>
|
|
|
|
|
<EditableText as="p" path={`projects.${project.id}.sections.${section.id}.content`} label={`${section.title} — ${s.edit.fields.sectionContent}`} multiline>
|
|
|
|
|
{section.content}
|
|
|
|
|
</EditableText>
|
2026-10-17 20:02:47 +07:00
|
|
|
<Tag accent>{section.type}</Tag>
|
|
|
|
|
</motion.div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2026-10-16 21:29:40 +07:00
|
|
|
</div>
|
2026-10-17 20:02:47 +07:00
|
|
|
</motion.section>
|
|
|
|
|
</InView>
|
2026-10-06 11:42:11 +07:00
|
|
|
)
|
|
|
|
|
}
|