1import{ax as o,j as e,z as m,G as x,ay as h,B as c,b6 as p,u as y,n as b,o as u,bI as f,bJ as g,r as j,bK as N,q as k,Z as v,s as w}from"./index-CY3T9Sg9.js";const C=({submission:t,onView:s,index:r=0})=>{const a=o(new Date(t.completed_at),"MMM d, yyyy");return e.jsx(m,{className:"border-2 border-gray-200 hover-lift-sm press-feedback hover:border-gray-300 cursor-pointer animate-fade-in",onClick:s,style:{animationDelay:`${r*50}ms`,animationFillMode:"backwards"},children:e.jsx(x,{className:"p-10",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex-1 spacing-2",children:[e.jsx("h3",{className:"text-heading-m text-black",children:t.profile_name||"Assessment Results"}),e.jsxs("div",{className:"flex items-center gap-3 text-body-s text-gray-600",children:[e.jsx(h,{className:"h-4 w-4",strokeWidth:2}),e.jsxs("span",{children:["Completed ",a]}),e.jsx("span",{children:"â¢"}),e.jsx("span",{className:"capitalize",children:t.assessment_type})]})]}),e.jsxs(c,{onClick:n=>{n.stopPropagation(),s()},size:"lg",className:"flex items-center gap-2",children:[e.jsx(p,{className:"h-5 w-5",strokeWidth:2}),"View Results"]})]})})})},R=()=>{const t=y(),{user:s}=b(),{currentCompany:r}=u(),{data:a,isLoading:n}=f({queryKey:["my-results",s==null?void 0:s.id],queryFn:async()=>{if(!(s!=null&&s.id))return[];const{data:l,error:d}=await w.from("survey_submissions").select("*").eq("user_id",s.id).order("completed_at",{ascending:!1});if(d)throw d;return l||[]},enabled:!!(s!=null&&s.id)}),i=g.useRef(!1);return j.useEffect(()=>{!n&&a&&!i.current&&(i.current=!0,N({company_id:(r==null?void 0:r.company_id)||null,user_id:(s==null?void 0:s.id)||null,assessments_completed_count:a.length}))},[n,a==null?void 0:a.length]),e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx("nav",{className:"bg-background border-b border-border sticky top-0 z-50",children:e.jsxs("div",{className:"tesla-container py-4 md:py-6 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>t("/"),children:[e.jsx(k,{className:"h-7 w-7 md:h-8 md:w-8 text-foreground"}),e.jsx("span",{className:"text-lg md:text-xl font-bold text-foreground tracking-tight",children:"Zentrix Insights"})]}),e.jsxs(c,{variant:"ghost",onClick:()=>t("/dashboard"),className:"flex items-center gap-2",children:[e.jsx(v,{className:"h-4 w-4"}),"Back to Dashboard"]})]})}),e.jsx("main",{className:"tesla-container py-12 md:py-16",children:e.jsxs("div",{className:"max-w-4xl mx-auto",children:[e.jsx("h1",{className:"text-5xl font-bold text-black mb-12",children:"My Results"}),n?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx("div",{className:"animate-spin w-8 h-8 border-2 border-black border-t-transparent rounded-full"})}):a&&a.length>0?e.jsx("div",{className:"space-y-8",children:a.map(l=>e.jsx(C,{submission:l,onView:()=>t(`/results/${l.id}`)},l.id))}):e.jsxs("div",{className:"text-center py-16 bg-white border border-gray-200 rounded-lg",children:[e.jsx("h2",{className:"text-xl font-semibold text-black mb-4",children:"No Results Yet"}),e.jsx("p",{className:"text-gray-600 mb-8",children:"You haven't completed any assessments yet. Start your first one now!"}),e.jsx(c,{onClick:()=>t("/assessment"),className:"px-12 py-6 bg-black hover:bg-black/90 text-white font-bold text-lg",children:"Take Assessment"})]})]})})]})};export{R as default}; 2//# sourceMappingURL=MyResults-4GCMf3gX.js.map
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.