PageSourceSearch

https://indexchecker.ai/assets/SitesPage-DZKc1Y2P.js

js indexchecker.ai collected 2026-10-05 13:47:26 UTC 11,377 bytes, 16 lines download raw bytes

1import{c as q,r as c,j as e,G as L,R as v,A as $,u as G,S as T,q as O,e as Q,d as j,l as V,o as z,m as H,p as E,t as A,b as w,v as b,s as p,x as B}from"./index-BVWG9e6d.js";import{E as Y,C as Z,P as J}from"./plus-BsOPFkD3.js";import{f as K}from"./format-B2FXVs-x.js";/**
2 * @license lucide-react v0.344.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 W=q("MoreVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
7 * @license lucide-react v0.344.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const X=q("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a2.121 2.121 0 1 1 3 3L12 15l-4 1 1-4Z",key:"1lpok0"}]]);/**
12 * @license lucide-react v0.344.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const ee=q("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]),se=({site:s,onDelete:C,onScanNow:S,onRequestReindex:M})=>{const[N,i]=c.useState(!1),[m,u]=c.useState(!1),R=async()=>{i(!1),u(!0),await S(s.id,s.url,s.gscProperty),u(!1)},k=async()=>{if(i(!1),!s.gscProperty){console.warn("Cannot request re-index without gscProperty for site:",s.name);return}u(!0),await M(s.id,s.gscProperty),u(!1)},r=()=>{if(!s.totalPages)return null;const y=Math.round(s.indexedPages/s.totalPages*100);return y>=90?e.jsxs("div",{className:"flex items-center text-green-700",children:[e.jsx(Z,{className:"w-4 h-4 mr-1"}),e.jsx("span",{className:"text-sm font-medium",children:"Good"})]}):y>=70?e.jsxs("div",{className:"flex items-center text-amber-700",children:[e.jsx($,{className:"w-4 h-4 mr-1"}),e.jsx("span",{className:"text-sm font-medium",children:"Needs Attention"})]}):e.jsxs("div",{className:"flex items-center text-red-700",children:[e.jsx($,{className:"w-4 h-4 mr-1"}),e.jsx("span",{className:"text-sm font-medium",children:"Critical"})]})};return e.jsx("div",{className:"p-5 hover:bg-slate-50 transition-colors",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"w-10 h-10 rounded-md bg-blue-100 flex items-center justify-center mr-4",children:e.jsx(L,{className:"w-5 h-5 text-blue-800"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-medium text-slate-900",children:s.name}),e.jsx("div",{className:"flex items-center text-sm text-slate-500",children:e.jsxs("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center hover:text-blue-800",children:[s.url,e.jsx(Y,{className:"w-3 h-3 ml-1"})]})})]})]}),e.jsxs("div",{className:"flex items-center space-x-6",children:[r(),e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"text-lg font-medium text-slate-900",children:[s.indexedPages,"/",s.totalPages||0]}),e.jsx("div",{className:"text-xs text-slate-500",children:"Pages Indexed"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-sm text-slate-700",children:s.lastScan?K(s.lastScan.toDate(),"MMM d, yyyy"):"Never"}),e.jsx("div",{className:"text-xs text-slate-500",children:"Last Scanned"})]}),e.jsxs("div",{className:"relative",children:[e.jsx("button",{onClick:()=>i(!N),className:"w-8 h-8 flex items-center justify-center rounded-full hover:bg-slate-200 disabled:opacity-50",disabled:m,children:m?e.jsx(v,{className:"w-4 h-4 text-slate-500 animate-spin"}):e.jsx(W,{className:"w-4 h-4 text-slate-500"})}),N&&e.jsxs("div",{className:"absolute right-0 mt-1 w-56 bg-white rounded-md shadow-lg py-1 z-10 border border-slate-100",children:[e.jsxs("button",{onClick:R,disabled:m,className:"flex items-center w-full text-left px-4 py-2 text-sm text-slate-700 hover:bg-slate-100 disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(v,{className:"w-4 h-4 mr-2"}),"Check Indexing Status"]}),e.jsxs("button",{onClick:k,disabled:m||!s.gscProperty,title:s.gscProperty?"Request re-indexing for non-indexed pages":"GSC Property (e.g., sc-domain:example.com) must be set for this site to request re-indexing.",className:"flex items-center w-full text-left px-4 py-2 text-sm text-slate-700 hover:bg-slate-100 disabled:opacity-50 disabled:cursor-not-allowed",children:[e.jsx(v,{className:"w-4 h-4 mr-2 text-green-600"}),"Request Re-index Missing"]}),e.jsx("div",{className:"my-1 border-t border-slate-100"}),e.jsxs("button",{disabled:!0,className:"flex items-center w-full text-left px-4 py-2 text-sm text-slate-700 hover:bg-slate-100 opacity-50 cursor-not-allowed",children:[e.jsx(X,{className:"w-4 h-4 mr-2"}),"Edit Site"]}),e.jsxs("button",{onClick:()=>
16{i(!1),C(s.id)},className:"flex items-center w-full text-left px-4 py-2 text-sm text-red-600 hover:bg-red-50",children:[e.jsx(ee,{className:"w-4 h-4 mr-2"}),"Delete Site"]})]})]})]})]})})},te=({onClose:s})=>e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white p-6 rounded-lg shadow-xl max-w-sm w-full",children:[e.jsx("h3",{className:"text-lg font-medium text-slate-900 mb-4",children:"Coming Soon!"}),e.jsx("p",{className:"text-slate-600 mb-6",children:"This feature is currently under development and will be available soon."}),e.jsx("button",{onClick:s,className:"btn-primary w-full",children:"Close"})]})}),ie=()=>{const{currentUser:s}=G(),[C,S]=c.useState([]),[M,N]=c.useState(!0),[i,m]=c.useState(""),[u,R]=c.useState(!1),[k,r]=c.useState(null),[y,h]=c.useState(null),P=async()=>{if(s){N(!0),r(null);try{const t=O(Q(j,"sites"),V("userId","==",s.uid),z("createdAt","desc")),o=(await H(t)).docs.map(f=>({id:f.id,...f.data()}));S(o)}catch(t){console.error("Error fetching sites:",t),r("Error fetching sites: "+t.message)}finally{N(!1)}}};c.useEffect(()=>{P()},[s]);const D=async t=>{if(confirm("Are you sure you want to delete this site? This action cannot be undone."))try{await B(w(j,"sites",t)),S(a=>a.filter(o=>o.id!==t)),h("Site deleted successfully.")}catch(a){console.error("Error deleting site:",a),r("Failed to delete site: "+a.message)}},F=async(t,a,o)=>{if(console.log(`Requesting scan for site: ${t}, URL: ${a}, GSC: ${o}`),r(null),h(null),!s){r("User not authenticated.");return}const f=E(),x=A(f,"get_site_indexing_status"),l=o||a;try{const n=await x({siteUrl:l}),{status:g,message:d}=n.data,U=w(j,"sites",t);await b(U,{lastScan:p(),lastScanStatus:g==="pending"?"processing":g||"queued_with_unknown_status",lastScanMessage:d||"Indexing check initiated."}),h(`Indexing check initiated for ${l}: ${d}`)}catch(n){console.error("Error calling get_site_indexing_status:",n),r(`Error initiating scan for ${l}: ${n.message}`);const g=w(j,"sites",t);try{await b(g,{lastScan:p(),lastScanStatus:"error",lastScanMessage:`Failed to initiate scan: ${n.message}`})}catch(d){console.error("Error updating site document with scan error:",d)}}},I=async(t,a)=>{if(console.log(`Requesting re-index for site: ${t}, GSC: ${a}`),r(null),h(null),!s){r("User not authenticated.");return}if(!a){r("GSC Property is required to request re-indexing.");return}const o=E(),f=A(o,"request_site_reindexing");try{const x=await f({siteUrl:a}),{status:l,message:n,urlsQueued:g}=x.data,d=w(j,"sites",t);l==="pending"?(await b(d,{lastReindexRequestAt:p(),lastReindexStatus:"pending",lastReindexMessage:n||`Re-indexing task for ${g||"several"} URLs initiated.`}),h(`Re-indexing request for ${a} is pending: ${n}`)):l==="no_urls_to_reindex"||l==="no_urls_found"?(await b(d,{lastReindexRequestAt:p(),lastReindexStatus:"no_action_needed",lastReindexMessage:n||"No URLs found requiring re-indexing."}),h(`Re-indexing for ${a}: ${n}`)):(await b(d,{lastReindexRequestAt:p(),lastReindexStatus:"error",lastReindexMessage:`Re-index request failed: ${n||"Unknown reason"}`}),r(`Re-index request for ${a} failed: ${n}`))}catch(x){console.error("Error calling request_site_reindexing:",x),r(`Error initiating re-index for ${a}: ${x.message}`);const l=w(j,"sites",t);try{await b(l,{lastReindexRequestAt:p(),lastReindexStatus:"error",lastReindexMessage:`Failed to initiate re-index: ${x.message}`})}catch(n){console.error("Error updating site document with re-index error:",n)}}},_=C.filter(t=>t.name.toLowerCase().includes(i.toLowerCase())||t.url.toLowerCase().includes(i.toLowerCase()));return e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-col md:flex-row md:justify-between md:items-center mb-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-slate-900 mb-1",children:"Sites"}),e.jsx("p",{className:"text-slate-500",children:"Manage your monitored websites"})]}),e.jsx("div",{className:"mt-4 md:mt-0",children:e.jsxs("button",{onClick:()=>R(!0),className:"btn-primary",children:[e.jsx(J,{className:"w-4 h-4 mr-2"}),"Add Site"]})})]}),e.jsx("div",{className:"mb-6",children:e.jsxs("div",{className:"relative",children:[e.jsx(T,{className:"w-5 h-5 absolute left-3 top-1/2 transform -translate-y-1/2 text-slate-400"}),e.jsx("input",{type:"text",placeholder:"Search sites...",className:"input pl-10 w-full md:w-80",value:i,onChange:t=>m(t.target.value)})]})}),k&&e.jsxs("div",{className:"mb-4 p-3 bg-red-100 text-red-700 border border-red-300 rounded-md text-sm",children:[e.jsx("strong",{children:"Error:"})," ",k]}),y&&e.jsxs("div",{className:"mb-4 p-3 bg-green-100 text-green-700 border border-green-300 rounded-md text-sm",children:[e.jsx("strong",{children:"Success:"})," ",y]}),e.jsxs("div",{className:"card overflow-visible",children:[e.jsxs("div",{className:"p-6 border-b border-slate-100 flex justify-between items-center",children:[e.jsx("h2",{className:"text-lg font-semibold text-slate-900",children:"Your Sites"}),e.jsxs("button",{className:"text-sm text-blue-800 hover:text-blue-900 flex items-center",children:[e.jsx(v,{className:"w-4 h-4 mr-1"}),"Refresh All"]})]}),M?e.jsxs("div",{className:"p-8 text-center",children:[e.jsx(v,{className:"w-8 h-8 text-blue-800 animate-spin mx-auto mb-4"}),e.jsx("p",{children:"Loading your sites..."})]}):_.length>0?e.jsx("div",{className:"divide-y divide-slate-100 relative z-1",children:_.map(t=>e.jsx(se,{site:t,onDelete:D,onScanNow:F,onRequestReindex:I},t.id))}):e.jsxs("div",{className:"p-8 text-center",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 rounded-full bg-slate-100 mb-4",children:e.jsx(L,{className:"w-6 h-6 text-slate-400"})}),i?e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-lg font-medium text-slate-800 mb-2",children:"No sites match your search"}),e.jsx("p",{className:"text-slate-500 mb-4",children:"Try adjusting your search terms"})]}):e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"text-lg font-medium text-slate-800 mb-2",children:"No sites added yet"}),e.jsx("p",{className:"text-slate-500 mb-4",children:"Add your first site to start monitoring indexing"})]})]})]}),u&&e.jsx(te,{onClose:()=>R(!1)})]})};export{ie 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.