import{x as D,r as C,j as e,R as E}from"./index-CVadajdu.js";import{u as R,a as b,P as v,b as O,c as L,d as y,Q as A}from"./QuickAccessCards-BzW1ADdW.js";import{P as F,C as M}from"./ConfirmDialog-ZeEptXE9.js";import"./switch-mwVZiWJC.js";import"./card-CsYbfw5u.js";import"./label-BUE-Cnqf.js";function N({projectId:t}){const{data:o,isLoading:s,isError:a}=R(t);D();const{editModalOpen:i,setEditModalOpen:l,deleteDialogOpen:d,setDeleteDialogOpen:c,autoRefresh:n,setAutoRefresh:m,handleRefresh:r,handleDeleteProject:u,handleConfirmDelete:p,handleEditProject:j,handleEditSubmit:f,updateProject:h,deleteProject:g}=b(t),P=s;return C.useEffect(()=>{if(!n)return;const x=setInterval(()=>{r()},5e3);return()=>clearInterval(x)},[n,t,r]),t?s?e.jsx(O,{}):a||!o?e.jsx(L,{projectId:t,project:o}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"min-h-full bg-gradient-to-br from-slate-50 via-blue-50 to-indigo-50 p-6",children:e.jsxs("div",{className:"max-w-6xl mx-auto space-y-8",children:[e.jsx(y,{project:o,isRefreshing:P,autoRefresh:n,onAutoRefreshChange:m,onEdit:j,onDelete:u,onRefresh:r}),e.jsx(A,{projectId:o.id,currentPage:"details"})]})}),e.jsx(F,{open:i,onOpenChange:l,initialData:o?{name:o.name,description:o.description}:void 0,onSubmit:f,loading:h.isPending,mode:"edit"}),e.jsx(M,{open:d,onOpenChange:c,title:"Delete Project?",description:"This will permanently delete the project and all its logs. This action cannot be undone.",onConfirm:p,loading:g.isPending,confirmLabel:"Delete"})]}):e.jsx(v,{})}const H=()=>{const{projectId:t}=E.useParams();return e.jsx(N,{projectId:t})};export{H as component};
