PageSourceSearch

https://proscenium.com/assets/ArchieEditor-BwUfFLzZ.js

js proscenium.com collected 2026-10-02 14:58:31 UTC 7,417 bytes, 2 lines download raw bytes

1import{Y as C,r as g,i as I,_ as w,j as e,L as u,I as f,J as k,B as y,s as p,b as x}from"./index-CPwo162I.js";import{T as A}from"./trash-2-BfGCUFWh.js";import{P as q}from"./plus-CW62ioe4.js";const E=["home","our_work","case_study","insights","blog_post","podcast_episode","about","contact","media","newsletter","other"],b=n=>Array.isArray(n)?n.filter(a=>typeof a=="string"):[],_=({value:n,onChange:a,placeholder:h})=>e.jsxs("div",{className:"space-y-2",children:[n.map((l,d)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{value:l,placeholder:h,onChange:o=>a(n.map((m,v)=>v===d?o.target.value:m))}),e.jsx(y,{type:"button",variant:"ghost",size:"sm","aria-label":"Remove",onClick:()=>a(n.filter((o,m)=>m!==d)),children:e.jsx(A,{className:"size-4"})})]},d)),e.jsxs(y,{type:"button",variant:"outline",size:"sm",onClick:()=>a([...n,""]),children:[e.jsx(q,{className:"size-4"})," Add"]})]}),P=()=>{const n=C(),[a,h]=g.useState(null),[l,d]=g.useState([]),{data:o,isLoading:m}=I({queryKey:["admin","archie-copy"],queryFn:async()=>{const[s,r]=await Promise.all([p.from("archie_settings").select("id, placeholder, default_suggestions, nudge_lines, home_intro, system_prompt").limit(1).maybeSingle(),p.from("archie_route_copy").select("id, page_kind, label, invite, suggestions").order("page_kind")]);if(s.error)throw s.error;if(r.error)throw r.error;const c=s.data?{id:s.data.id,placeholder:s.data.placeholder??"",default_suggestions:b(s.data.default_suggestions),nudge_lines:b(s.data.nudge_lines),home_intro:s.data.home_intro??"",system_prompt:s.data.system_prompt??""}:null,t=(r.data??[]).map(i=>({id:i.id,page_kind:i.page_kind,label:i.label??"",invite:i.invite??"",suggestions:b(i.suggestions)}));return{settings:c,routes:t}}});g.useEffect(()=>{o!=null&&o.settings&&h(o.settings),o!=null&&o.routes&&d(o.routes)},[o]);const v=g.useMemo(()=>new Set(l.map(s=>s.page_kind)),[l]),N=E.filter(s=>!v.has(s)),j=w({mutationFn:async()=>{if(!a)throw new Error("Nothing to save yet.");const{id:s,...r}=a,{error:c}=await p.from("archie_settings").update(r).eq("id",s);if(c)throw c;for(const t of l)if(t.id.startsWith("new-")){const{error:i}=await p.from("archie_route_copy").insert({page_kind:t.page_kind,label:t.label,invite:t.invite,suggestions:t.suggestions});if(i)throw i}else{const{error:i}=await p.from("archie_route_copy").update({label:t.label,invite:t.invite,suggestions:t.suggestions}).eq("id",t.id);if(i)throw i}},onSuccess:()=>{n.invalidateQueries({queryKey:["admin","archie-copy"]}),n.invalidateQueries({queryKey:["archie-copy"]}),x.success("Saved")},onError:s=>x.error(s.message)}),S=w({mutationFn:async s=>{if(s.startsWith("new-"))return;const{error:r}=await p.from("archie_route_copy").delete().eq("id",s);if(r)throw r},onSuccess:()=>{x.success("Route removed"),n.invalidateQueries({queryKey:["admin","archie-copy"]}),n.invalidateQueries({queryKey:["archie-copy"]})},onError:s=>x.error(s.message)});return m||!a?e.jsx("div",{className:"p-8 text-sm text-foreground/50",children:"Loading…"}):e.jsxs("div",{className:"p-8 max-w-3xl mx-auto",children:[e.jsxs("header",{className:"mb-6",children:[e.jsx("h1",{className:"text-3xl",style:{fontFamily:"'Libre Baskerville', serif"},children:e.jsx("em",{className:"italic",children:"Archie Copy"})}),e.jsx("p",{className:"text-sm text-foreground/60 mt-1",children:"Edit Archie's prompts, suggestion chips, idle nudges, the home intro paragraph, and the AI persona, all without code."})]}),e.jsxs("div",{className:"space-y-5 rounded-xl border border-border bg-card/40 p-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{children:"Resting pill placeholder"}),e.jsx(f,{value:a.placeholder,onChange:s=>h({...a,placeholder:s.target.value})}),e.jsx("p",{className:"text-xs text-foreground/50",children:"Shown inside the Ask Archie input field."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{children:"Default suggestion chips"}),e.jsx(_,{value:a.default_suggestions,onChange:s=>h({...a,default_suggestions:s}),placeholder:"e.g. Show me a launch I'd remember"}),e.jsx("p",{className:"text-xs text-foreground/50",children:"Used as fallback when a route has no per-page suggestions."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{children:"Idle nudge lines"}),e.jsx(_,{value:a.nudge_lines,onChange:s=>h({...a,nudge_lines:s}),placeholder:"e.g. Psst, Archie here. Need a tour?"}
1),e.jsx("p",{className:"text-xs text-foreground/50",children:"One is shown at random after a few seconds of inactivity."})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{children:"Home intro paragraph"}),e.jsx(k,{className:"min-h-[88px]",value:a.home_intro,onChange:s=>h({...a,home_intro:s.target.value})}),e.jsx("p",{className:"text-xs text-foreground/50",children:`The "Also hi, I'm Archie…" line that appears under the strapline on the homepage.`})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{children:"AI persona / system prompt"}),e.jsx(k,{className:"min-h-[120px] font-mono text-xs",value:a.system_prompt,onChange:s=>h({...a,system_prompt:s.target.value})}),e.jsx("p",{className:"text-xs text-foreground/50",children:"First line of the AI system prompt; it defines Archie's tone. Company facts, sources, and rules are appended automatically by the backend."})]})]}),e.jsxs("div",{className:"mt-6 space-y-4 rounded-xl border border-border bg-card/40 p-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(u,{className:"text-base",children:"Per-route copy"}),e.jsx("p",{className:"text-xs text-foreground/50 mt-1",children:"One row per page kind. Label = the resting pill text. Invite = the bubble line. Suggestions = the tappable chips."})]}),N.length>0&&e.jsxs("select",{className:"h-9 rounded-md border border-border bg-background px-2 text-sm",value:"",onChange:s=>{const r=s.target.value;r&&d([...l,{id:`new-${r}-${performance.now()}`,page_kind:r,label:"",invite:"",suggestions:[]}])},children:[e.jsx("option",{value:"",children:"+ Add route…"}),N.map(s=>e.jsx("option",{value:s,children:s},s))]})]}),l.map((s,r)=>e.jsxs("div",{className:"rounded-lg border border-border bg-background/40 p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-mono uppercase tracking-wider text-foreground/55",children:s.page_kind}),e.jsx(y,{type:"button",variant:"ghost",size:"sm",onClick:()=>{confirm(`Remove the "${s.page_kind}" route copy?`)&&(S.mutate(s.id),d(l.filter((c,t)=>t!==r)))},children:e.jsx(A,{className:"size-4"})})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{children:"Label (resting pill text)"}),e.jsx(f,{value:s.label,onChange:c=>d(l.map((t,i)=>i===r?{...t,label:c.target.value}:t))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{children:"Invite (bubble line)"}),e.jsx(f,{value:s.invite,onChange:c=>d(l.map((t,i)=>i===r?{...t,invite:c.target.value}:t))})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{children:"Suggestion chips"}),e.jsx(_,{value:s.suggestions,onChange:c=>d(l.map((t,i)=>i===r?{...t,suggestions:c}:t)),placeholder:"e.g. What was the challenge?"})]})]},s.id))]}),e.jsx("div",{className:"flex items-center justify-end gap-2 pt-4",children:e.jsx(y,{onClick:()=>j.mutate(),disabled:j.isPending,children:j.isPending?"Saving…":"Save"})})]})};export{P as default};
2//# sourceMappingURL=ArchieEditor-BwUfFLzZ.js.map

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.