PageSourceSearch

https://www.lajollapropertygroup.com/assets/admin.news.index-Co6VV1tP.js

js lajollapropertygroup.com collected 2026-10-09 22:03:34 UTC 6,134 bytes, 3 lines download raw bytes

1import{r as a,j as t,L as g,s as y}from"./index-Dujz2bhb.js";function k(){const[o,v]=a.useState(null),[d,w]=a.useState("all"),[i,p]=a.useState(!1),[m,c]=a.useState(null),[u,h]=a.useState("");async function b(){let e=y.from("blog_posts").select("id, slug, title, status, source_type, category, published_at, updated_at").order("updated_at",{ascending:!1});d!=="all"&&(e=e.eq("status",d));const{data:s,error:l}=await e;l&&console.error(l),v(s??[])}async function f(e){p(!0),c(e?.length?e.length>1?`Scraping ${e.length} sources and synthesizing a new article…`:`Scraping ${e[0]} and drafting article…`:"Rotating topics, searching publishers, and drafting article…");try{const{data:s}=await y.auth.getSession(),l=s.session?.access_token,x=await fetch("/api/public/draft-news",{method:"POST",headers:{...l?{Authorization:`Bearer ${l}`}:{},"Content-Type":"application/json"},body:e?.length?JSON.stringify({urls:e}):void 0}),j=await x.text();let n=null;try{n=JSON.parse(j)}catch{}if(!x.ok)c(`Error (${x.status}): ${n?.error||j.slice(0,300)||x.statusText}`);else{const S=n?.angles?.length?` · angles: ${n.angles.join(", ")}`:"";c(`Draft created: ${n?.slug??"(unknown slug)"}${S}`),e?.length&&h(""),b()}}catch(s){c(`Error: ${s.message}`)}finally{p(!1)}}const r=u.split(/[\s,]+/).map(e=>e.trim()).filter(e=>/^https?:\/\//i.test(e)).slice(0,6);a.useEffect(()=>{b()},[d]);const N=(o??[]).reduce((e,s)=>(e[s.status]=(e[s.status]||0)+1,e),{});return t.jsxs("div",{className:"max-w-[1400px] mx-auto px-6 lg:px-10 py-10",children:[t.jsxs("div",{className:"flex items-end justify-between mb-8 flex-wrap gap-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-[10px] tracking-[0.22em] text-gold mb-2",children:"NEWSROOM · DRAFTS & PUBLISHED"}),t.jsx("h1",{className:"font-display text-4xl",children:"Posts"}),t.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Review weekly AI-drafted articles, approve & publish, or write your own."})]}),t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx("button",{onClick:()=>f(),disabled:i,className:"border border-gold text-gold px-5 py-3 text-[11px] tracking-[0.22em] font-medium hover:bg-gold/10 disabled:opacity-50",children:i?"DRAFTING…":"DRAFT FROM SOURCES"}),t.jsx(g,{to:"/admin/news/$id",params:{id:"new"},className:"bg-gold text-ink px-5 py-3 text-[11px] tracking-[0.22em] font-medium hover:bg-gold/90",children:"+ NEW POST"})]})]}),t.jsxs("div",{className:"mb-6 border border-border p-4 bg-card/40",children:[t.jsx("p",{className:"text-[10px] tracking-[0.22em] text-muted-foreground mb-2",children:"DRAFT FROM ONE OR MORE URLS"}),t.jsxs("form",{onSubmit:e=>{e.preventDefault(),r.length&&f(r)},className:"flex flex-col gap-2 sm:flex-row sm:items-start",children:[t.jsx("textarea",{value:u,onChange:e=>h(e.target.value),rows:3,placeholder:`https://lajollalight.com/some-story
2https://wsj.com/another-story
3(one URL per line — up to 6)`,className:"flex-1 min-w-0 bg-background border border-border px-3 py-2 text-sm text-cream placeholder:text-muted-foreground/60 focus:outline-none focus:border-gold resize-y",disabled:i}),t.jsx("button",{type:"submit",disabled:i||r.length===0,className:"shrink-0 bg-gold text-ink px-5 py-2 text-[11px] tracking-[0.22em] font-medium hover:bg-gold/90 disabled:opacity-50",children:r.length>1?`SYNTHESIZE ${r.length} URLS`:"DRAFT FROM URL"})]}),t.jsx("p",{className:"text-[11px] text-muted-foreground/70 mt-2",children:"Paste one article per line (La Jolla Light, U-T, WSJ, NYT, Inman, a listing page, a UCSD press release, etc.). With two or more, the draft won't summarize any single piece — it finds the thread between them and builds an original angle, citing each source."})]}),m&&t.jsx("div",{className:`mb-6 text-sm ${m.startsWith("Error")?"text-red-300":"text-gold"}`,children:m}),t.jsx("div",{className:"flex gap-2 mb-6 text-[11px] tracking-[0.22em]",children:["all","draft","published","rejected"].map(e=>t.jsxs("button",{onClick:()=>w(e),className:`px-4 py-2 border ${d===e?"border-gold text-gold":"border-border text-muted-foreground hover:text-cream"}`,children:[e.toUpperCase(),e!=="all"&&N[e]!=null&&t.jsx("span",{className:"ml-2 opacity-60",children:N[e]})]},e))}),o===null?t.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading…"}):o.length===0?t.jsxs("div",{className:"border border-border p-12 text-center text-muted-foreground",children:[t.jsx("p",{className:"mb-4",children:"No posts yet."}),t.jsx(g,{to:"/admin/news/$id",params:{id:"new"},className:"text-gold border-b border-gold/40 hover:border-gold pb-1 text-[11px] tracking-[0.22em]",children:"CREATE YOUR FIRST POST →"})]}):t.jsxs("div",{className:"border border-border",children:[t.jsxs("div",{className:"grid grid-cols-12 gap-4 px-5 py-3 bg-card text-[10px] tracking-[0.22em] text-muted-foreground border-b border-border",children:[t.jsx("div",{className:"col-span-6",children:"TITLE"}),t.jsx("div",{className:"col-span-2",children:"STATUS"}),t.jsx("div",{className:"col-span-2",children:"SOURCE"}),t.jsx("div",{className:"col-span-2 text-right",children:"UPDATED"})]}),o.map(e=>t.jsxs(g,{to:"/admin/news/$id",params:{id:e.id},className:"grid grid-cols-12 gap-4 px-5 py-4 border-b border-border last:border-0 hover:bg-card transition-colors items-center",children:[t.jsxs("div",{className:"col-span-6",children:[t.jsx("div",{className:"text-cream",children:e.title||t.jsx("span",{className:"italic text-muted-foreground",children:"Untitled draft"})}),t.jsxs("div",{className:"text-xs text-muted-foreground mt-0.5",children:["/news/",e.slug]})]}),t.jsx("div",{className:"col-span-2",children:t.jsx("span",{className:`text-[10px] tracking-[0.22em] px-2 py-1 ${e.status==="published"?"bg-gold/20 text-gold":e.status==="rejected"?"bg-red-500/20 text-red-300":"bg-cream/10 text-cream/70"}`,children:e.status.toUpperCase()})}),t.jsx("div",{className:"col-span-2 text-xs text-muted-foreground",children:e.source_type==="auto"?"AI · WEEKLY":"MANUA
3L"}),t.jsx("div",{className:"col-span-2 text-right text-xs text-muted-foreground",children:new Date(e.updated_at).toLocaleDateString()})]},e.id))]})]})}export{k as component};

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.