1import{b as v,u as w,r as z,s as m,j as e,L as D,B as C,c as x}from"./index-CQuB5ZWa.js";import{u as A}from"./useQuery-B4UjelZt.js";import{C as h,a as u,b as _,c as k,d as T}from"./card-D4Q3WpZL.js";import{A as q,a as L,T as B,b as F,c as H,d as I,e as E,f as Q,g as U,h as $}from"./alert-dialog-CiIR94sF.js";import{C as p}from"./calendar-BCm2NZG4.js";import{B as K}from"./building-2-BTP7Yzwl.js";import{T as j}from"./trending-up-Zw44IqPF.js";import"./index-CW-U_cQI.js";import"./index-BK3bADyO.js";import"./Combination-DqSWzZzh.js";function Y(){const{user:i}=v(),f=w(),[b,c]=z.useState(null),{data:n,isLoading:g}=A({queryKey:["all-interviews",i==null?void 0:i.id],queryFn:async()=>{if(!i)return[];const{data:s,error:r}=await m.from("interviews").select(` 2 *, 3 job_processes ( 4 role_title, 5 status, 6 companies ( 7 name 8 ) 9 ) 10 `).eq("user_id",i.id).order("interview_date",{ascending:!1});if(r)throw r;return s},enabled:!!i}),N=async(s,r,a)=>{a.preventDefault(),c(s);try{const{data:t,error:l}=await m.functions.invoke("delete-interview",{body:{interview_id:s}});if(l)throw l;if(t!=null&&t.error)throw new Error(t.error);x.success("Interview deleted successfully"),f.invalidateQueries({queryKey:["all-interviews"]})}catch(t){console.error("Delete error:",t),x.error("Failed to delete interview")}finally{c(null)}};return g?e.jsx("div",{className:"flex items-center justify-center min-h-[400px]",children:e.jsx("div",{className:"w-16 h-16 border-4 border-zinc-900 border-t-transparent rounded-full animate-spin"})}):e.jsx("div",{className:"min-h-screen bg-zinc-50",children:e.jsxs("div",{className:"max-w-5xl mx-auto px-6 lg:px-12 py-12 md:py-16 space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-semibold text-zinc-900 tracking-tight",children:"Interview History"}),e.jsx("p",{className:"text-zinc-600",children:"View all your analyzed interviews"})]}),!n||n.length===0?e.jsx(h,{className:"bg-white border-dashed border-zinc-300 rounded-2xl shadow-sm",children:e.jsxs(u,{className:"flex flex-col items-center justify-center py-12",children:[e.jsx("div",{className:"w-14 h-14 rounded-full bg-zinc-100 flex items-center justify-center mb-4",children:e.jsx(p,{className:"h-7 w-7 text-zinc-400"})}),e.jsx("p",{className:"text-lg font-medium text-zinc-900 mb-2",children:"No interviews yet"}),e.jsx("p",{className:"text-sm text-zinc-500",children:"Upload your first interview to get started"})]})}):e.jsx("div",{className:"grid gap-4",children:n.map(s=>{var l,d,o;const r=s.analysis_results,a=r==null?void 0:r.three_mirrors,t=r==null?void 0:r.outcome_prediction;return e.jsxs(h,{className:"bg-white border-zinc-200 hover:border-zinc-300 transition-all rounded-2xl shadow-sm",children:[e.jsx(_,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(D,{to:`/analysis/${s.id}`,className:"flex-1",children:e.jsxs("div",{className:"space-y-1",children:[e.jsxs(k,{className:"flex items-center gap-2 text-zinc-900 hover:text-zinc-700 transition-colors",children:[e.jsx(K,{className:"h-5 w-5 text-zinc-700"}),(d=(l=s.job_processes)==null?void 0:l.companies)==null?void 0:d.name]}),e.jsxs(T,{className:"text-zinc-500",children:[(o=s.job_processes)==null?void 0:o.role_title," ⢠",s.round_type]})]})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`inline-flex items-center px-2.5 py-1 rounded-full text-xs font-medium border ${s.status==="completed"?"bg-emerald-50 border-emerald-200 text-emerald-700":s.status==="processing"?"bg-blue-50 border-blue-200 text-blue-700":"bg-zinc-100 border-zinc-200 text-zinc-500"}`,children:s.status}),e.jsxs(q,{children:[e.jsx(L,{asChild:!0,children:e.jsx(C,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",disabled:b===s.id,children:e.jsx(B,{className:"h-4 w-4"})})}
10),e.jsxs(F,{children:[e.jsxs(H,{children:[e.jsx(I,{children:"Delete Interview Analysis?"}),e.jsx(E,{children:"This will permanently delete this interview analysis and its recording. This action cannot be undone."})]}),e.jsxs(Q,{children:[e.jsx(U,{children:"Cancel"}),e.jsx($,{onClick:y=>N(s.id,s.file_path,y),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})]})]})]})}),e.jsx(u,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(p,{className:"h-4 w-4 text-zinc-400"}),e.jsx("span",{className:"text-zinc-700",children:new Date(s.interview_date).toLocaleDateString()})]}),a&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(j,{className:"h-4 w-4 text-zinc-700"}),e.jsxs("span",{className:"text-zinc-600",children:["Capability: ",e.jsx("span",{className:"font-medium text-zinc-900",children:a.capability.score})]})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(j,{className:"h-4 w-4 text-success"}),e.jsxs("span",{className:"text-zinc-600",children:["Performance: ",e.jsx("span",{className:"font-medium text-success",children:a.performance.score})]})]})]})]}),t&&e.jsxs("span",{className:`inline-flex items-center px-2.5 py-1 rounded-full text-xs font-medium border ${t.likelihood==="high"?"bg-emerald-50 border-emerald-200 text-emerald-700":t.likelihood==="medium"?"bg-amber-50 border-amber-200 text-amber-700":"bg-red-50 border-red-200 text-red-700"}`,children:[t.likelihood.charAt(0).toUpperCase()+t.likelihood.slice(1)," Likelihood"]})]})})]},s.id)})})]})})}export{Y as default};
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.