PageSourceSearch

https://study-tracker-mikejubiins.replit.app/assets/batch-export-BH_5PHJS.js

js study-tracker-mikejubiins.replit.app collected 2026-10-03 03:52:50 UTC 4,586 bytes, 6 lines download raw bytes

1import{c as k,u as E,r,d as N,j as e,B as v,C as A,f as B,g as L,h as P,i as S,o as R}from"./index-C8lx4ti2.js";import{P as D}from"./progress-BWR82eK-.js";import{A as F}from"./arrow-left-D9ihHdXS.js";import{C as b}from"./cloud-DE7KUQ7G.js";import{C as H}from"./circle-check-big-CTTPCc9m.js";import{C as I}from"./circle-x-D_3ixFdF.js";/**
2 * @license lucide-react v0.453.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const O=k("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);function U(){const{toast:o}=E(),[i,d]=r.useState(!1),[x,m]=r.useState(0),[p,u]=r.useState(""),[t,l]=r.useState({success:0,failed:0,errors:[]}),{data:h=[],isLoading:C}=N({queryKey:["/api/health-applications"]}),{data:g=[],isLoading:w}=N({queryKey:["/api/home-auto-applications"]}),c=h.length+g.length,j=async()=>{d(!0),m(10),u("Starting server-side batch export..."),l({success:0,failed:0,errors:[]});try{const s=await R("/api/applications/batch-export-to-onedrive","POST",{});if(!s.ok){const y=await s.json();throw new Error(y.message||"Batch export failed")}const a=await s.json();m(100),l({success:a.results.success,failed:a.results.failed,errors:a.results.errors||[]}),o({title:"Batch Export Complete",description:a.message})}catch(s){l({success:0,failed:c,errors:[s.message]}),o({title:"Export Failed",description:s.message||"Failed to run batch export",variant:"destructive"})}finally{d(!1),u("")}},n=C||w,f=r.useRef(!1);return r.useEffect(()=>{new URLSearchParams(window.location.search).get("run")==="true"&&!n&&c>0&&!f.current&&!i&&(f.current=!0,j())},[n,c,i]),e.jsxs("div",{className:"container mx-auto p-6 max-w-2xl",children:[e.jsx("div",{className:"mb-6",children:e.jsxs(v,{onClick:()=>window.history.back(),variant:"outline",className:"flex items-center space-x-2","data-testid":"button-back",children:[e.jsx(F,{className:"h-4 w-4"}),e.jsx("span",{children:"Back"})]})}),e.jsxs(A,{children:[e.jsxs(B,{children:[e.jsxs(L,{className:"flex items-center gap-2",children:[e.jsx(b,{className:"h-6 w-6"}),"Batch Export to OneDrive"]}),e.jsx(P,{children:"Export all existing applications to OneDrive as PDF files"})]}),e.jsx(S,{className:"space-y-6",children:n?e.jsxs("div",{className:"flex items-center justify-center py-8",children:[e.jsx(O,{className:"h-8 w-8 animate-spin"}),e.jsx("span",{className:"ml-2",children:"Loading applications..."})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-center",children:[e.jsxs("div",{className:"p-4 bg-blue-50 dark:bg-blue-900/20 rounded-lg",children:[e.jsx("div",{className:"text-3xl font-bold text-blue-600 dark:text-blue-400",children:h.length}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Health Applications"})]}),e.jsxs("div",{className:"p-4 bg-green-50 dark:bg-green-900/20 rounded-lg",children:[e.jsx("div",{className:"text-3xl font-bold text-green-600 dark:text-green-400",children:g.length}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Home & Auto Applications"})]})]}),e.jsxs("div",{className:"text-center text-lg font-medium",children:["Total: ",c," applications to export"]}),i?e.jsxs("div",{className:"space-y-4",children:[e.jsx(D,{value:x,className:"h-3"}),e.jsxs("div",{className:"text-center text-sm text-muted-foreground",children:[x,"% complete"]}),p&&e.jsxs("div",{className:"text-center text-sm",children:["Exporting: ",p]})]}):e.jsxs(v,{onClick:j,className:"w-full",size:"lg",disabled:c===0,"data-testid":"button-start-export",children:[e.jsx(b,{className:"h-5 w-5 mr-2"}),"Start Batch Export to OneDrive"]}),(t.success>0||t.failed>0)&&!i&&e.jsxs("div",{className:"space-y-4 mt-6",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-green-50 dark:bg-green-900/20 rounded-lg",children:[e.jsx(H,{className:"h-5 w-5 text-green-600"}),e.jsxs("span",{className:"font-medium",children:[t.success," Successful"]})]}),e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-red-50 dark:bg-red-900/20 rounded-lg",children:[e.jsx(I,{className:"h-5 w-5 text-red-600"}),e.jsxs("span",{className:"font-medium",children:[t.failed," Failed"]})]})]}),t.errors.length>0&&e.jsxs("div",{className:"p-4 bg-red-50 dark:bg-red-900/20 rounded-lg",children:[e.jsx("h4",{className:"font-medium text-red-600 mb-2",children:"Errors:"}),e.jsx("ul",{className:"text-sm space-y-1",children:t.errors.map((s,a)=>e.jsx("li",{className:"text-red-600",children:s},a))})]})]})]})})]})]})}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.