mirror of
https://github.com/dong-nz/cv.git
synced 2026-11-22 16:10:40 +07:00
feat(edit): inline editing controls on every record surface (spec-v4-inline-editing §5 steps 1-7)
- EditableText: wrapper zone + pencil trigger (E6), inline validation errors, provenance tooltip + copy-chip (E7) - TagListEditor: per-chip edit/delete/move + ghost add over all six tag arrays, tagline emphasis toggle - RecordControls + AddGhost on About, AboutPage, Expertise, Experience, ExperiencePage, Projects, ProjectsListPage, ProjectDetailPage (incl. sections), PhilosophyPage; RecordSettings popover (featured, section list with type picker, variant, location, logo) - id-slug rename on committed record titles (E3); per-field conflict UI in EditBar; chrome CSS in App.css; labels in both ui.json - JsonPanel kept until the inline surface is verified in a real browser (spec progress row 8); acceptance §6 partial — build, validate:content, lint, smoke-draft pass 2026-10-23
This commit is contained in:
1 parent
753b28a4e3
commit
0a72cd9b58
22 files changed
+1812
-277
No files matched your search
+59
-21
@@ -3,10 +3,15 @@ import { SectionHeading } from '@/components/ui/SectionHeading'
|
||||
import { Tag } from '@/components/ui/Tag'
|
||||
import { InView } from '@/components/ui/InView'
|
||||
import { EditableText } from '@/components/ui/EditableText'
|
||||
import { TagListEditor } from '@/components/ui/TagListEditor'
|
||||
import { RecordControls, AddGhost } from '@/components/ui/RecordControls'
|
||||
import { useEdit } from '@/hooks/useEdit'
|
||||
import { useI18n } from '@/i18n/provider'
|
||||
|
||||
export function AboutPage() {
|
||||
const { ui: s, content: c } = useI18n()
|
||||
const edit = useEdit()
|
||||
|
||||
return (
|
||||
<>
|
||||
<InView>
|
||||
@@ -51,7 +56,7 @@ export function AboutPage() {
|
||||
{c.profile.philosophy.map((point, i) => (
|
||||
<motion.div
|
||||
key={point.id}
|
||||
className="philosophy-card"
|
||||
className={edit ? 'philosophy-card edit-record-host' : 'philosophy-card'}
|
||||
initial={{ opacity: 0, y: 24 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true, amount: 0.2 }}
|
||||
@@ -59,31 +64,49 @@ export function AboutPage() {
|
||||
whileHover={{ scale: 1.02, y: -4 }}
|
||||
whileTap={{ scale: 0.98 }}
|
||||
>
|
||||
{edit && (
|
||||
<RecordControls
|
||||
label={point.title}
|
||||
canUp={i > 0}
|
||||
canDown={i < c.profile.philosophy.length - 1}
|
||||
onUp={() => edit.moveItem('profile', 'philosophy', i, i - 1)}
|
||||
onDown={() => edit.moveItem('profile', 'philosophy', i, i + 1)}
|
||||
onDelete={() => edit.deleteRecord('philosophy', { id: point.id })}
|
||||
/>
|
||||
)}
|
||||
<EditableText as="h3" path={`profile.philosophy.${point.id}.title`} label={s.edit.fields.pointTitle}>
|
||||
{point.title}
|
||||
</EditableText>
|
||||
<EditableText as="p" path={`profile.philosophy.${point.id}.description`} label={s.edit.fields.pointDescription} multiline>
|
||||
{point.description}
|
||||
</EditableText>
|
||||
<div className="philosophy-keywords">
|
||||
{point.keywords.map((kw) => (
|
||||
<Tag key={kw}>{kw}</Tag>
|
||||
))}
|
||||
</div>
|
||||
<TagListEditor
|
||||
arrayPath={`profile.philosophy.${point.id}.keywords`}
|
||||
items={point.keywords}
|
||||
containerAs="div"
|
||||
containerClassName="philosophy-keywords"
|
||||
as={Tag}
|
||||
labelPrefix={`${point.title} — ${s.edit.fields.pointKeywords}`}
|
||||
addLabel={s.edit.addKeyword}
|
||||
/>
|
||||
</motion.div>
|
||||
))}
|
||||
{edit && <AddGhost variant="card" label={s.edit.addPhilosophy} onClick={() => edit.addRecord('philosophy')} />}
|
||||
</div>
|
||||
|
||||
<h3 className="subheading">
|
||||
{s.about.exploringTitlePage}
|
||||
</h3>
|
||||
<div className="interests-list">
|
||||
{c.profile.currentInterests.map((interest) => (
|
||||
<Tag key={interest} accent>
|
||||
{interest}
|
||||
</Tag>
|
||||
))}
|
||||
</div>
|
||||
<TagListEditor
|
||||
arrayPath="profile.currentInterests"
|
||||
items={c.profile.currentInterests}
|
||||
containerAs="div"
|
||||
containerClassName="interests-list"
|
||||
as={Tag}
|
||||
accent
|
||||
labelPrefix={s.edit.fields.interests}
|
||||
addLabel={s.edit.addInterest}
|
||||
/>
|
||||
</motion.section>
|
||||
</InView>
|
||||
<InView>
|
||||
@@ -103,7 +126,7 @@ export function AboutPage() {
|
||||
{c.skillGroups.map((group, i) => (
|
||||
<motion.div
|
||||
key={group.id}
|
||||
className="expertise-card"
|
||||
className={edit ? 'expertise-card edit-record-host' : 'expertise-card'}
|
||||
initial={{ opacity: 0, y: 24 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true, amount: 0.2 }}
|
||||
@@ -111,18 +134,33 @@ export function AboutPage() {
|
||||
whileHover={{ scale: 1.02, y: -4 }}
|
||||
whileTap={{ scale: 0.98 }}
|
||||
>
|
||||
{edit && (
|
||||
<RecordControls
|
||||
label={group.title}
|
||||
canUp={i > 0}
|
||||
canDown={i < c.skillGroups.length - 1}
|
||||
onUp={() => edit.moveItem('skills', '', i, i - 1)}
|
||||
onDown={() => edit.moveItem('skills', '', i, i + 1)}
|
||||
onDelete={() => edit.deleteRecord('skill-group', { id: group.id })}
|
||||
/>
|
||||
)}
|
||||
<EditableText as="h3" path={`skills.${group.id}.title`} label={s.edit.fields.groupTitle}>
|
||||
{group.title}
|
||||
</EditableText>
|
||||
<ul className="expertise-skills">
|
||||
{group.skills.map((skill: string) => (
|
||||
<li key={skill} className="expertise-skill">
|
||||
{skill}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
<TagListEditor
|
||||
doc="skills"
|
||||
arrayPath={`[${i}].skills`}
|
||||
items={group.skills}
|
||||
containerAs="ul"
|
||||
containerClassName="expertise-skills"
|
||||
as="li"
|
||||
itemClassName="expertise-skill"
|
||||
labelPrefix={`${group.title} — ${s.edit.fields.skill}`}
|
||||
addLabel={s.edit.addSkill}
|
||||
/>
|
||||
</motion.div>
|
||||
))}
|
||||
{edit && <AddGhost variant="card" label={s.edit.addSkillGroup} onClick={() => edit.addRecord('skill-group')} />}
|
||||
</div>
|
||||
</motion.section>
|
||||
</InView>
|
||||
|
||||
@@ -2,10 +2,17 @@ import { motion } from 'motion/react'
|
||||
import { SectionHeading } from '@/components/ui/SectionHeading'
|
||||
import { InView } from '@/components/ui/InView'
|
||||
import { EditableText } from '@/components/ui/EditableText'
|
||||
import { TagListEditor } from '@/components/ui/TagListEditor'
|
||||
import { RecordControls, AddGhost } from '@/components/ui/RecordControls'
|
||||
import { RecordSettings, ExperienceSettingsPanel } from '@/components/ui/RecordSettings'
|
||||
import { useEdit } from '@/hooks/useEdit'
|
||||
import { useI18n } from '@/i18n/provider'
|
||||
import { useState } from 'react'
|
||||
|
||||
export function ExperiencePage() {
|
||||
const { ui: s, content: c } = useI18n()
|
||||
const edit = useEdit()
|
||||
const [settingsFor, setSettingsFor] = useState<string | null>(null)
|
||||
return (
|
||||
<InView>
|
||||
<motion.section
|
||||
@@ -24,13 +31,30 @@ export function ExperiencePage() {
|
||||
{c.experiences.map((exp, i) => (
|
||||
<motion.div
|
||||
key={exp.id}
|
||||
className={exp.variant ? `timeline-entry timeline-entry-${exp.variant}` : 'timeline-entry'}
|
||||
className={[
|
||||
'timeline-entry',
|
||||
exp.variant ? `timeline-entry-${exp.variant}` : '',
|
||||
edit ? 'edit-record-host' : '',
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(' ')}
|
||||
initial={{ opacity: 0, y: 24 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true, amount: 0.2 }}
|
||||
transition={{ duration: 0.45, ease: 'easeOut', delay: i * 0.08 }}
|
||||
>
|
||||
<div className="timeline-marker" />
|
||||
{edit && (
|
||||
<RecordControls
|
||||
label={exp.title}
|
||||
canUp={i > 0}
|
||||
canDown={i < c.experiences.length - 1}
|
||||
onUp={() => edit.moveItem('experience', '', i, i - 1)}
|
||||
onDown={() => edit.moveItem('experience', '', i, i + 1)}
|
||||
onDelete={() => edit.deleteRecord('experience', { id: exp.id })}
|
||||
onSettings={() => setSettingsFor(exp.id)}
|
||||
/>
|
||||
)}
|
||||
<div className="timeline-header">
|
||||
<EditableText as="div" className="timeline-title" path={`experience.${exp.id}.title`} label={s.edit.fields.expTitle}>
|
||||
{exp.title}
|
||||
@@ -45,20 +69,18 @@ export function ExperiencePage() {
|
||||
{exp.location && <span className="timeline-location">{exp.location}</span>}
|
||||
</div>
|
||||
</div>
|
||||
<ul className="timeline-responsibilities">
|
||||
{exp.responsibilities.map((r, ri) => (
|
||||
<EditableText
|
||||
as="li"
|
||||
key={ri}
|
||||
path={`experience.${exp.id}.responsibilities[${ri}]`}
|
||||
label={`${exp.title} — ${s.edit.fields.responsibility} ${ri + 1}`}
|
||||
>
|
||||
{r}
|
||||
</EditableText>
|
||||
))}
|
||||
</ul>
|
||||
<TagListEditor
|
||||
arrayPath={`experience.${exp.id}.responsibilities`}
|
||||
items={exp.responsibilities}
|
||||
containerAs="ul"
|
||||
containerClassName="timeline-responsibilities"
|
||||
as="li"
|
||||
labelPrefix={`${exp.title} — ${s.edit.fields.responsibility}`}
|
||||
addLabel={s.edit.addResponsibility}
|
||||
/>
|
||||
</motion.div>
|
||||
))}
|
||||
{edit && <AddGhost label={s.edit.addExperience} onClick={() => edit.addRecord('experience')} />}
|
||||
<div className="timeline-tldr">
|
||||
<span className="timeline-tldr-marker" aria-hidden="true" />
|
||||
<span className="timeline-tldr-chip">{s.experience.tldr}</span>
|
||||
@@ -66,6 +88,14 @@ export function ExperiencePage() {
|
||||
{c.profile.tldr}
|
||||
</EditableText>
|
||||
</div>
|
||||
{edit && settingsFor && (
|
||||
<RecordSettings title={s.edit.settings} onClose={() => setSettingsFor(null)}>
|
||||
{(() => {
|
||||
const entry = c.experiences.find((e) => e.id === settingsFor)
|
||||
return entry ? <ExperienceSettingsPanel entry={entry} /> : null
|
||||
})()}
|
||||
</RecordSettings>
|
||||
)}
|
||||
</div>
|
||||
</motion.section>
|
||||
</InView>
|
||||
|
||||
@@ -2,11 +2,19 @@ import {SectionHeading} from '@/components/ui/SectionHeading'
|
||||
import {EditableText} from '@/components/ui/EditableText'
|
||||
import {motion} from 'motion/react'
|
||||
import {InView} from '@/components/ui/InView'
|
||||
import { TagListEditor } from '@/components/ui/TagListEditor'
|
||||
import { RecordControls, AddGhost } from '@/components/ui/RecordControls'
|
||||
import { useEdit } from '@/hooks/useEdit'
|
||||
import { useI18n } from '@/i18n/provider'
|
||||
import { setPath, parsePath } from '@/i18n/draft'
|
||||
|
||||
import {useI18n} from '@/i18n/provider'
|
||||
// philosophyQuotes are text-only records: they live in the language document
|
||||
// being edited, so add and delete go through the plain document primitives.
|
||||
const quotesPath = 'profile.philosophyQuotes'
|
||||
|
||||
export function PhilosophyPage() {
|
||||
const {ui: s, content: c} = useI18n()
|
||||
const edit = useEdit()
|
||||
return (
|
||||
<InView>
|
||||
<motion.section
|
||||
@@ -25,12 +33,27 @@ export function PhilosophyPage() {
|
||||
{c.profile.philosophyQuotes.map((quote, i) => (
|
||||
<motion.div
|
||||
key={i}
|
||||
className="philosophy-quote"
|
||||
className={edit ? 'philosophy-quote edit-record-host' : 'philosophy-quote'}
|
||||
initial={{opacity: 0, y: 24}}
|
||||
whileInView={{opacity: 1, y: 0}}
|
||||
viewport={{once: true, amount: 0.2}}
|
||||
transition={{duration: 0.45, ease: 'easeOut', delay: i * 0.08}}
|
||||
>
|
||||
{edit && (
|
||||
<RecordControls
|
||||
label={quote.title}
|
||||
canUp={i > 0}
|
||||
canDown={i < c.profile.philosophyQuotes.length - 1}
|
||||
onUp={() => edit.moveItem(edit.textDoc, quotesPath, i, i - 1)}
|
||||
onDown={() => edit.moveItem(edit.textDoc, quotesPath, i, i + 1)}
|
||||
onDelete={() => {
|
||||
const doc = edit.dataOf(edit.textDoc) as Record<string, any>
|
||||
const next = setPath(doc, parsePath(quotesPath),
|
||||
(doc.profile.philosophyQuotes as unknown[]).filter((_, j) => j !== i))
|
||||
edit.apply(edit.textDoc, next)
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<EditableText
|
||||
as="h3"
|
||||
path={`profile.philosophyQuotes[${i}].title`}
|
||||
@@ -38,21 +61,28 @@ export function PhilosophyPage() {
|
||||
>
|
||||
{quote.title}
|
||||
</EditableText>
|
||||
<div>
|
||||
{quote.details.map((detail, j) => (
|
||||
<EditableText
|
||||
as="p"
|
||||
key={j}
|
||||
path={`profile.philosophyQuotes[${i}].details[${j}]`}
|
||||
label={`${s.edit.fields.quoteDetail} ${j + 1}`}
|
||||
multiline
|
||||
>
|
||||
{detail}
|
||||
</EditableText>
|
||||
))}
|
||||
</div>
|
||||
<TagListEditor
|
||||
arrayPath={`profile.philosophyQuotes[${i}].details`}
|
||||
items={quote.details}
|
||||
containerAs="div"
|
||||
containerClassName="philosophy-quote-details"
|
||||
as="p"
|
||||
labelPrefix={`${quote.title} — ${s.edit.fields.quoteDetail}`}
|
||||
addLabel={s.edit.addQuoteDetail}
|
||||
/>
|
||||
</motion.div>
|
||||
))}
|
||||
{edit && (
|
||||
<AddGhost
|
||||
label={s.edit.addQuote}
|
||||
onClick={() => {
|
||||
const doc = edit.dataOf(edit.textDoc) as Record<string, any>
|
||||
const next = setPath(doc, parsePath(quotesPath),
|
||||
[...(doc.profile.philosophyQuotes as unknown[]), { title: 'New quote', details: ['Write the quote here.'] }])
|
||||
edit.apply(edit.textDoc, next)
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</motion.section>
|
||||
</InView>
|
||||
|
||||
@@ -5,7 +5,11 @@ import { Tag } from '@/components/ui/Tag'
|
||||
import { EditableText } from '@/components/ui/EditableText'
|
||||
import { InView } from '@/components/ui/InView'
|
||||
import { useI18n } from '@/i18n/provider'
|
||||
|
||||
import { TagListEditor } from '@/components/ui/TagListEditor'
|
||||
import { RecordControls, AddGhost } from '@/components/ui/RecordControls'
|
||||
import { RecordSettings, ProjectSettingsPanel } from '@/components/ui/RecordSettings'
|
||||
import { useEdit } from '@/hooks/useEdit'
|
||||
import { useState } from 'react'
|
||||
const sectionVariants = {
|
||||
hidden: { opacity: 0 },
|
||||
visible: { opacity: 1, transition: { duration: 0.5 } },
|
||||
@@ -20,8 +24,9 @@ const itemTransition = (delay: number): Transition => ({
|
||||
export function ProjectDetailPage() {
|
||||
const { id } = useParams<{ id: string }>()
|
||||
const { ui: s, content: c } = useI18n()
|
||||
const edit = useEdit()
|
||||
const [settingsOpen, setSettingsOpen] = useState(false)
|
||||
const project = c.projects.find((p) => p.id === id)
|
||||
|
||||
if (!project) {
|
||||
return (
|
||||
<InView>
|
||||
@@ -66,6 +71,13 @@ export function ProjectDetailPage() {
|
||||
{project.title}
|
||||
</EditableText>
|
||||
<Badge variant="outline">{s.projects.categories[project.category]}</Badge>
|
||||
{edit && (
|
||||
<RecordControls
|
||||
label={project.title}
|
||||
onDelete={() => edit.deleteRecord('project', { id: project.id })}
|
||||
onSettings={() => setSettingsOpen(true)}
|
||||
/>
|
||||
)}
|
||||
</motion.div>
|
||||
|
||||
<EditableText
|
||||
@@ -83,7 +95,7 @@ export function ProjectDetailPage() {
|
||||
</EditableText>
|
||||
|
||||
<div className="prose">
|
||||
{project.metrics && project.metrics.length > 0 && (
|
||||
{(edit || (project.metrics?.length ?? 0) > 0) && (
|
||||
<motion.div
|
||||
initial={{ opacity: 0, y: 24 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
@@ -91,13 +103,16 @@ export function ProjectDetailPage() {
|
||||
transition={itemTransition(0.16)}
|
||||
>
|
||||
<h3>{s.projectDetail.impact}</h3>
|
||||
<div style={{ display: 'flex', gap: '16px', flexWrap: 'wrap' }}>
|
||||
{project.metrics.map((m) => (
|
||||
<span key={m} className="achievement-metric">
|
||||
{m}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
<TagListEditor
|
||||
arrayPath={`projects.${project.id}.metrics`}
|
||||
items={project.metrics ?? []}
|
||||
containerAs="div"
|
||||
containerClassName="project-metrics"
|
||||
as="span"
|
||||
itemClassName="achievement-metric"
|
||||
labelPrefix={`${project.title} — ${s.edit.fields.metric}`}
|
||||
addLabel={s.edit.addMetric}
|
||||
/>
|
||||
</motion.div>
|
||||
)}
|
||||
|
||||
@@ -120,14 +135,19 @@ export function ProjectDetailPage() {
|
||||
transition={itemTransition(0.32)}
|
||||
>
|
||||
<h3>{s.projectDetail.technologies}</h3>
|
||||
<div className="philosophy-keywords">
|
||||
{project.technologies.map((tech) => (
|
||||
<Tag key={tech}>{tech}</Tag>
|
||||
))}
|
||||
</div>
|
||||
<TagListEditor
|
||||
doc="projects"
|
||||
arrayPath={`[${c.projects.findIndex((p) => p.id === project.id)}].technologies`}
|
||||
items={project.technologies}
|
||||
containerAs="div"
|
||||
containerClassName="philosophy-keywords"
|
||||
as={Tag}
|
||||
labelPrefix={`${project.title} — ${s.edit.fields.technology}`}
|
||||
addLabel={s.edit.addTechnology}
|
||||
/>
|
||||
</motion.div>
|
||||
|
||||
{project.sections && project.sections.length > 0 && (
|
||||
{(edit || (project.sections?.length ?? 0) > 0) && (
|
||||
<div>
|
||||
<motion.h3
|
||||
initial={{ opacity: 0, y: 24 }}
|
||||
@@ -139,13 +159,23 @@ export function ProjectDetailPage() {
|
||||
</motion.h3>
|
||||
{project.sections.map((section, idx) => (
|
||||
<motion.div
|
||||
key={idx}
|
||||
className="project-section"
|
||||
key={section.id}
|
||||
className={edit ? 'project-section edit-record-host' : '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)}
|
||||
>
|
||||
{edit && (
|
||||
<RecordControls
|
||||
label={section.title}
|
||||
canUp={idx > 0}
|
||||
canDown={idx < (project.sections?.length ?? 0) - 1}
|
||||
onUp={() => edit.moveItem('projects', `[${c.projects.findIndex((p) => p.id === project.id)}].sections`, idx, idx - 1)}
|
||||
onDown={() => edit.moveItem('projects', `[${c.projects.findIndex((p) => p.id === project.id)}].sections`, idx, idx + 1)}
|
||||
onDelete={() => edit.deleteRecord('section', { id: section.id, projectId: project.id })}
|
||||
/>
|
||||
)}
|
||||
<EditableText as="h4" path={`projects.${project.id}.sections.${section.id}.title`} label={`${section.title} — ${s.edit.fields.sectionTitle}`}>
|
||||
{section.title}
|
||||
</EditableText>
|
||||
@@ -155,9 +185,20 @@ export function ProjectDetailPage() {
|
||||
<Tag accent>{section.type}</Tag>
|
||||
</motion.div>
|
||||
))}
|
||||
{edit && (
|
||||
<AddGhost
|
||||
label={s.edit.addSection}
|
||||
onClick={() => edit.addRecord('section', { projectId: project.id })}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
{edit && settingsOpen && (
|
||||
<RecordSettings title={s.edit.settings} onClose={() => setSettingsOpen(false)}>
|
||||
<ProjectSettingsPanel project={project} />
|
||||
</RecordSettings>
|
||||
)}
|
||||
</motion.section>
|
||||
</InView>
|
||||
)
|
||||
|
||||
@@ -3,7 +3,12 @@ import { Badge } from '@/components/ui/Badge'
|
||||
import { motion } from 'motion/react'
|
||||
import { InView } from '@/components/ui/InView'
|
||||
import { EditableText } from '@/components/ui/EditableText'
|
||||
import { TagListEditor } from '@/components/ui/TagListEditor'
|
||||
import { RecordControls, AddGhost } from '@/components/ui/RecordControls'
|
||||
import { RecordSettings, ProjectSettingsPanel } from '@/components/ui/RecordSettings'
|
||||
import { useEdit } from '@/hooks/useEdit'
|
||||
import { useI18n } from '@/i18n/provider'
|
||||
import { useState } from 'react'
|
||||
|
||||
import { Link } from 'react-router'
|
||||
|
||||
@@ -12,6 +17,8 @@ const MotionLink = motion.create(Link)
|
||||
|
||||
export function ProjectsListPage() {
|
||||
const { ui: s, content: c } = useI18n()
|
||||
const edit = useEdit()
|
||||
const [settingsFor, setSettingsFor] = useState<string | null>(null)
|
||||
return (
|
||||
<InView>
|
||||
<motion.section
|
||||
@@ -27,40 +34,81 @@ export function ProjectsListPage() {
|
||||
>
|
||||
<SectionHeading title={s.projects.all} tag={s.projects.all} />
|
||||
<div className="projects-grid">
|
||||
{c.projects.map((project, i) => (
|
||||
<MotionLink
|
||||
key={project.id}
|
||||
to={`/projects/${project.id}`}
|
||||
className="project-card"
|
||||
initial={{ opacity: 0, y: 24 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true, amount: 0.2 }}
|
||||
transition={{ duration: 0.45, ease: 'easeOut', delay: i * 0.08 }}
|
||||
whileHover={{ scale: 1.02, y: -4 }}
|
||||
whileTap={{ scale: 0.98 }}
|
||||
>
|
||||
<div className="project-card-header">
|
||||
<EditableText as="h3" path={`projects.${project.id}.title`} label={s.edit.fields.title}>
|
||||
{project.title}
|
||||
{c.projects.map((project, i) => {
|
||||
const card = (
|
||||
<MotionLink
|
||||
key={project.id}
|
||||
to={`/projects/${project.id}`}
|
||||
className="project-card"
|
||||
initial={{ opacity: 0, y: 24 }}
|
||||
whileInView={{ opacity: 1, y: 0 }}
|
||||
viewport={{ once: true, amount: 0.2 }}
|
||||
transition={{ duration: 0.45, ease: 'easeOut', delay: i * 0.08 }}
|
||||
whileHover={{ scale: 1.02, y: -4 }}
|
||||
whileTap={{ scale: 0.98 }}
|
||||
>
|
||||
<div className="project-card-header">
|
||||
<EditableText as="h3" path={`projects.${project.id}.title`} label={s.edit.fields.title}>
|
||||
{project.title}
|
||||
</EditableText>
|
||||
<Badge variant="outline">
|
||||
{s.projects.categories[project.category]}
|
||||
</Badge>
|
||||
</div>
|
||||
<EditableText as="p" className="project-card-summary" path={`projects.${project.id}.summary`} label={`${project.title} — ${s.edit.fields.summary}`}>
|
||||
{project.summary}
|
||||
</EditableText>
|
||||
<Badge variant="outline">
|
||||
{s.projects.categories[project.category]}
|
||||
</Badge>
|
||||
{edit ? (
|
||||
<TagListEditor
|
||||
doc="projects"
|
||||
arrayPath={`[${i}].technologies`}
|
||||
items={project.technologies}
|
||||
containerAs="div"
|
||||
containerClassName="project-card-techs"
|
||||
as="span"
|
||||
itemClassName="tag"
|
||||
labelPrefix={`${project.title} — ${s.edit.fields.technology}`}
|
||||
addLabel={s.edit.addTechnology}
|
||||
/>
|
||||
) : (
|
||||
<div className="project-card-techs">
|
||||
{project.technologies.slice(0, 4).map((tech) => (
|
||||
<span key={tech} className="tag">
|
||||
{tech}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
<span className="project-card-cta">{s.projects.viewDetails} →</span>
|
||||
</MotionLink>
|
||||
)
|
||||
return edit ? (
|
||||
<div key={project.id} className="edit-record-shell">
|
||||
<RecordControls
|
||||
label={project.title}
|
||||
canUp={i > 0}
|
||||
canDown={i < c.projects.length - 1}
|
||||
onUp={() => edit.moveItem('projects', '', i, i - 1)}
|
||||
onDown={() => edit.moveItem('projects', '', i, i + 1)}
|
||||
onDelete={() => edit.deleteRecord('project', { id: project.id })}
|
||||
onSettings={() => setSettingsFor(project.id)}
|
||||
/>
|
||||
{card}
|
||||
</div>
|
||||
<EditableText as="p" className="project-card-summary" path={`projects.${project.id}.summary`} label={`${project.title} — ${s.edit.fields.summary}`}>
|
||||
{project.summary}
|
||||
</EditableText>
|
||||
<div className="project-card-techs">
|
||||
{project.technologies.slice(0, 4).map((tech) => (
|
||||
<span key={tech} className="tag">
|
||||
{tech}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
<span className="project-card-cta">{s.projects.viewDetails} →</span>
|
||||
</MotionLink>
|
||||
))}
|
||||
) : (
|
||||
card
|
||||
)
|
||||
})}
|
||||
{edit && <AddGhost variant="card" label={s.edit.addProject} onClick={() => edit.addRecord('project')} />}
|
||||
</div>
|
||||
{edit && settingsFor && (
|
||||
<RecordSettings title={s.edit.settings} onClose={() => setSettingsFor(null)}>
|
||||
{(() => {
|
||||
const project = c.projects.find((p) => p.id === settingsFor)
|
||||
return project ? <ProjectSettingsPanel project={project} /> : null
|
||||
})()}
|
||||
</RecordSettings>
|
||||
)}
|
||||
</motion.section>
|
||||
</InView>
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user