PageSourceSearch

https://slickbot.ai/assets/WebsiteManagePage-BgOnlIB-.js

js slickbot.ai collected 2026-10-05 14:28:12 UTC 8,098 bytes, 1 lines download raw bytes

1import{d as E,u as F,b as l,j as e}from"./vendor-query-DPZO-Gta.js";import{b as P,r as d}from"./vendor-react-BomFe3BT.js";import{z as i,x as r}from"./index-BLzMsaFd.js";import"./vendor-charts-DodUWJ0z.js";function q(){const{id:a}=P(),n=E(),[o,g]=d.useState(""),[c,x]=d.useState(""),[h,p]=d.useState(!0),[b,m]=d.useState(!1),{data:t,isLoading:f,error:w}=F({queryKey:["website",a],queryFn:async()=>(await r.get(a)).data,enabled:!!a,retry:!1}),y=l({mutationFn:()=>r.publish(a),onSuccess:()=>{n.invalidateQueries({queryKey:["website",a]}),i.success("Website published!")},onError:()=>i.error("Failed to publish")}),j=l({mutationFn:()=>r.unpublish(a),onSuccess:()=>{n.invalidateQueries({queryKey:["website",a]}),i.success("Website unpublished")},onError:()=>i.error("Failed to unpublish")}),N=l({mutationFn:s=>r.update(a,s),onSuccess:()=>{n.invalidateQueries({queryKey:["website",a]}),i.success("Settings saved"),m(!1)},onError:()=>i.error("Failed to save settings")}),k=l({mutationFn:s=>r.deletePage(a,s),onSuccess:()=>{n.invalidateQueries({queryKey:["website",a]}),i.success("Page deleted")},onError:()=>i.error("Failed to delete page")});if(f)return e.jsx("div",{className:"p-6",children:e.jsxs("div",{className:"animate-pulse space-y-4",children:[e.jsx("div",{className:"h-8 bg-gray-200 rounded w-1/3"}),e.jsx("div",{className:"h-4 bg-gray-200 rounded w-1/2"}),e.jsx("div",{className:"h-32 bg-gray-200 rounded"})]})});if(w||!t||!t.status)return e.jsxs("div",{className:"p-6",children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-2",children:"Website"}),e.jsxs("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-8 text-center",children:[e.jsx("svg",{className:"mx-auto h-12 w-12 text-gray-400",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 21a9.004 9.004 0 008.716-6.747M12 21a9.004 9.004 0 01-8.716-6.747M12 21c2.485 0 4.5-4.03 4.5-9S14.485 3 12 3m0 18c-2.485 0-4.5-4.03-4.5-9S9.515 3 12 3m0 0a8.997 8.997 0 017.843 4.582M12 3a8.997 8.997 0 00-7.843 4.582m15.686 0A11.953 11.953 0 0112 10.5c-2.998 0-5.74-1.1-7.843-2.918m15.686 0A8.959 8.959 0 0121 12c0 .778-.099 1.533-.284 2.253m0 0A17.919 17.919 0 0112 16.5c-3.162 0-6.133-.815-8.716-2.247m0 0A9.015 9.015 0 013 12c0-1.605.42-3.113 1.157-4.418"})}),e.jsx("h3",{className:"mt-4 text-sm font-medium text-gray-900",children:"No website yet"}),e.jsx("p",{className:"mt-1 text-sm text-gray-500",children:'Ask your AI Operator to "build me a website" to get started.'})]})]});const v={draft:"bg-yellow-100 text-yellow-800",published:"bg-green-100 text-green-800",unpublished:"bg-gray-100 text-gray-800"},u=`/site/${t.slug}`,C=()=>{g(t.slug),x(t.primary_color),p(t.widget_enabled),m(!0)},S=()=>{N.mutate({slug:o,primary_color:c,widget_enabled:h})};return e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:t.site_title}),e.jsxs("div",{className:"mt-1 flex items-center space-x-3",children:[e.jsx("span",{className:`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${v[t.status]||v.draft}`,children:(t.status||"draft").charAt(0).toUpperCase()+(t.status||"draft").slice(1)}),e.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-indigo-600 hover:text-indigo-500",children:u}),e.jsx("button",{onClick:()=>{navigator.clipboard.writeText(window.location.origin+u),i.success("URL copied!")},className:"text-sm text-gray-500 hover:text-gray-700",children:"Copy"})]})]}),e.jsx("div",{className:"flex space-x-2",children:t.status==="published"?e.jsx("button",{onClick:()=>j.mutate(),disabled:j.isPending,className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50",children:"Unpublish"}):e.jsx("button",{onClick:()=>y.mutate(),disabled:y.isPending,className:"px-4 py-2 text-sm font-medium text-white bg-indigo-600 rounded-md hover:bg-indigo-700",children:"Publish"})})]}),e.jsxs("div",{className:"bg-white shadow rounded-lg",children:[e.jsx("div",{className:"px-4 py-5 sm:px-6 border-b border-gray-200",children:e.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Pages"})}),e.jsx("ul",{className:"divide-y divide-gray-200",children:t.pages.length===0?e.jsx("li",{className:"px-4 py-8 text-center text-sm text-gray-500",children:"No pages yet. Ask your AI Operator to create some."}):t.pages.map(s=>e.jsxs("li",{className:"px-4 py-4 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("p",{className:"text-sm font-medium text-gray-900",children:[s.title,s.is_homepage&&e.jsx("span",{className:"ml-2 text-xs text-indigo-600",children:"(Homepage)"})]}),e.jsxs("p",{className:"text-sm text-gray-500",children:["/",s.slug]})]}),e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("span",{className:"text-xs text-gray-400",children:new Date(s.updated_at).toLocaleDateString()}),e.jsx("button",{onClick:()=>{confirm("Delete this page?")&&k.mutate(s.id)},className:"text-sm text-red-600 hover:text-red-800",children:"Delete"})]})]},s.id))})]}),e.jsxs("div",{className:"bg-white shadow rounded-lg",children:[e.jsxs("div",{className:"px-4 py-5 sm:px-6 border-b border-gray-200 flex items-center justify-between",children:[e.jsx("h3",{className:"text-lg font-medium text-gray-900",children:"Settings"}),!b&&e.jsx("button",{onClick:C,className:"text-sm text-indigo-600 hover:text-indigo-500",children:"Edit"})]}),e.jsx("div",{className:"px-4 py-5 sm:px-6 space-y-4",children:b?e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Slug"}),e.jsx("input",{type:"text",value:o,onChange:s=>g(s.target.value),className:"mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"}),e.jsxs("p",{className:"mt-1 text-xs text-gray-500",children:["URL: /site/",o]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700",children:"Primary Color"}),e.jsxs("div",{className:"mt-1 flex items-center space-x-2",children:[e.jsx("input",{type:"color",value:c,onChange:s=>x(s.target.value),className:"h-8 w-8 rounded cursor-pointer"}),e.jsx("input",{type:"text",value:c,onChange:s=>x(s.target.value),className:"block w-32 rounded-md border-gray-300 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm"})]})]}),e.jsxs("div",{className:"flex items-center",children:[e.jsx("input",{id:"widget-toggle",type:"checkbox",checked:h,onChange:s=>
1p(s.target.checked),className:"h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500"}),e.jsx("label",{htmlFor:"widget-toggle",className:"ml-2 text-sm text-gray-700",children:"Enable chatbot widget on website"})]}),e.jsxs("div",{className:"flex space-x-2",children:[e.jsx("button",{onClick:S,disabled:N.isPending,className:"px-4 py-2 text-sm font-medium text-white bg-indigo-600 rounded-md hover:bg-indigo-700",children:"Save"}),e.jsx("button",{onClick:()=>m(!1),className:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50",children:"Cancel"})]})]}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500",children:"Slug:"})," ",e.jsx("span",{className:"text-gray-900",children:t.slug})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500",children:"Primary Color:"})," ",e.jsxs("span",{className:"inline-flex items-center space-x-1",children:[e.jsx("span",{className:"inline-block h-4 w-4 rounded",style:{backgroundColor:t.primary_color}}),e.jsx("span",{className:"text-gray-900",children:t.primary_color})]})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-500",children:"Widget:"})," ",e.jsx("span",{className:"text-gray-900",children:t.widget_enabled?"Enabled":"Disabled"})]})]})})})]})]})}export{q 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.