"use client"; import { motion } from "framer-motion"; import { Layers3, MapPin, Tags } from "lucide-react"; import { useState } from "react"; import { Project } from "../../../../components/ProjectsTable"; import { updateProject } from "../../actions"; type Props = { project: Project; }; /** Formulaire client pour éditer un projet existant */ export default function EditProjectForm({ project }: Props) { const [tags, setTags] = useState(project.tags ?? []); const [customTag, setCustomTag] = useState(""); const PREDEF = ["build", "usine", "spawn"] as const; const addTag = (t: string) => { const val = t.trim().toLowerCase(); if (!val || tags.includes(val) || tags.length >= 5) return; setTags([...tags, val]); }; const removeTag = (t: string) => { setTags(tags.filter((x) => x !== t)); }; const coordsParts = (project.coords ?? "").split(" "); return ( updateProject(project.id!, formData)} initial={{ opacity: 0, y: 12 }} animate={{ opacity: 1, y: 0 }} className="space-y-6" > {/* Titre du projet */}
{/* Coordonnées X Y Z */}
{["X", "Y", "Z"].map((axis, idx) => (
))}
{/* Description */}