PageSourceSearch

https://roundrock.info/assets/AdminImagesPage-DFoFne48.js

js roundrock.info collected 2026-10-03 00:17:14 UTC 7,686 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AdminImageOptimizerPage--OmkOCrf.js","assets/vendor-markdown-BmpwsGl4.js","assets/vendor-charts-BOLnNRpC.js","assets/vendor-markdown-Cr8Tc6mT.css","assets/index-COFl0cUZ.js","assets/index-B5xG2Dop.css","assets/progress-CSvCELYs.js","assets/image-compress-BdaklRpF.js","assets/image-BMTpdUCh.js","assets/circle-check-big-C0OvPWxp.js","assets/AdminCategoryHeroesPage-BIUSxB7Z.js"])))=>i.map(i=>d[i]);
2import{s as j,T as B,V as C,W as T,r as N,b0 as R,_ as E,bP as I,bQ as L,bR as k,bS as x,bT as A,bU as h,B as p,v,o as y,i as O,b as $,aO as M,aP as D,aQ as w,bL as S,bE as P}from"./index-COFl0cUZ.js";import{j as e}from"./vendor-markdown-BmpwsGl4.js";import{r as i}from"./vendor-charts-BOLnNRpC.js";const F=1e4,H=30;function _(s){return s==null?"—":s<1024?`${s} B`:s<1024*1024?`${(s/1024).toFixed(1)} KB`:`${(s/1024/1024).toFixed(2)} MB`}function V(){const[s,d]=i.useState({success:0,skipped:0,error:0,total:0,saved_bytes:0}),[c,m]=i.useState([]),[a,g]=i.useState(!0),o=i.useCallback(async()=>{const t=new Date(Date.now()-864e5).toISOString(),[u,r]=await Promise.all([j.from("photo_optimization_jobs").select("status, original_size, new_size").gte("created_at",t),j.from("photo_optimization_jobs").select("id, business_name, source, status, original_size, new_size, error_message, created_at").order("created_at",{ascending:!1}).limit(H)]);if(!u.error&&u.data){const n={success:0,skipped:0,error:0,total:u.data.length,saved_bytes:0};for(const l of u.data)l.status in n&&n[l.status]++,l.status==="success"&&l.original_size&&l.new_size&&(n.saved_bytes+=Math.max(0,l.original_size-l.new_size));d(n)}!r.error&&r.data&&m(r.data),g(!1)},[]);i.useEffect(()=>{o();const t=setInterval(o,F);return()=>clearInterval(t)},[o]);const b=t=>t==="success"?e.jsx(p,{className:"bg-emerald-600 hover:bg-emerald-700",children:"Success"}):t==="error"?e.jsx(p,{variant:"destructive",children:"Error"}):e.jsx(p,{variant:"outline",children:"Skipped"});return e.jsxs(B,{className:"mt-6",children:[e.jsxs(C,{className:"flex flex-row items-center justify-between space-y-0",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-lg",children:"Automated Photo Optimization"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Backgroun
2d WebP/JPEG conversion runs on a schedule. Last 24 hours."})]}),e.jsx(N,{variant:"outline",size:"sm",onClick:o,"aria-label":"Refresh photo optimization queue",children:e.jsx(R,{className:"h-4 w-4"})})]}),e.jsxs(E,{children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-3 mb-4",children:[e.jsx(f,{label:"Total (24h)",value:s.total}),e.jsx(f,{label:"Success",value:s.success,accent:"success"}),e.jsx(f,{label:"Skipped",value:s.skipped}),e.jsx(f,{label:"Errors",value:s.error,accent:s.error>0?"destructive":void 0}),e.jsx(f,{label:"Saved",value:_(s.saved_bytes),accent:"success"})]}),a?e.jsx("div",{className:"text-sm text-muted-foreground py-4 text-center",children:"Loading…"}):c.length===0?e.jsx("div",{className:"text-sm text-muted-foreground py-4 text-center",children:"No optimization jobs yet."}):e.jsx("div",{className:"border rounded-md overflow-hidden",children:e.jsxs(I,{children:[e.jsx(L,{children:e.jsxs(k,{children:[e.jsx(x,{children:"Business"}),e.jsx(x,{children:"Source"}),e.jsx(x,{children:"Status"}),e.jsx(x,{children:"Before"}),e.jsx(x,{children:"After"}),e.jsx(x,{children:"When"})]})}),e.jsx(A,{children:c.map(t=>e.jsxs(k,{children:[e.jsx(h,{className:"font-medium text-sm",children:t.business_name??"—"}),e.jsx(h,{className:"text-xs",children:t.source}),e.jsx(h,{children:b(t.status)}),e.jsx(h,{className:"text-xs",children:_(t.original_size)}),e.jsx(h,{className:"text-xs",children:_(t.new_size)}),e.jsx(h,{className:"text-xs text-muted-foreground",children:new Date(t.created_at).toLocaleString()})]},t.id))})]})})]})]})}function f({label:s,value:d,accent:c}){const m=c==="success"?"text-emerald-600":c==="destructive"?"text-destructive":"text-foreground";return e.jsxs("div",{className:"rounded-md border bg-card p-3",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:s}),e.jsx("div",{className:`text-2xl font-semibold ${m}`,children:d})]})}function Q(){const[s,d]=i.useState(!1),[c,m]=i.useState(!1),[a,g]=i.useState(null),[o,b]=i.useState(25),t=i.useCallback(async()=>{d(!0);try{const{data:r,error:n}=await j.functions.invoke("backfill-ai-photos",{body:{dryRun:!0}});if(n)throw n;g(r)}catch(r){v.error("Scan failed",{description:r.message})}finally{d(!1)}},[]);i.useEffect(()=>{t()},[t]);const u=async()=>{m(!0);try{const{data:r,error:n}=await j.functions.invoke("backfill-ai-photos",{body:{batchSize:o}});if(n)throw n;const l=r;v.success("Backfill Started",{description:`Queued ${l.queued} listings. ${l.remaining_after} remaining after this batch.`}),setTimeout(t,2e3)}catch(r){v.error("Backfill Failed",{description:r.message})}finally{m(!1)}};return e.jsxs(B,{className:"mt-6",children:[e.jsxs(C,{className:"flex flex-row items-center justify-between space-y-0",children:[e.jsxs("div",{children:[e.jsx(T,{className:"text-lg",children:"Backfill AI Photos"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Generates a placeholder photo for active, unclaimed listings that have no photos and no prior AI job."})]}),e.jsx(N,{variant:"outline",size:"sm",onClick:t,disabled:s,"aria-label":"Rescan missing listings",children:e.jsx(R,{className:`h-4 w-4 ${s?"animate-spin":""}`})})]}),e.jsxs(E,{children:[e.jsxs("div",{className:"flex flex-wrap items-end gap-4",children:[e.jsxs("div",{className:"rounded-md border bg-card p-3 min-w-[140px]",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:"Listings missing photos"}),e.jsx("div",{className:"text-2xl font-semibold",children:s&&!a?e.jsx(y,{className:"h-5 w-5 animate-spin"}):(a==null?void 0:a.total_missing)??"—"})]}),e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{htmlFor:"backfill-batch",className:"text-xs text-muted-foreground",children:"Batch size (max 100)"}),e.jsx("input",{id:"backfill-batch",type:"number",min:1,max:100,value:o,onChange:r=>b(Math.max(1,Math.min(100,Number(r.target.value)||1))),className:"h-9 w-24 rounded-md border bg-background px-3 text-sm"})]}),e.jsxs(N,{onClick:u,disabled:c||!a||a.total_missing===0,className:"ml-auto",children:[c?e.jsx(y,{className:"h-4 w-4 animate-spin mr-2"}):e.jsx(O,{className:"h-4 w-4 mr-2"}),"Run Backfill"]})]}),a&&a.sample.length>0&&e.jsxs("div",{className:"mt-4 text-xs text-muted-foreground",children:["Sample: ",a.sample.map(r=>r.name).join(", "),a.total_missing>a.sample.length&&` and ${a.total_missing-a.sample.length} more`]})]})]})}const W=i.lazy(()=>P(()=>import("./AdminImageOptimizerPage--OmkOCrf.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]))),q=i.lazy(()=>P(()=>import("./AdminCategoryHeroesPage-BIUSxB7Z.js"),__vite__mapDeps([10,1,2,3,4,5,6,7,8]))),z=()=>e.jsx("div",{className:"flex items-center justify-center p-12",children:e.jsx(y,{className:"h-6 w-6 animate-spin text-muted-foreground"})});function U(){return $("Images – Admin"),e.jsxs("div",{className:"p-6 max-w-5xl",children:[e.jsx("h1",{className:"text-2xl font-bold mb-6",children:"Images"}),e.jsxs(M,{defaultValue:"optimizer",children:[e.jsxs(D,{children:[e.jsx(w,{value:"optimizer",children:"Bulk Optimizer"}),e.jsx(w,{value:"category-heroes",children:"Category Heroes"})]}),e.jsxs(S,{value:"optimizer",className:"mt-4",children:[e.jsx(i.Suspense,{fallback:e.jsx(z,{}),children:e.jsx(W,{})}),e.jsx(Q,{}),e.jsx(V,{})]}),e.jsx(S,{value:"category-heroes",className:"mt-4",children:e.jsx(i.Suspense,{fallback:e.jsx(z,{}),children:e.jsx(q,{})})})]})]})}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.