(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[195],{332:(e,t,r)=>{"use strict";r.d(t,{default:()=>m});var s=r(5155),a=r(7168),n=r(2115),i=r(3999);function l(e){let{className:t,...r}=e;return(0,s.jsx)("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:(0,s.jsx)("table",{"data-slot":"table",className:(0,i.cn)("w-full caption-bottom text-sm",t),...r})})}function d(e){let{className:t,...r}=e;return(0,s.jsx)("thead",{"data-slot":"table-header",className:(0,i.cn)("[&_tr]:border-b",t),...r})}function o(e){let{className:t,...r}=e;return(0,s.jsx)("tbody",{"data-slot":"table-body",className:(0,i.cn)("[&_tr:last-child]:border-0",t),...r})}function c(e){let{className:t,...r}=e;return(0,s.jsx)("tr",{"data-slot":"table-row",className:(0,i.cn)("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",t),...r})}function u(e){let{className:t,...r}=e;return(0,s.jsx)("th",{"data-slot":"table-head",className:(0,i.cn)("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...r})}function h(e){let{className:t,...r}=e;return(0,s.jsx)("td",{"data-slot":"table-cell",className:(0,i.cn)("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",t),...r})}var x=r(6414),b=r(5695);function m(e){let{testimonials:t}=e,r=(0,b.useRouter)(),i=(0,x.k)(),[m,v]=(0,n.useState)(null),g=async e=>{if(!confirm("Are you sure you want to delete this testimonial?"))return;v(e);let{error:t}=await i.from("testimonials").delete().eq("id",e);t?alert("Error deleting testimonial: "+t.message):r.refresh(),v(null)};return 0===t.length?(0,s.jsxs)("div",{className:"text-center py-12",children:[(0,s.jsx)("p",{className:"text-stone-600 mb-4",children:"No testimonials yet"}),(0,s.jsx)(a.$,{asChild:!0,className:"bg-amber-700 hover:bg-amber-800",children:(0,s.jsx)("a",{href:"/admin/testimonials/new",children:"Add Your First Testimonial"})})]}):(0,s.jsxs)(l,{children:[(0,s.jsx)(d,{children:(0,s.jsxs)(c,{children:[(0,s.jsx)(u,{children:"Name"}),(0,s.jsx)(u,{children:"Role"}),(0,s.jsx)(u,{children:"Rating"}),(0,s.jsx)(u,{children:"Content Preview"}),(0,s.jsx)(u,{children:"Actions"})]})}),(0,s.jsx)(o,{children:t.map(e=>(0,s.jsxs)(c,{children:[(0,s.jsx)(h,{className:"font-medium",children:e.name}),(0,s.jsx)(h,{children:e.role}),(0,s.jsx)(h,{children:(0,s.jsx)("div",{className:"flex",children:[...Array(e.rating)].map((e,t)=>(0,s.jsx)("span",{className:"text-amber-500",children:"★"},t))})}),(0,s.jsx)(h,{className:"max-w-md truncate",children:e.content}),(0,s.jsx)(h,{children:(0,s.jsx)(a.$,{variant:"destructive",size:"sm",onClick:()=>g(e.id),disabled:m===e.id,children:m===e.id?"Deleting...":"Delete"})})]},e.id))})]})}},519:(e,t,r)=>{Promise.resolve().then(r.bind(r,332)),Promise.resolve().then(r.t.bind(r,6874,23))},3999:(e,t,r)=>{"use strict";r.d(t,{cn:()=>n});var s=r(2596),a=r(9688);function n(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,a.QP)((0,s.$)(t))}},6414:(e,t,r)=>{"use strict";r.d(t,{U:()=>n,k:()=>n});var s=r(8826),a=r(9509);function n(){return(0,s.createBrowserClient)(a.env.NEXT_PUBLIC_SUPABASE_URL,a.env.NEXT_PUBLIC_SUPABASE_ANON_KEY)}},7168:(e,t,r)=>{"use strict";r.d(t,{$:()=>d});var s=r(5155);r(2115);var a=r(9708),n=r(2085),i=r(3999);let l=(0,n.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function d(e){let{className:t,variant:r,size:n,asChild:d=!1,...o}=e,c=d?a.DX:"button";return(0,s.jsx)(c,{"data-slot":"button",className:(0,i.cn)(l({variant:r,size:n,className:t})),...o})}}},e=>{var t=t=>e(e.s=t);e.O(0,[730,874,352,343,441,684,358],()=>t(519)),_N_E=e.O()}]);