PageSourceSearch

https://lecollectif-tv.lovable.app/assets/briefs.index-CByi3QFk.js

js lecollectif-tv.lovable.app collected 2026-10-03 03:36:16 UTC 6,695 bytes, 1 lines download raw bytes

1import{u as v,r as m,s as c,t as h,j as e,L as d,c as f,a as w,l as S}from"./index-r9cUOzRa.js";import{F as B}from"./Footer-CByVw6dE.js";import{E as D,s as E}from"./brief-draft-L97wv-XH.js";import{P as b}from"./plus-DAFVlMlf.js";import{L as j}from"./loader-circle-BJSgGe5S.js";import{P as L}from"./pencil-2U5yyGsy.js";const T={draft:"Draft",submitted:"Submitted",under_review:"Under Review",approved:"Approved",shoot_scheduled:"Shoot Scheduled",assets_delivered:"Assets Delivered",complete:"Complete"},A={draft:"bg-muted text-muted-foreground",submitted:"bg-blue-500/15 text-blue-700 dark:text-blue-300",under_review:"bg-amber-500/15 text-amber-700 dark:text-amber-300",approved:"bg-emerald-500/15 text-emerald-700 dark:text-emerald-300",shoot_scheduled:"bg-indigo-500/15 text-indigo-700 dark:text-indigo-300",assets_delivered:"bg-purple-500/15 text-purple-700 dark:text-purple-300",complete:"bg-green-600/20 text-green-800 dark:text-green-300"};function z(a){try{return new Date(a).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return a}}function Y(){const a=v(),[o,_]=m.useState(!0),[p,N]=m.useState([]),[u,g]=m.useState(null);m.useEffect(()=>{let t=!1;return(async()=>{const{data:s}=await c.auth.getSession(),l=s.session?.user.id;if(!l)return;const{data:x,error:r}=await c.from("briefs").select("id, title, campaign_objective, platforms, status, created_at").eq("user_id",l).order("created_at",{ascending:!1});t||(r&&h.error(r.message),N(x??[]),_(!1))})(),()=>{t=!0}},[]);async function k(t){g(t);try{const{data:s,error:l}=await c.from("briefs").select("title, campaign_objective, target_audience, key_message, campaign_start, campaign_end, platforms, social_insights").eq("id",t).single();if(l||!s)throw new Error(l?.message??"Brief not found");const{data:x}=await c.from("shot_list_items").select("shot_description, order_index").eq("brief_id",t).order("order_index",{ascending:!0}),r={...D,title:s.title??"",campaign_objective:s.campaign_objective??"",target_audience:s.target_audience??[],key_message:s.key_message??"",campaign_start:s.campaign_start??"",campaign_end:s.campaign_end??"",platforms:s.platforms??[],social_insights:s.social_insights??"",shot_list:(x??[]).map(y=>y.shot_description).filter(Boolean)};r.shot_list.length===0&&(r.shot_list=[""]),E(r),await c.from("briefs").delete().eq("id",t).eq("status","draft"),a({to:"/brief/new"})}catch(s){h.error(s?.message??"Failed to load draft")}finally{g(null)}}return e.jsxs("div",{className:"app-scope flex min-h-screen flex-col bg-background",children:[e.jsx(C,{}),e.jsxs("div",{className:"mx-auto w-full max-w-[1400px] flex-1 px-6 py-8 lg:px-10",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-ink-soft",children:"Your work"}),e.jsx("h1",{className:"mt-1 font-display text-3xl font-black tracking-tight text-ink",children:"My Briefs"})]}),e.jsxs(d,{to:"/brief/new",className:"inline-flex items-center gap-2 rounded-full bg-ink px-5 py-2.5 text-sm font-semibold text-paper shadow-pop",children:[e.jsx(b,{className:"size-4"})," Create a brief"]})]}),o?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-ink-soft",children:[e.jsx(j,{className:"size-4 animate-spin"})," Loading…"]}):p.length===0?e.jsxs("div",{className:"mx-auto max-w-xl rounded-2xl border border-dashed border-border bg-card p-10 text-center shadow-card",children:[e.jsx("h3",{className:"font-display text-xl font-bold tracking-tight text-ink",children:"No briefs yet."}),e.jsx("p",{className:"mt-2 text-sm text-ink-soft",children:"Start your first content brief."}),e.jsxs(d,{to:"/brief/new",className:"mt-5 inline-flex items-center gap-2 rounded-full bg-ink px-5 py-2.5 text-sm font-semibold text-paper shadow-pop",children:[e.jsx(b,{className:"size-4"})," Create a brief"]})]}):e.jsx("div",{className:"overflow-x-auto rounded-2xl border border-border bg-card shadow-card",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-secondary/50 text-xs uppercase tracking-wide text-ink-soft",children:e.jsxs("tr",{children:[e.jsx(i,{children:"Brief Title"}),e.jsx(i,{children:"Objective"}),e.jsx(i,{children:"Platforms"}),e.jsx(i,{children:"Status"}),e.jsx(i,{children:"Created"}),e.jsx(i,{className:"text-right",children:"Action"})]})}),e.jsx("tbody",{className:"divide-y divide-border",children:p.map(t=>{const s=t.status==="draft";return e.jsxs("tr",{className:"hover:bg-secondary/30",children:[e.jsx(n,{className:"font-semibold text-ink",children:t.title||"Untitled brief"}),e.jsx(n,{className:"text-ink-soft",children:t.campaign_objective||"—"}),e.jsx(n,{className:"text-ink-soft",children:t.platforms?.length?t.platforms.join(", "):"—"}),e.jsx(n,{children:e.jsx("span",{className:f("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold",A[t.status]??"bg-muted text-muted-foreground"),children:T[t.status]??t.status})}),e.jsx(n,{className:"text-ink-soft",children:z(t.created_at)}),e.jsx(n,{className:"text-right",children:s?e.jsxs("button",{onClick:()=>k(t.id),disabled:u===t.id,className:"inline-flex items-center gap-1.5 rounded-full border border-border bg-background px-3 py-1.5 text-xs font-semibold text-ink hover:bg-secondary disabled:opacity-60",children:[u===t.id?e.jsx(j,{className:"size-3.5 animate-spin"}):e.jsx(L,{className:"size-3.5"}),"Edit Brief"]}):e.jsxs(d,{to:"/briefs/$id",params:{id:t.id},className:"inline-flex items-center gap-1.5 rounded-full bg-ink px-3 py-1.5 text-xs font-semibold text-paper shadow-pop",children:[e.jsx(w,{className:"size-3.5"}),"View Brief"]})})]},t.id)})})]})})]}),e.jsx(B,{dark:!0})]})}function i({children:a,className:o}){return e.jsx("th",{className:f("px-4 py-3 text-left font-semibold",o),children:a})}function n({children:a,className:o}){return e.jsx("td",{className:f("px-4 py-3 align-middle",o),children:a})}function C(){return e.jsx("header",{className:"sticky top-0 z-[100] border-b border-border/60 bg-background/85 backdrop-blur",children:e.jsxs("div",{className:"mx-auto flex h-16 w-full max-w-[1400px] items-center justify-between px-6 lg:px-10",children:[e.jsx(d,{to:"/",className:"flex items-center gap-2",children:e.jsx("img",{src:S.url,alt:"LeCollectif",className:"h-7 w-auto"})}),e.jsxs("nav",{className:"flex items-center gap-1",children:[e.jsx(d,{to:"/app/dashboard",className:"rounded-lg px-3 py-1.5 text-sm font-medium text-ink-soft hover:bg-secondary hover:text-ink",children:"Dashboard"}),e.jsx(d,{to:"/briefs",className:"rounded-lg px-3 py-1.5 text-sm font-medium text-ink hover:bg-secondary",children:"My Briefs"})]})]})})}export{Y 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.