PageSourceSearch

https://founder-spark-63.lovable.app/assets/Findability-DoXHlGZ9.js

js founder-spark-63.lovable.app collected 2026-10-03 03:32:57 UTC 4,215 bytes, 1 lines download raw bytes

1import{b as w,u as b,j as e}from"./query-_koPiPsI.js";import{r as h}from"./react-vendor-h1rQ_Bae.js";import{W as C,B as g,L as p,R as k,C as l,o as v,p as F,n as o,k as R,H as G,G as I,s as d,g as i}from"./index-Dq2zLArw.js";import{C as S}from"./circle-x-DYzxr_B1.js";import{I as _}from"./info-DI8_flyN.js";import"./ui-radix-CKwvnS8F.js";import"./supabase-DL6nu9mS.js";import"./charts-Xu79y1bN.js";import"./motion-nVmI7L5T.js";const A={pass:e.jsx(G,{className:"w-5 h-5 text-emerald-500"}),warn:e.jsx(I,{className:"w-5 h-5 text-amber-500"}),fail:e.jsx(S,{className:"w-5 h-5 text-rose-500"}),info:e.jsx(_,{className:"w-5 h-5 text-muted-foreground"})};function T(){const y=w(),[n,c]=h.useState(!1),[m,x]=h.useState(null),{data:t}=b({queryKey:["findability-latest"],queryFn:async()=>{const{data:s}=await d.from("findability_snapshots").select("score, checks, ran_at").order("ran_at",{ascending:!1}).limit(1).maybeSingle();return s}}),u=async()=>{c(!0);try{const{data:s,error:a}=await d.functions.invoke("findability-audit",{body:{action:"audit"}});if(a)throw a;y.setQueryData(["findability-latest"],s),i.success("Audit complete")}catch(s){i.error(s?.message||"Audit failed")}finally{c(!1)}},j=async s=>{if(s.fix){x(s.id);try{if(s.fix.action==="connect_gsc"){window.location.href="/profile#gsc";return}const{data:a,error:f}=await d.functions.invoke("findability-audit",{body:{action:s.fix.action,...s.fix.params||{}}});if(f)throw f;if(a?.needs_reconnect){i.error(a.error);return}if(a?.ok===!1){i.error(a.error||"Fix failed");return}i.success(a?.message||"Done — Google usually re-checks within 2–5 days."),u()}catch(a){i.error(a?.message||"Fix failed")}finally{x(null)}}},r=t?.score??null,N=r==null?"text-muted-foreground":r>=80?"text-emerald-500":r>=50?"text-amber-500":"text-rose-500";return e.jsxs("div",{className:"max-w-4xl mx-auto p-4 md:p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4 flex-wrap",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[e.jsx(C,{className:"w-6 h-6"})," Findability"]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"One place to see (and fix) everything that stops Google and AI engines from finding you."})]}),e.jsxs(g,{onClick:u,disabled:n,children:[n?e.jsx(p,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(k,{className:"w-4 h-4 mr-2"}),t?"Re-run audit":"Run audit"]})]}),e.jsxs(l,{className:"glass-effect",children:[e.jsx(v,{className:"pb-2",children:e.jsx(F,{className:"text-sm text-muted-foreground font-normal",children:"Findability Score"})}),e.jsxs(o,{children:[e.jsxs("div",{className:`text-5xl font-bold ${N}`,children:[r??"—",e.jsx("span",{className:"text-xl text-muted-foreground ml-1",children:"/100"})]}),t&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["Last checked ",new Date(t.ran_at).toLocaleString()]}),!t&&!n&&e.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:'Click "Run audit" to check your site.'})]})]}),t&&e.jsx("div",{className:"space-y-3",children:t.checks.map(s=>e.jsx(l,{className:"glass-effect",children:e.jsxs(o,{className:"py-4 flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5",children:A[s.state]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium",children:s.label}),e.jsx("div",{className:"text-sm text-muted-foreground mt-0.5",children:s.detail})]}),s.fix&&e.jsxs(g,{size:"sm",variant:s.state==="fail"?"default":"outline",onClick:()=>j(s),disabled:m===s.id,children:[m===s.id?e.jsx(p,{className:"w-3 h-3 mr-2 animate-spin"}):null,s.fix.label]}),!s.fix&&s.state==="pass"&&e.jsx(R,{variant:"secondary",className:"text-xs",children:"OK"})]})},s.id))}),e.jsx(l,{className:"glass-effect border-dashed",children:e.jsxs(o,{className:"py-4 text-xs text-muted-foreground",children:[e.jsx("strong",{className:"text-foreground",children:"How it works:"})," Each check runs live against your site and Google Search Console. Fix buttons do the technical work for you — submitting sitemaps, asking Google to re-check pages, and auto-adding internal links. Google usually reflects changes within 2–5 days."]})})]})}export{T 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.