import{j as e}from"./react-vendor-MPLM8hiW.js";import{u as i}from"./tanstack-vendor-Dk_RmDT8.js";import{a as c,P as m,C as l,g as x,m as h,v as u,o as f}from"./index-saDuzM6I.js";import{L as j,am as p,H as g,ag as y}from"./icons-vendor-H2PpUqT3.js";import{L as o}from"./vendor-CwCtuXvS.js";import"./radix-vendor-aVdTdbL0.js";const N=new Set(["media"]),b="text-xs text-text-secondary border-border/70 bg-surface-hover/60 dark:bg-surface-active/40";function D(){var n;const{t}=c(),{data:a,isLoading:r}=i({queryKey:["schemas"],queryFn:()=>u.list()});return r?e.jsx("div",{className:"flex items-center justify-center h-64",children:e.jsx(j,{className:"h-8 w-8 animate-spin text-text-secondary"})}):e.jsx(m,{title:t("content.title"),description:t("content.description"),children:(n=a==null?void 0:a.data)!=null&&n.length?e.jsx("div",{className:"grid gap-4 grid-cols-1 md:grid-cols-2 lg:grid-cols-3",children:a.data.filter(s=>!N.has(s.info.singularName)).map(s=>e.jsx(v,{name:s.info.singularName,displayName:s.info.displayName,fieldCount:Object.keys(s.attributes||{}).length},s.info.singularName))}):e.jsx(l,{children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[e.jsx(p,{className:"h-12 w-12 text-text-secondary/50 mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:t("content.noEntries")}),e.jsx("p",{className:"text-text-secondary text-center mb-4",children:t("schemas.createFirst")}),e.jsx(o,{to:"/schemas",children:e.jsxs(x,{children:[e.jsx(g,{}),t("schemas.createSchema")]})})]})})})}function v({name:t,displayName:a,fieldCount:r}){const{t:n}=c(),{data:s}=i({queryKey:["content",t,"count"],queryFn:()=>f.list(t,{limit:1})}),d=(s==null?void 0:s.total)||0;return e.jsx(o,{to:`/content/${t}`,children:e.jsxs(l,{variant:"interactive",className:"p-4",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[e.jsx("div",{className:"w-11 h-11 rounded-lg bg-primary-lighter flex items-center justify-center flex-shrink-0",children:e.jsx(y,{className:"h-5 w-5 text-primary"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"font-semibold truncate",children:a}),e.jsxs("p",{className:"text-sm text-text-secondary",children:[d," ",n("dashboard.entries")]})]})]}),e.jsx("div",{className:"flex flex-wrap gap-1",children:e.jsx(h,{variant:"outline",className:b,children:n("schemas.fieldsCount",{count:r})})})]})})}export{D as ContentTypesPage};
