PIMS/public/build/assets/Dashboard-CFdKPMzj.js

2 lines
4.4 KiB
JavaScript

import{_ as y}from"./AppLayout.vue_vue_type_script_setup_true_lang-86gE95Fg.js";import{d as k}from"./index-C4J_hXM0.js";import{d as v,c as w,a as s,b as e,o as r,r as _,e as $,f as l,u as M,h as j,w as L,t as n,F as f,g as m,i as c}from"./app-BXYcVHqk.js";import"./AppLogoIcon.vue_vue_type_script_setup_true_lang-BzXwPo6R.js";import"./useForwardExpose-Djbxsgaa.js";import"./VisuallyHidden-BvthYHr5.js";import"./RovingFocusGroup-dmigQ6Dy.js";import"./useArrowNavigation-C6Y-ieo6.js";import"./createLucideIcon-BlA39rtn.js";const D={class:"absolute inset-0 size-full stroke-neutral-900/20 dark:stroke-neutral-100/20",fill:"none"},N=["id"],V=["fill"],p=v({__name:"PlaceholderPattern",setup(b){const u=w(()=>`pattern-${Math.random().toString(36).substring(2,9)}`);return(i,o)=>(r(),s("svg",D,[e("defs",null,[e("pattern",{id:u.value,x:"0",y:"0",width:"8",height:"8",patternUnits:"userSpaceOnUse"},[...o[0]||(o[0]=[e("path",{d:"M-1 5L5 -1M3 9L8.5 3.5","stroke-width":"0.5"},null,-1)])],8,N)]),e("rect",{stroke:"none",fill:`url(#${u.value})`,width:"100%",height:"100%"},null,8,V)]))}}),A={class:"flex h-full flex-1 flex-col gap-4 overflow-x-auto rounded-xl p-4"},B={class:"grid auto-rows-min gap-4 md:grid-cols-3"},C={class:"relative overflow-hidden rounded-xl border border-sidebar-border/70 dark:border-sidebar-border"},F={class:"p-4"},P={key:0,class:"rounded-md border border-red-300 bg-red-50 p-3 text-red-800 dark:border-red-800 dark:bg-red-950 dark:text-red-200"},S={key:1},U={key:0,class:"space-y-3"},q=["aria-busy"],z=["href"],E={class:"h-20 w-14 shrink-0 overflow-hidden rounded bg-muted"},R=["src","alt"],X={class:"flex min-w-0 flex-1 flex-col"},H={class:"flex items-center justify-between gap-2"},I={class:"truncate font-medium"},O={class:"text-xs text-muted-foreground"},W={class:"mt-1 text-xs text-muted-foreground"},G={key:0,class:"mr-2 rounded border px-1 py-0.5"},J={key:1},K={key:0,class:"px-2 py-2 text-sm text-muted-foreground"},Q={class:"relative aspect-video overflow-hidden rounded-xl border border-sidebar-border/70 dark:border-sidebar-border"},T={class:"relative aspect-video overflow-hidden rounded-xl border border-sidebar-border/70 dark:border-sidebar-border"},Y={class:"relative min-h-[100vh] flex-1 rounded-xl border border-sidebar-border/70 md:min-h-min dark:border-sidebar-border"},le=v({__name:"Dashboard",setup(b){const u=[{title:"Dashboard",href:k().url}],i=_(!1),o=_(null),h=_([]);async function x(){i.value=!0,o.value=null;try{const d=await fetch("/api/movies?sort=newest&per_page=3",{headers:{Accept:"application/json","X-Requested-With":"XMLHttpRequest"},credentials:"same-origin"});if(!d.ok)throw new Error(`Failed: ${d.status}`);const a=await d.json();h.value=a.data}catch(d){o.value=d?.message??"Unexpected error"}finally{i.value=!1}}return $(x),(d,a)=>(r(),s(f,null,[l(M(j),{title:"Dashboard"}),l(y,{breadcrumbs:u},{default:L(()=>[e("div",A,[e("div",B,[e("div",C,[e("div",F,[a[1]||(a[1]=e("div",{class:"mb-3 flex items-center justify-between gap-2"},[e("h2",{class:"text-sm font-semibold"},"Last Movies Added"),e("a",{href:"/movies",class:"text-xs text-primary underline-offset-2 hover:underline"},"View all")],-1)),o.value?(r(),s("div",P,n(o.value),1)):(r(),s("div",S,[i.value?(r(),s("div",U,[(r(),s(f,null,m(3,t=>e("div",{key:t,class:"flex gap-3"},[...a[0]||(a[0]=[e("div",{class:"h-20 w-14 shrink-0 rounded bg-muted animate-pulse"},null,-1),e("div",{class:"flex min-w-0 flex-1 flex-col gap-2"},[e("div",{class:"h-4 w-1/2 rounded bg-muted animate-pulse"}),e("div",{class:"h-3 w-2/3 rounded bg-muted animate-pulse"}),e("div",{class:"h-3 w-1/3 rounded bg-muted animate-pulse"})],-1)])])),64))])):(r(),s("ul",{key:1,class:"divide-y divide-muted-foreground/20","aria-busy":i.value?"true":"false"},[(r(!0),s(f,null,m(h.value,t=>(r(),s("li",{key:t.id,class:"py-2"},[e("a",{href:`/movies/${t.id}`,class:"flex gap-3 rounded px-2 py-2 hover:bg-muted/40 focus:bg-muted/40 focus:outline-none"},[e("div",E,[t.poster_url?(r(),s("img",{key:0,src:t.poster_url,alt:`Poster for ${t.title}`,loading:"lazy",class:"h-full w-full object-cover"},null,8,R)):c("",!0)]),e("div",X,[e("div",H,[e("div",I,n(t.title),1),e("div",O,n(t.year??""),1)]),e("div",W,[t.rating?(r(),s("span",G,n(t.rating),1)):c("",!0),t.genres?.length?(r(),s("span",J,n(t.genres.map(g=>g.name).join(", ")),1)):c("",!0)])])],8,z)]))),128)),h.value.length?c("",!0):(r(),s("li",K,"No movies yet — add some from Admin → Movies."))],8,q))]))])]),e("div",Q,[l(p)]),e("div",T,[l(p)])]),e("div",Y,[l(p)])])]),_:1})],64))}});export{le as default};