PageSourceSearch

https://hugecreative.agency/assets/BriefBuilder-Bmsdo_ut.js

js hugecreative.agency collected 2026-09-24 14:30:12 UTC 5,386 bytes, 1 lines download raw bytes

1import{r,as as u,j as t,L as o,l as C,a6 as i,E as k,a3 as E}from"./index-t4qOy3J0.js";import{B as T}from"./briefPresets-CZETSnJf.js";import{P as L}from"./plus-DYr5ZVVH.js";import{F as c}from"./file-text-KUgCwmhY.js";import{C as B}from"./clock-y5_Y1dAV.js";import{C as F}from"./copy-Cio32X3j.js";import{T as A}from"./trash-2-M2bXKW7N.js";const D=Object.fromEntries(T.map(a=>[a.id,a])),$={draft:"bg-gray-100 text-gray-600",sent:"bg-blue-100 text-blue-700",completed:"bg-green-100 text-green-700"},f={draft:"Draft",sent:"Sent",completed:"Completed"},P={draft:c,sent:B,completed:i};function q(){const[a,d]=r.useState([]),[y,x]=r.useState(!0),[m,j]=r.useState(""),[n,N]=r.useState("all"),[g,h]=r.useState(null);r.useEffect(()=>{w()},[]);async function w(){x(!0);try{const e=await fetch("/briefs.php",{headers:{"X-API-Key":u()}});e.ok&&d(await e.json())}catch{}finally{x(!1)}}async function b(e){confirm("Delete this brief?")&&(await fetch(`/briefs.php?id=${e}`,{method:"DELETE",headers:{"X-API-Key":u()}}),d(s=>s.filter(l=>l.id!==e)))}function v(e){const s=`${window.location.origin}/brief/${e}`;navigator.clipboard.writeText(s),h(e),setTimeout(()=>h(null),2e3)}const p=a.filter(e=>{const s=m.toLowerCase(),l=!s||e.title.toLowerCase().includes(s)||e.clientName.toLowerCase().includes(s),S=n==="all"||e.status===n;return l&&S});return t.jsxs("div",{className:"max-w-5xl",children:[t.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-8",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-2xl font-semibold text-gray-900",children:"Brief Builder"}),t.jsx("p",{className:"text-sm text-gray-500 mt-1",children:"Create and send briefs to clients, collect responses"})]}),t.jsxs(o,{to:"/admin/briefs/new",className:"flex items-center gap-2 px-4 py-2 bg-[#FF3D00] text-white rounded-lg hover:bg-[#e03500] transition-colors text-sm font-medium",children:[t.jsx(L,{className:"w-4 h-4"}),"New Brief"]})]}),t.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mb-6",children:[t.jsxs("div",{className:"relative flex-1",children:[t.jsx(C,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),t.jsx("input",{type:"text",placeholder:"Search by client or title...",value:m,onChange:e=>j(e.target.value),className:"w-full pl-9 pr-4 py-2 border border-gray-200 rounded-lg text-sm focus:outline-none focus:ring-2 focus:ring-[#FF3D00]/20 focus:border-[#FF3D00]"})]}),t.jsx("div",{className:"flex gap-1 p-1 bg-gray-100 rounded-lg text-sm",children:["all","draft","sent","completed"].map(e=>t.jsx("button",{onClick:()=>N(e),className:`px-3 py-1.5 rounded-md transition-colors font-medium ${n===e?"bg-white shadow text-gray-900":"text-gray-600 hover:text-gray-900"}`,children:e==="all"?"All":f[e]},e))})]}),y?t.jsx("div",{className:"text-center py-16 text-gray-400 text-sm",children:"Loading..."}):p.length===0?t.jsxs("div",{className:"text-center py-16 border-2 border-dashed border-gray-200 rounded-xl",children:[t.jsx(c,{className:"w-8 h-8 text-gray-300 mx-auto mb-3"}),t.jsx("p",{className:"text-gray-500 text-sm",children:a.length===0?'No briefs created. Click "New Brief" to get started.':"No results for selected filters."})]}):t.jsx("div",{className:"space-y-2",children:p.map(e=>{const s=D[e.preset],l=P[e.status]??c;return t.jsxs("div",{className:"bg-white border border-gray-200 rounded-xl p-4 flex items-center gap-4 hover:border-gray-300 transition-colors",children:[t.jsx("div",{className:"w-10 h-10 rounded-lg bg-gray-50 border border-gray-200 flex items-center justify-center text-lg flex-shrink-0",children:s?.icon??"📄"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx("p",{className:"font-medium text-gray-900 text-sm truncate",children:e.title}),t.jsxs("span",{className:`inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium ${$[e.status]}`,children:[t.jsx(l,{className:"w-3 h-3"}),f[e.status]]})]}),t.jsxs("p",{className:"text-xs text-gray-500 mt-0.5",children:[e.clientName," · ",s?.name??e.preset," · ",new Date(e.createdAt).toLocaleDateString("en-US")]})]}),t.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.status==="completed"&&t.jsx(o,{to:`/admin/briefs/${e.id}`,className:"p-1.5 text-green-600 hover:bg-green-50 rounded-lg transition-colors",title:"View responses",children:t.jsx(i,{className:"w-4 h-4"})}),t.jsx("button",{onClick:()=>v(e.token),className:`p-1.5 rounded-lg transition-colors ${g===e.token?"text-green-600 bg-green-50":"text-gray-400 hover:text-gray-700 hover:bg-gray-100"}`,title:"Copy client link",children:g===e.token?t.jsx(i,{className:"w-4 h-4"}):t.jsx(F,{className:"w-4 h-4"})}),t.jsx("a",{href:`/brief/${e.token}`,target:"_blank",rel:"noopener noreferrer",className:"p-1.5 text-gray-400 hover:text-gray-700 hover:bg-gray-100 rounded-lg transition-colors",title:"Open client form",children:t.jsx(k,{className:"w-4 h-4"})}),t.jsx(o,{to:`/admin/briefs/${e.id}`,className:"p-1.5 text-gray-400 hover:text-[#FF3D00] hover:bg-orange-50 rounded-lg transition-colors",title:"Edit",children:t.jsx(E,{className:"w-4 h-4"})}),t.jsx("button",{onClick:()=>b(e.id),className:"p-1.5 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded-lg transition-colors",title:"Delete",children:t.jsx(A,{className:"w-4 h-4"})})]})]},e.id)})})]})}export{q as BriefBuilder};

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.