1import{$ as j,r as d,j as e,x as f}from"./index-BXMyHymQ.js";import{f as N}from"./functions-CrqCVS80.js";import{S as k}from"./sparkles-B1t-sDEL.js";import{T as b}from"./triangle-alert-apZ0IDev.js";import{C as g}from"./circle-check-BzvVAspZ.js";const n={fontFamily:"'Barlow Condensed', 'Arial Black', Impact, sans-serif"};function R(){var h;const{toast:c}=j(),[i,o]=d.useState(!1),[a,x]=d.useState(null),[m,p]=d.useState(null),u=async()=>{var t,r,l;o(!0),p(null),x(null);try{const s=await N.scrubServiceAreaContent({});x(s.data||s),c({title:"Cleanup complete!",description:`${((t=s.data)==null?void 0:t.updated)??s.updated??0} records updated.`})}catch(s){p(((l=(r=s==null?void 0:s.response)==null?void 0:r.data)==null?void 0:l.error)||(s==null?void 0:s.message)||"Failed to run cleanup"),c({title:"Cleanup failed",description:(s==null?void 0:s.message)||"Try again",variant:"destructive"})}finally{o(!1)}};return e.jsxs("div",{className:"max-w-3xl mx-auto",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("p",{className:"text-xs font-bold uppercase tracking-[0.2em] text-black/40 mb-1",children:"Admin Tools"}),e.jsx("h1",{className:"text-3xl font-black uppercase italic text-black leading-none",style:n,children:"Service Area Content Cleanup"}),e.jsx("p",{className:"text-black/60 mt-3 text-sm leading-relaxed",children:"Removes 24/7 and legacy 247 Premier Locksmith language from all service area pages."})]}),e.jsx("div",{className:"bg-white border border-border rounded-lg p-6 mb-6",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center shrink-0",style:{background:"#FFC72C"},children:e.jsx(k,{className:"w-5 h-5 text-black"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h2",{className:"font-bold text-black text-sm mb-1",children:"Scrub Service Area Pages"}),e.jsx("p",{className:"text-xs text-black/50 leading-relaxed mb-4",children:'Scans every ServiceAreaPage record and replaces brand-rule-violating phrases like "24/7", "247 Premier Locksmith", and "around the clock" with approved alternatives. Only records with changes are updated â running this on already-clean pages is safe and changes nothing.'}),e.jsx("button",{onClick:u,disabled:i,className:"inline-flex items-center gap-2 font-bold uppercase tracking-wide px-5 py-2.5 text-sm transition-all hover:opacity-90 disabled:opacity-50",style:{background:"#0a0a0a",color:"#FFC72C",borderRadius:2},children:i?e.jsxs(e.Fragment,{children:[e.jsx(f,{className:"w-4 h-4 animate-spin"})," Runningâ¦"]}):"Run Cleanup"})]})]})}),m&&e.jsxs("div",{className:"bg-red-50 border border-red-200 rounded-lg p-4 mb-6 flex items-start gap-3",children:[e.jsx(b,{className:"w-5 h-5 text-red-500 shrink-0 mt-0.5"}),e.jsxs("div",{children:[e.jsx("p",{className:"font-bold text-red-800 text-sm",children:"Error"}),e.jsx("p",{className:"text-red-600 text-sm mt-1",children:m})]})]}),a&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"bg-white border border-border rounded-lg p-5 text-center",children:[e.jsx("p",{className:"text-3xl font-black text-black",style:n,children:a.scanned??0}),e.jsx("p",{className:"text-xs font-bold uppercase tracking-wide text-black/40 mt-1",children:"Scanned"})]}),e.jsxs("div",{className:"bg-white border border-border rounded-lg p-5 text-center",children:[e.jsx("p",{className:"text-3xl font-black",style:{...n,color:a.updated>0?"#0a0a0a":"#999"},children:a.updated??0}),e.jsx("p",{className:"text-xs font-bold uppercase tracking-wide text-black/40 mt-1",children:"Updated"})]})]}),a.remainingViolations&&a.remainingViolations.length>0&&e.jsxs("div",{className:"bg-red-50 border border-red-300 rounded-lg p-5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(b,{className:"w-5 h-5 text-red-500"}),e.jsx("h3",{className:"font-black uppercase text-sm text-red-800",style:n,children:"Remaining Violations â Manual Fix Needed"})]}),e.jsx("div",{className:"space-y-3",children:a.remainingViolations.map((t,r)=>e.jsxs("div",{className:"bg-white border border-red-200 rounded p-3",children:[e.jsxs("p",{className:"text-xs font-bold text-red-700",children:[t.city||"Unknown city"," · ",e.jsx("span",{className:"font-mono",children:t.field})]}
1),e.jsxs("p",{className:"text-xs text-red-500 italic mt-1 break-words",children:["â¦",t.snippet,"â¦"]})]},r))})]}),a.changedRecords&&a.changedRecords.length>0?e.jsxs("div",{className:"bg-white border border-border rounded-lg p-5",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsx(g,{className:"w-5 h-5 text-green-500"}),e.jsx("h3",{className:"font-black uppercase text-sm text-black",style:n,children:"Updated Records"})]}),e.jsx("div",{className:"space-y-2",children:a.changedRecords.map((t,r)=>e.jsxs("div",{className:"flex items-start justify-between gap-3 border-b border-border last:border-0 pb-2 last:pb-0",children:[e.jsx("span",{className:"text-sm font-semibold text-black",children:t.city||"Unknown"}),e.jsx("div",{className:"flex flex-wrap gap-1 justify-end",children:t.fieldsChanged.map(l=>e.jsx("span",{className:"text-xs bg-gray-100 text-gray-700 px-2 py-0.5 rounded font-mono",children:l},l))})]},r))})]}):!((h=a.remainingViolations)!=null&&h.length)&&e.jsxs("div",{className:"bg-green-50 border border-green-200 rounded-lg p-5 flex items-center gap-3",children:[e.jsx(g,{className:"w-5 h-5 text-green-500 shrink-0"}),e.jsx("p",{className:"text-sm text-green-700 font-medium",children:"All service area pages are already clean â no changes needed."})]})]})]})}export{R 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.