PageSourceSearch

https://lecollectif.tv/assets/admin.index-DROec-iV.js

js lecollectif.tv collected 2026-09-30 06:38:15 UTC 15,303 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/jspdf.es.min-B65BKQZ0.js","assets/index-r9cUOzRa.js"])))=>i.map(i=>d[i]);
2import{g as J,u as X,r as f,t as N,j as e,l as q,L as O,c as b,_ as Q}from"./index-r9cUOzRa.js";import{u as C}from"./useServerFn-CEXf98D0.js";import{c as Y,g as Z,u as ee,a as te}from"./admin.functions-vfRDAJoD.js";import{F as se}from"./Footer-CByVw6dE.js";import{X as ae}from"./x-jYWOFlDa.js";import{L as re}from"./loader-circle-BJSgGe5S.js";import{C as ne}from"./chevron-right-CjDw_mAA.js";import"./auth-middleware-B62DB3Zb.js";const ie=["submitted","under_review","approved","shoot_scheduled","assets_delivered","complete"],E={draft:"Draft",submitted:"Submitted",under_review:"Under Review",approved:"Approved",shoot_scheduled:"Shoot Scheduled",assets_delivered:"Assets Delivered",complete:"Complete"},le={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 y(r){if(!r)return"—";try{return new Date(r).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return r}}function be(){J();const r=X();C(Y);const i=C(Z),l=C(ee),n=C(te),[w,_]=f.useState(!0),[T,U]=f.useState([]),[v,L]=f.useState([]),[F,A]=f.useState(null),[a,P]=f.useState(null),[R,$]=f.useState(!1);f.useEffect(()=>{let s=!1;return(async()=>{try{const t=await i();if(s)return;U(t.accounts),L(t.briefs)}catch(t){N.error(t?.message??"Failed to load admin data")}finally{s||_(!1)}})(),()=>{s=!0}},[i]);const I=f.useMemo(()=>{const s=[...v].sort((g,u)=>new Date(g.created_at).getTime()-new Date(u.created_at).getTime()),t=new Map;return s.forEach((g,u)=>{t.set(g.id,`#${String(u+1).padStart(3,"0")}`)}),t},[v]);async function W(s,t){const g=v;L(u=>u.map(m=>m.id===s?{...m,status:t}:m));try{await l({data:{briefId:s,status:t}}),N.success("Status updated")}catch(u){L(g),N.error(u?.message??"Failed to update status")}}async function K(s){A(s),P(null),$(!0);try{const t=await n({data:{briefId:s}});P({...t.brief,shot_list:t.shot_list,property_name:t.property_name})}catch(t){N.error(t?.message??"Failed to load brief"),A(null)}finally{$(!1)}}function B(){A(null),P(null)}async function H(){if(a)try{const{jsPDF:s}=await Q(async()=>{const{jsPDF:x}=await import("./jspdf.es.min-B65BKQZ0.js").then(S=>S.j);return{jsPDF:x}},__vite__mapDeps([0,1])),t=new s({unit:"pt",format:"a4"}),g=t.internal.pageSize.getWidth(),u=t.internal.pageSize.getHeight(),m=48,D=g-m*2;let d=m;const k=x=>{d+x>u-m&&(t.addPage(),d=m)},h=x=>{k(22),t.setFont("helvetica","bold"),t.setFontSize(11),t.setTextColor(90),t.text(x.toUpperCase(),m,d),d+=14,t.setTextColor(20)},p=x=>{t.setFont("helvetica","normal"),t.setFontSize(11);const S=t.splitTextToSize(x||"—",D);for(const z of S)k(15),t.text(z,m,d),d+=15;d+=6};t.setFont("helvetica","bold"),t.setFontSize(20);const V=t.splitTextToSize(a.title,D);for(const x of V)k(24),t.text(x,m,d),d+=24;t.setFont("helvetica","normal"),t.setFontSize(10),t.setTextColor(120),t.text(a.property_name,m,d),d+=20,t.setTextColor(20),h("Campaign Objective"),p(a.campaign_objective),h("Target Audience"),p(a.target_audience.join(", ")),h("Key Message"),p(a.key_message),h("Campaign Period"),p(`${y(a.campaign_start)} — ${y(a.campaign_end)}`),h("Platforms"),p(a.platforms.join(", ")),h("Key Insights"),p(a.social_insights),h("Shot List"),a.shot_list.length===0?p("—"):(t.setFont("helvetica","normal"),t.setFontSize(11),a.shot_list.forEach((x,S)=>{const z=t.splitTextToSize(`${S+1}. ${x}`,D);for(const G of z)k(15),t.text(G,m,d),d+=15}),d+=6),h("UTM Tracking Link"),p(a.utm_code);const M=x=>(x||"brief").toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");t.save(`${M(a.property_name)}
2-${M(a.title)}.pdf`)}catch(s){N.error(s?.message??"Failed to export PDF")}}return e.jsxs("div",{className:"admin-scope flex min-h-screen flex-col bg-background",children:[e.jsx("header",{className:"sticky top-0 z-50 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.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("img",{src:q.url,alt:"Le Collectif",className:"h-7 w-auto"}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Admin"})]}),e.jsxs("nav",{className:"flex items-center gap-5 text-sm",children:[e.jsx(O,{to:"/admin",className:"text-muted-foreground hover:text-foreground",activeOptions:{exact:!0},activeProps:{className:"text-foreground font-medium"},children:"Overview"}),e.jsx(O,{to:"/admin/metrics",className:"text-muted-foreground hover:text-foreground",activeProps:{className:"text-foreground font-medium"},children:"Metrics"})]})]})}),e.jsxs("main",{className:"mx-auto w-full max-w-[1400px] flex-1 px-6 py-8 lg:px-10",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:"Le Collectif Admin"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Internal overview of all accounts and briefs."})]}),w?e.jsx(de,{}):e.jsxs("div",{className:"space-y-10",children:[e.jsxs("section",{children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Accounts"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[T.length," total"]})]}),e.jsx("div",{className:"overflow-x-auto rounded-xl border border-border bg-card",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-muted/40 text-xs uppercase tracking-wide text-muted-foreground",children:e.jsxs("tr",{children:[e.jsx(o,{children:"Property"}),e.jsx(o,{children:"Contact Email"}),e.jsx(o,{children:"Type"}),e.jsx(o,{children:"Location"}),e.jsx(o,{className:"text-right",children:"Rooms"}),e.jsx(o,{children:"Tier"}),e.jsx(o,{children:"Joined"}),e.jsx(o,{className:"w-10","aria-label":"Open"})]})}),e.jsx("tbody",{className:"divide-y divide-border",children:T.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:8,className:"px-4 py-6 text-center text-muted-foreground",children:"No accounts yet."})}):T.map(s=>e.jsx(ce,{account:s,navigate:r},s.id))})]})})]}),e.jsxs("section",{children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Submitted Briefs"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[v.length," total"]})]}),e.jsx("div",{className:"overflow-x-auto rounded-xl border border-border bg-card",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-muted/40 text-xs uppercase tracking-wide text-muted-foreground",children:e.jsxs("tr",{children:[e.jsx(o,{children:"Property"}),e.jsx(o,{children:"Brief Title"}),e.jsx(o,{children:"Objective"}),e.jsx(o,{children:"Platforms"}),e.jsx(o,{children:"Status"}),e.jsx(o,{children:"Submitted"})]})}),e.jsx("tbody",{className:"divide-y divide-border",children:v.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-4 py-6 text-center text-muted-foreground",children:"No briefs submitted yet."})}):v.map(s=>e.jsxs("tr",{className:"cursor-pointer transition-colors hover:bg-muted/60",onClick:()=>K(s.id),children:[e.jsx(c,{className:"font-medium",children:s.property_name}),e.jsxs(c,{children:[e.jsx("span",{className:"mr-2 font-mono text-xs text-muted-foreground",children:I.get(s.id)??""}),s.title]}),e.jsx(c,{className:"text-muted-foreground",children:s.campaign_objective}),e.jsx(c,{className:"text-muted-foreground",children:s.platforms.length?s.platforms.join(", "):"—"}),e.jsx(c,{onClick:t=>t.stopPropagation(),children:e.jsx(oe,{value:s.status,onChange:t=>W(s.id,t)})}),e.jsx(c,{className:"text-muted-foreground",children:y(s.created_at)})]},s.id))})]})})]})]})]}),F?e.jsx("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/50 p-4",onClick:B,children:e.jsxs("div",{className:"max-h-[90vh] w-full max-w-2xl overflow-y-auto rounded-2xl bg-card p-6 shadow-2xl",onClick:s=>s.stopPropagation(),children:[e.jsxs("div",{className:"mb-4 flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("h3",{className:"text-xl font-semibold tracking-tight",children:[F?e.jsx("span",{className:"mr-2 font-mono text-sm text-muted-foreground",children:I.get(F)??""}):null,a?.title??(R?"Loading…":"Brief")]}),a?e.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:a.property_name}):null]}),e.jsx("button",{onClick:B,className:"rounded-md p-1 text-muted-foreground hover:bg-muted","aria-label":"Close",children:e.jsx(ae,{className:"size-4"})})]}),R||!a?e.jsxs("div",{className:"flex items-center gap-2 py-10 text-sm text-muted-foreground",children:[e.jsx(re,{className:"size-4 animate-spin"})," Loading brief…"]}):e.jsxs("div",{className:"space-y-5 text-sm",children:[e.jsx(j,{label:"Campaign Objective",value:a.campaign_objective||"—"}),e.jsx(j,{label:"Target Audience",value:a.target_audience.join(", ")||"—"}),e.jsx(j,{label:"Key Message",value:a.key_message||"—"}),e.jsx(j,{label:"Campaign Period",value:`${y(a.campaign_start)} — ${y(a.campaign_end)}`}),e.jsx(j,{label:"Platforms",value:a.platforms.join(", ")||"—"}),e.jsx(j,{label:"Key Insights",value:a.social_insights||"—"}),e.jsx(j,{label:"Current Status",value:E[a.status]??a.status}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Shot List"}),a.shot_list.length===0?e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"—"}):e.jsx("ol",{className:"mt-1.5 list-inside list-decimal space-y-1 text-sm",children:a.shot_list.map((s,t)=>e.jsx("li",{children:s},t))})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"UTM Tracking Link"}),e.jsx("p",{className:"mt-1 break-all rounded-md bg-muted/40 px-2 py-1.5 font-mono text-xs",children:a.utm_code||"—"})]})]}),e.jsxs("div",{className:"mt-6 flex justify-end gap-2",children:[e.jsx("button",{onClick:B,className:"rounded-full px-4 py-2 text-sm font-medium text-muted-foreground hover:bg-muted",children:"Close"}),e.jsx("button",{onClick:H,disabled:!a,className:"inline-flex items-center gap-2 rounded-full bg-ink px-5 py-2 text-sm font-semibold text-paper shadow-pop disabled:opacity-60",children:"Download as PDF"})]})]})}):null,e.jsx(se,{})]})}function de(){const r=["w-32","w-40","w-20","w-24","w-12","w-16","w-20","w-6"],i=["w-32","w-48","w-28","w-24","w-20","w-20"];return e.jsxs("div",{className:"space-y-10","aria-busy":"true","aria-label":"Loading admin overview",children:[e.jsxs("section",{children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("div",{className:"h-5 w-32 animate-pulse rounded bg-muted-foreground
2/20"}),e.jsx("div",{className:"h-4 w-16 animate-pulse rounded bg-muted-foreground/20"})]}),e.jsx("div",{className:"overflow-x-auto rounded-xl border border-border bg-card",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-muted/40",children:e.jsx("tr",{children:r.map((l,n)=>e.jsx("th",{className:"px-4 py-3 text-left",children:e.jsx("div",{className:b("h-3 animate-pulse rounded bg-muted-foreground/20",l)})},n))})}),e.jsx("tbody",{className:"divide-y divide-border",children:Array.from({length:5}).map((l,n)=>e.jsx("tr",{children:r.map((w,_)=>e.jsx("td",{className:"px-4 py-3",children:e.jsx("div",{className:b("h-3 animate-pulse rounded bg-muted-foreground/20",w)})},_))},n))})]})})]}),e.jsxs("section",{children:[e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("div",{className:"h-5 w-40 animate-pulse rounded bg-muted-foreground/20"}),e.jsx("div",{className:"h-4 w-16 animate-pulse rounded bg-muted-foreground/20"})]}),e.jsx("div",{className:"overflow-x-auto rounded-xl border border-border bg-card",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{className:"bg-muted/40",children:e.jsx("tr",{children:i.map((l,n)=>e.jsx("th",{className:"px-4 py-3 text-left",children:e.jsx("div",{className:b("h-3 animate-pulse rounded bg-muted-foreground/20",l)})},n))})}),e.jsx("tbody",{className:"divide-y divide-border",children:Array.from({length:5}).map((l,n)=>e.jsx("tr",{children:i.map((w,_)=>e.jsx("td",{className:"px-4 py-3",children:e.jsx("div",{className:b("h-3 animate-pulse rounded bg-muted-foreground/20",w)})},_))},n))})]})})]})]})}function o({children:r,className:i}){return e.jsx("th",{className:b("px-4 py-3 text-left font-semibold",i),children:r})}function c({children:r,className:i,onClick:l}){return e.jsx("td",{className:b("px-4 py-3 align-middle",i),onClick:l,children:r})}function j({label:r,value:i}){return e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:r}),e.jsx("p",{className:"mt-1 whitespace-pre-wrap text-sm text-foreground",children:i})]})}function oe({value:r,onChange:i}){const l=le[r]??"bg-muted text-muted-foreground";return e.jsxs("div",{className:b("relative inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium",l),children:[e.jsx("span",{className:"pr-4",children:E[r]??r}),e.jsx("svg",{className:"pointer-events-none absolute right-1 h-3 w-3 opacity-60",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.06l3.71-3.83a.75.75 0 111.08 1.04l-4.25 4.39a.75.75 0 01-1.08 0L5.21 8.27a.75.75 0 01.02-1.06z",clipRule:"evenodd"})}),e.jsx("select",{"aria-label":"Update status",value:r,onChange:n=>i(n.target.value),className:"absolute inset-0 h-full w-full cursor-pointer opacity-0",children:ie.map(n=>e.jsx("option",{value:n,children:E[n]},n))})]})}function ce({account:r,navigate:i}){function l(){if(!r.user_id){N.error("This account has no linked user_id — cannot open detail page.");return}i({to:"/admin/clients/$userId",params:{userId:r.user_id}})}return e.jsxs("tr",{role:"button",tabIndex:0,className:"cursor-pointer transition-colors hover:bg-muted/60 focus:bg-muted/60 focus:outline-none",onClick:l,onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),l())},children:[e.jsx(c,{className:"font-medium",children:r.property_name}),e.jsx(c,{className:"text-muted-foreground",children:r.contact_email}),e.jsx(c,{children:r.property_type}),e.jsx(c,{children:r.location}),e.jsx(c,{className:"text-right",children:r.room_count??"—"}),e.jsx(c,{children:e.jsx("span",{className:"inline-flex items-center rounded-full bg-brand/10 px-2 py-0.5 text-xs font-medium text-brand",children:r.tier})}),e.jsx(c,{className:"text-muted-foreground",children:y(r.created_at)}),e.jsx(c,{className:"w-10 text-right",children:e.jsx(ne,{className:"inline-block h-4 w-4 text-muted-foreground/60","aria-hidden":"true"})})]})}export{be 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.