import { useEffect, useState } from 'react' import { Link, Navigate, useNavigate, useParams } from 'react-router-dom' import { ArrowRightIcon, Trash2Icon } from 'lucide-react' import Swal from 'sweetalert2' import { useSiteData } from '../api' import { useAdmin } from './AdminContext' import { adminApi } from './adminClient' import { ImageField } from '../components/admin/ImageField' import { GalleryField } from '../components/admin/GalleryField' type ProjectDraft = { id: number slug: string title: string title_en: string location: string location_en: string year: string year_en: string status: 'done' | 'progress' project_type: string project_type_en: string usage: string usage_en: string area: string area_en: string floors: string floors_en: string units: string units_en: string client: string client_en: string summary: string summary_en: string body: string[] body_en: string[] image: string gallery: string[] } const EMPTY: ProjectDraft = { id: 0, slug: `project-${Date.now()}`, title: '', title_en: '', location: '', location_en: '', year: '', year_en: '', status: 'done', project_type: '', project_type_en: '', usage: '', usage_en: '', area: '', area_en: '', floors: '', floors_en: '', units: '', units_en: '', client: '', client_en: '', summary: '', summary_en: '', body: [], body_en: [], image: '', gallery: [], } const INPUT = 'w-full border border-ivory/15 bg-char px-3 py-2 text-sm font-light text-ivory placeholder:text-ivory/30 focus:border-copper focus:outline-none' /** جفت دوزبانه — فارسی و English همیشه هر دو دیده می‌شوند و با یک ذخیره ثبت می‌شوند */ function Pair({ label, fa, en, textarea = false, }: { label: string fa: { value: string; onChange: (v: string) => void } en: { value: string; onChange: (v: string) => void } textarea?: boolean }) { return (

{label}

فارسی {textarea ? (