Strip and coverflow: the row is a grid with four shared rows (header, bullets, spacer, price) and every card a subgrid across them, so all cards are equally tall and bullets, price and button line up even when a package name wraps or one description is much longer. Expanding the bullets of one card grows the whole row to keep it in sync. The minimum card height setting now applies to the row. Grid layout: cards stretch and all grid rows share the same height. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 line
5.4 KiB
JavaScript
1 line
5.4 KiB
JavaScript
import{r as a,j as e,L as w,a as i}from"./index-CuozEvUf.js";import{I as S}from"./ImageUploadField-NWFDfXsy.js";const j={name:"",gallery_brand_id:"",cover_image_path:"",sort_order:0};function F(){const[n,k]=a.useState([]),[m,N]=a.useState([]),[t,l]=a.useState(j),[s,u]=a.useState(null),[x,h]=a.useState(""),[d,b]=a.useState("all"),o=a.useMemo(()=>d==="all"?n:n.filter(r=>String(r.gallery_brand_id)===d),[n,d]),c=()=>{i.get("/gallery-projects").then(k),i.get("/gallery-brands").then(N)};a.useEffect(c,[]);const y=r=>{u(r.id),l({name:r.name,gallery_brand_id:r.gallery_brand_id,cover_image_path:r.cover_image_path||"",sort_order:r.sort_order})},g=()=>{u(null),l(j)},v=async r=>{r.preventDefault(),h("");const p={...t,gallery_brand_id:Number(t.gallery_brand_id)};try{s?await i.put(`/gallery-projects/${s}`,p):await i.post("/gallery-projects",p),g(),c()}catch(_){h(_.message)}},f=async r=>{confirm("Projekt inkl. aller Fotos wirklich löschen?")&&(await i.delete(`/gallery-projects/${r}`),c())};return e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsxs("div",{className:"lg:col-span-2",children:[e.jsx("h1",{className:"mb-4 text-xl font-bold text-neutral-900 dark:text-white",children:"Galerie-Projekte"}),e.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[e.jsx("label",{className:"text-sm font-medium text-neutral-600 dark:text-neutral-300",children:"Nach Marke filtern:"}),e.jsxs("select",{value:d,onChange:r=>b(r.target.value),className:"rounded-md border border-neutral-300 bg-white px-3 py-1.5 text-sm dark:border-neutral-700 dark:bg-neutral-900",children:[e.jsx("option",{value:"all",children:"Alle Marken"}),m.map(r=>e.jsx("option",{value:String(r.id),children:r.name},r.id))]}),d!=="all"&&e.jsx("button",{onClick:()=>b("all"),className:"text-sm text-brand-600 hover:underline",children:"Filter zurücksetzen"}),e.jsxs("span",{className:"text-sm text-neutral-400",children:[o.length," von ",n.length]})]}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-2",children:"Marke"}),e.jsx("th",{className:"px-4 py-2",children:"Projekt"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),e.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[o.map(r=>e.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[e.jsx("td",{className:"px-4 py-2",children:r.brand_name}),e.jsx("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:r.name}),e.jsxs("td",{className:"px-4 py-2 text-right",children:[e.jsx(w,{to:`/admin/gallery-projects/${r.id}/photos`,className:"mr-3 text-brand-600 hover:underline",children:"Fotos"}),e.jsx("button",{onClick:()=>y(r),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),e.jsx("button",{onClick:()=>f(r.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},r.id)),o.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:3,className:"px-4 py-6 text-center text-neutral-400",children:n.length===0?"Noch keine Projekte angelegt.":"Keine Projekte für diese Marke."})})]})]})})]}),e.jsxs("form",{onSubmit:v,className:"h-fit space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:s?"Projekt bearbeiten":"Neues Projekt"}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Marke *"}),e.jsxs("select",{required:!0,value:t.gallery_brand_id,onChange:r=>l({...t,gallery_brand_id:r.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900",children:[e.jsx("option",{value:"",children:"Bitte wählen…"}),m.map(r=>e.jsx("option",{value:r.id,children:r.name},r.id))]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Projektname *"}),e.jsx("input",{required:!0,placeholder:"z. B. Audi TT",value:t.name,onChange:r=>l({...t,name:r.target.value}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),e.jsx(S,{value:t.cover_image_path,onChange:r=>l({...t,cover_image_path:r}),aspect:4/3,label:"Titelbild (optional)"}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Sortierung"}),e.jsx("input",{type:"number",value:t.sort_order,onChange:r=>l({...t,sort_order:Number(r.target.value)}),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"})]}),x&&e.jsx("p",{className:"text-sm text-red-600",children:x}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:s?"Speichern":"Anlegen"}),s&&e.jsx("button",{type:"button",onClick:g,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}export{F as default};
|