import React, { useState } from 'react' import { ArrowLeftIcon } from 'lucide-react' import { AnimatePresence, motion } from 'framer-motion' import { Reveal } from '../Reveal' import { ButtonLink } from '../Button' import { ProjectCard } from '../ProjectCard' import { SectionHeading } from '../SectionHeading' import { useSectionHeading, useSite, useStatusLabel } from '../../api' import { useFieldSaver } from '../../admin/AdminContext' import { InlineEdit } from '../admin/InlineEdit' import { AddItemButton, EditableItem } from '../../admin/Editable' import type { ProjectStatus } from '../../data/site' export function FeaturedProjects() { const { projects, status_labels } = useSite() const heading = useSectionHeading('featured_projects') const save = useFieldSaver() const saveStatusLabel = (key: string, value: string) => { const label = status_labels.find((s) => s.key === key) if (!label) return void save('status-labels', label.id, { label: value }, (d) => { const s = d.status_labels.find((x) => x.id === label.id) if (s) s.label = value }) } const FILTERS: { key: ProjectStatus; label: string }[] = [ { key: 'done', label: useStatusLabel('done') }, { key: 'progress', label: useStatusLabel('progress') }, ] const [status, setStatus] = useState('done') const list = projects.filter((p) => p.status === status).slice(0, 3) return (
{/* دکمه‌های فیلتر مینیمال و شیشه‌ای (بدون کادر) */}
{FILTERS.map((filter, index) => { const isSelected = status === filter.key return ( {/* خط جداکننده بین دکمه‌ها */} {index > 0 && ( ) })}
{list.map((project, i) => ( ))}
{/* دکمه مشاهده همه پروژه‌ها */} {heading.cta_label && heading.cta_href && (
save('section-headings', heading.id, { cta_label: v }, (d) => { const h = d.section_headings.find((s) => s.id === heading.id) if (h) h.cta_label = v }) } />
)}
) }