PageSourceSearch

https://next-slot-up.lovable.app/assets/Projects-BmzA_m8M.js

js next-slot-up.lovable.app collected 2026-10-03 03:33:58 UTC 2,529 bytes, 1 lines download raw bytes

1import{r,a as b,j as e,L as v,s as m}from"./index-WRgorS7r.js";import{B as u,I as x}from"./input-pFn8WI_j.js";import{C,a as N,b as y,c as w}from"./card-DR64_6x3.js";import{D,a as S,P,b as E,c as T,d as L}from"./dialog-DxaRW4EH.js";import"./index-C_QJayh7.js";import"./index-BDlbq6Ng.js";function k(){const[a,p]=r.useState([]),[j,o]=r.useState(!1),[t,l]=r.useState(""),[n,i]=r.useState(""),{toast:h}=b(),c=async()=>{const{data:s}=await m.from("projects").select("*").order("created_at",{ascending:!1});s&&p(s)};r.useEffect(()=>{c()},[]);const g=async s=>{s.preventDefault();const{error:d}=await m.from("projects").insert({name:t,slug:n||t.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"")});d?h({title:"Erreur",description:d.message,variant:"destructive"}):(o(!1),l(""),i(""),c())},f=s=>s==="published"?"bg-emerald-500/10 text-emerald-400 border-emerald-500/20":s==="archived"?"bg-muted text-muted-foreground":"bg-amber-500/10 text-amber-400 border-amber-500/20";return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Projets"}),e.jsxs(D,{open:j,onOpenChange:o,children:[e.jsx(S,{asChild:!0,children:e.jsxs(u,{children:[e.jsx(P,{className:"mr-2 h-4 w-4"}),"Nouveau projet"]})}),e.jsxs(E,{children:[e.jsx(T,{children:e.jsx(L,{children:"Créer un projet"})}),e.jsxs("form",{onSubmit:g,className:"space-y-4",children:[e.jsx(x,{placeholder:"Nom du projet",value:t,onChange:s=>l(s.target.value),required:!0}),e.jsx(x,{placeholder:"Slug (optionnel)",value:n,onChange:s=>i(s.target.value)}),e.jsx(u,{type:"submit",className:"w-full",children:"Créer"})]})]})]})]}),a.length===0?e.jsx("p",{className:"text-muted-foreground text-sm",children:"Aucun projet. Créez votre premier projet."}):e.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:a.map(s=>e.jsx(v,{to:`/admin/projects/${s.id}`,children:e.jsxs(C,{className:"hover:border-primary/40 hover:shadow-lg hover:shadow-primary/5 transition-all cursor-pointer",children:[e.jsx(N,{className:"pb-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(y,{className:"text-base",children:s.name}),e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-[11px] font-medium border ${f(s.status)}`,children:s.status})]})}),e.jsx(w,{children:e.jsxs("p",{className:"text-xs text-muted-foreground font-mono",children:["/",s.slug]})})]})},s.id))})]})}export{k as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.