1import{j as e}from"./vendor-react-DpvKCdz8.js";import{u as p,t as N,C as o,B as h,g as b,b as n,L as g}from"./index-Ce-OlALc.js";import{c as u,b as y,d as v,e as j,f as w,g as C}from"./vendor-icons-DU_VAVZI.js";import"./vendor-data-C9IOYAZS.js";import"./vendor-radix-DdgSlLFX.js";function U(){const{isAuthenticated:s,loading:c}=p(),{data:i,isLoading:d}=N.content.getBatches.useQuery(void 0,{enabled:s});if(c||d)return e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600 mx-auto mb-4"}),e.jsx("p",{className:"text-gray-600",children:"Loading batch history..."})]})});if(!s)return e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsxs(o,{className:"p-8 max-w-md text-center",children:[e.jsx(u,{className:"w-16 h-16 text-blue-600 mx-auto mb-4"}),e.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Batch History"}),e.jsx("p",{className:"text-gray-600 mb-6",children:"Sign in to view your script generation history"}),e.jsx(h,{asChild:!0,className:"w-full",children:e.jsx("a",{href:b(),children:"Sign In to Continue"})})]})});const t=r=>new Date(r).toLocaleDateString("en-US",{weekday:"short",year:"numeric",month:"short",day:"numeric"}),x=r=>new Date(r).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit"});return e.jsx(e.Fragment,{children:e.jsxs("div",{className:"container py-8",children:[e.jsxs("div",{className:"mb-8 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Batch History"}),e.jsx("p",{className:"text-gray-500",children:"View all your generated content batches"})]}),e.jsxs(n,{variant:"outline",className:"text-sm",children:[i?.length||0," batches total"]})]}),e.jsx("div",{className:"max-w-4xl",children:!i||i.length===0?e.jsxs(o,{className:"p-12 text-center",children:[e.jsx(u,{className:"w-16 h-16 text-gray-400 mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"No batches yet"}),e.jsx("p",{className:"text-gray-600 mb-6",children:"Generate your first batch of content to see them here"}),e.jsx(g,{href:"/",children:e.jsx(h,{children:"Go to Dashboard"})})]}):e.jsx("div",{className:"space-y-4",children:i.map((r,l)=>e.jsx(S,{batch:r,isLatest:l===0,formatDate:t,formatTime:x},r.id))})})]})})}function S({batch:s,isLatest:c,formatDate:i,formatTime:d}){const{data:t}=N.content.getScripts.useQuery(void 0,{enabled:!!s.id}),x=t?.length||0,r=t?.filter(a=>a.userStatus==="selected").length||0,l=t?.filter(a=>a.userStatus==="recorded").length||0,m=t?.filter(a=>a.userStatus==="disqualified").length||0,f=()=>s.status==="ready"?e.jsx(n,{className:"bg-green-100 text-green-700 border-green-200",children:"Ready"}):s.status==="generating"?e.jsx(n,{className:"bg-yellow-100 text-yellow-700 border-yellow-200",children:"Generating"}):s.status==="archived"?e.jsx(n,{className:"bg-gray-100 text-gray-700 border-gray-200",children:"Archived"}):e.jsx(n,{variant:"outline",children:"Unknown"});return e.jsxs(o,{className:"p-6 hover:shadow-md transition-shadow",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[e.jsxs("h3",{className:"text-lg font-semibold text-gray-900",children:["Week of ",s.weekId]}),c&&e.jsx(n,{className:"bg-blue-100 text-blue-700 border-blue-200",children:"Latest"}),f()]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm text-gray-600 mb-4",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(u,{className:"w-4 h-4"}),i(s.generatedAt)]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(y,{className:"w-4 h-4"}),d(s.generatedAt)]}),e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(v,{className:"w-4 h-4"}),x," scripts"]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[r>0&&e.jsxs("span",{className:"flex items-center gap-1 text-blue-600",children:[e.jsx(j,{className:"w-4 h-4"}),r," selected"]}),l>0&&e.jsxs("span",{className:"flex items-center gap-1 text-green-600",children:[e.jsx(j,{className:"w-4 h-4"}),l," recorded"]}),m>0&&e.jsxs("span",{className:"flex items-center gap-1 text-red-600",children:[e.jsx(w,{className:"w-4 h-4"}),m," disqualified"]}),r===0&&l===0&&m===0&&e.jsx("span",{className:"text-gray-500",children:"No scripts marked yet"})]})]}),e.jsx(g,{href:`/?batch=${s.id}`,children:e.jsxs(h,{variant:"ghost",size:"sm",className:"gap-1",children:["View Scripts",e.jsx(C,{className:"w-4 h-4"})]})})]}),t&&t.length>0&&e.jsxs("div",{className:"mt-4 pt-4 border-t border-gray-100",children:[e.jsx("p",{className:"text-xs text-gray-500 mb-2",children:"Scripts in this batch:"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.slice(0,5).map(a=>e.jsx(g,{href:`/script/${a.id}`,children:e.jsx(n,{variant:"outline",className:"cursor-pointer hover:bg-gray-100 transition-colors text-xs",children:a.title.length>30?a.title.substring(0,30)+"...":a.title})},a.id)),t.length>5&&e.jsxs(n,{variant:"outline",className:"text-xs text-gray-500",children:["+",t.length-5," more"]})]})]})]})}export{U 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.