1import{r as i,j as e,L as r,k as b,s as p}from"./index-tUFl4-SJ.js";import{N as t}from"./AdminLayout-C9umxEZS.js";import{P as x}from"./plus-cMVe2JDr.js";import{P as j}from"./pencil-BkuVcg2n.js";import{T as k}from"./trash-2-4-WMvtbl.js";function D(){const[l,g]=i.useState([]),[u,a]=i.useState(!0),[d,h]=i.useState(null);async function c(){a(!0);const{data:n,error:s}=await p.from("content_blocks").select("id,slug,name,kind,published,updated_at,display_mode,config").order("updated_at",{ascending:!1});s?h(s.message):g(n??[]),a(!1)}i.useEffect(()=>{c()},[]);async function y(n){if(!confirm("Slet denne blok? Den vil forsvinde alle steder den er indsat."))return;const{error:s}=await p.from("content_blocks").delete().eq("id",n);if(s){alert(s.message);return}c()}return e.jsxs("div",{style:{color:t.text},children:[e.jsxs("header",{style:{marginBottom:32},children:[e.jsxs("div",{style:{fontSize:13,color:t.textMuted,marginBottom:8},children:[e.jsx(r,{to:"/admin",style:{color:t.textMuted,textDecoration:"none"},children:"Panel"}),e.jsx("span",{style:{margin:"0 6px"},children:"/"}),e.jsx("span",{children:"Blokke"})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:16,flexWrap:"wrap"},children:[e.jsx("h1",{style:{margin:0,fontSize:36,fontWeight:700,letterSpacing:"-0.02em"},children:"Blokke"}),e.jsxs(r,{to:"/admin/blocks/new",style:m,children:[e.jsx(x,{size:14,strokeWidth:2})," Ny blok"]})]}),e.jsx("p",{style:{marginTop:12,color:t.textMuted,fontSize:13,maxWidth:700},children:'Genbrugelige indholdsblokke (nyhedsbrev, CTA m.fl.) som kan indsættes pÃ¥ artikler og sider via "+ Blok"-knappen i editoren. Ãndrer du her, opdateres alle steder de er brugt.'})]}),d&&e.jsx("p",{style:{color:t.text,fontSize:13},children:d}),u?e.jsx("p",{style:{color:t.textMuted},children:"Indlæserâ¦"}):l.length===0?e.jsxs("div",{style:{padding:"60px 20px",textAlign:"center",color:t.textMuted,border:`1px dashed ${t.border}`,borderRadius:0},children:[e.jsx("p",{style:{margin:"0 0 16px"},children:"Ingen blokke endnu."}),e.jsxs(r,{to:"/admin/blocks/new",style:m,children:[e.jsx(x,{size:14,strokeWidth:2})," Opret den første"]})]}):e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(280px, 1fr))",gap:24},children:l.map(n=>{const o=(n.config??{}).backgroundImage;return e.jsxs("article",{style:S,children:[e.jsxs(r,{to:`/admin/blocks/${n.id}`,style:{display:"block",aspectRatio:"16 / 10",background:o?`#1a1a1a url(${o}) center/cover no-repeat`:"linear-gradient(135deg, #ececec, #f6f6f6)",position:"relative",textDecoration:"none"},children:[e.jsx("span",{style:f,children:b(n.kind)}),n.display_mode==="popup"&&e.jsx("span",{style:{...f,top:"1rem",left:"auto",right:"1rem"},children:"Pop-up"}),!o&&e.jsx("span",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",color:t.textMuted,fontSize:12,letterSpacing:"0.1em",textTransform:"uppercase"},children:"Intet billede"})]}),e.jsxs("div",{style:{padding:"1.25rem 1.25rem 1rem"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:11,color:t.textMuted,letterSpacing:"0.05em",textTransform:"uppercase",marginBottom:8},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:0,background:n.published?t.green:t.textFaint}}),e.jsx("span",{style:{color:n.published?t.green:t.textMuted},children:n.published?"Live":"Skjult"}),e.jsx("span",{children:"·"}),e.jsx("span",{children:new Date(n.updated_at).toLocaleDateString("da-DK",{day:"numeric",month:"short"})})]}),e.jsx("h3",{style:{margin:"0 0 6px",fontSize:"1.05rem",fontWeight:700,letterSpacing:"-0.01em",lineHeight:1.3},children:e.jsx(r,{to:`/admin/blocks/${n.id}`,style:{color:t.text,textDecoration:"none"},children:n.name||"(uden navn)"})}),e.jsx("code",{style:{color:t.textMuted,fontSize:11},children:n.slug})]}),e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 1.25rem 1rem",borderTop:`1px solid ${t.border}`,marginTop:4},children:[e.jsxs(r,{to:`/admin/blocks/${n.id}`,style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:13,color:t.text,textDecoration:"none"},children:[e.jsx(j,{size:13,strokeWidth:1.75})," Redigér"]}),e.jsxs("button",{onClick:()=>y(n.id),style:{display:"inline-flex",alignItems:"center",gap:4,background:"transparent",border:0,color:t.text,cursor:"pointer",fontSize:13,padding:0},children:[e.jsx(k,{size:13,strokeWidth:1.75})," Slet"]})]})]},n.id)})})]})}const m={background:t.text,color:"#fff",padding:"6px 12px",borderRadius:0,textDecoration:"none",fontWeight:500,fontSize:13,border:0,display:"inline-flex",alignItems:"center",gap:6},S={background:"#fff",border:`1px solid ${t.border}`,borderRadius:0,overflow:"hidden",display:"flex",flexDirection:"column",transition:"box-shadow 0.2s, transform 0.2s"},f={position:"absolute",top:"1rem",left:"1rem",padding:"0.3rem 0.75rem",background:"#0a0a0a",color:"#fff",fontSize:10,fontWeight:600,letterSpacing:"0.08em",textTransform:"uppercase"};export{D 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.