PageSourceSearch

https://ffnews.com/assets/AdminSettings-BeHSdWBb.js

js ffnews.com collected 2026-09-24 17:12:16 UTC 14,412 bytes, 1 lines download raw bytes

1import{bv as ue,r as d,s as x,j as e,aq as ee,ap as me,B as M,bL as ge,q as fe,a3 as he,x as xe,am as be,an as ve,ao as _e,U as je,y as we,a4 as ye,a5 as Ne,a6 as ke,ab as Se,ac as Te,ad as De,ae as Ce}from"./index-d82B7byg.js";import{C as Me}from"./calendar-BeGwL0oL.js";import{T as $e,a as Pe,b as te,c as se}from"./tabs-DSKqbbdZ.js";import{I as ae}from"./input-COfv801s.js";import{g as F}from"./error-message-Cyy_cL3V.js";import{i as Le}from"./search-term-B3jKBWX3.js";import{S as K}from"./SpeakerPreview-CoD8DPro.js";import{C as Re}from"./calendar-Dgrh2qmM.js";import"./endOfMonth-B48jZN9d.js";import"./b2db-headshot-ClBuHSLf.js";const re="ff_speakers_id,b2db_speaker_name,b2db_job_title,b2db_company,slug,redacted,redaction_reason,redacted_at,ff_speakers_storage_url_framed,ff_speakers_linkedin_headshot,ff_speakers_uploaded_headshot",Ee=()=>{const{toast:s}=ue(),[a,o]=d.useState(""),[p,_]=d.useState([]),[k,S]=d.useState(!1),[g,j]=d.useState(null),[$,P]=d.useState(""),[b,L]=d.useState(!1),[R,E]=d.useState([]),[T,B]=d.useState(!0),f=async()=>{B(!0);const{data:r,error:m}=await x.from("ff_speakers").select(re).eq("redacted",!0).order("redacted_at",{ascending:!1}).limit(200);m?s({title:"Could not load redacted speakers",description:F(m),variant:"destructive"}):E(r??[]),B(!1)};d.useEffect(()=>{f()},[]),d.useEffect(()=>{const r=a.trim();if(r.length<2){_([]);return}let m=!1;S(!0);const v=setTimeout(async()=>{const{data:w,error:h}=await x.from("ff_speakers").select(re).ilike("b2db_speaker_name",Le(r)).order("b2db_speaker_name").limit(25);m||(h?(s({title:"Search failed",description:F(h),variant:"destructive"}),_([])):_(w??[]),S(!1))},250);return()=>{m=!0,clearTimeout(v)}},[a]);const A=async(r,m,v)=>{L(!0);const{error:w}=await x.rpc("redact_speaker",{p_speaker_id:r,p_redact:m,p_reason:(v==null?void 0:v.trim())||null});return L(!1),w?(s({title:"Update failed",description:F(w),variant:"destructive"}),!1):(s({title:m?"Speaker redacted":"Redaction removed"}),j(h=>h&&h.ff_speakers_id===r?{...h,redacted:m}:h),_(h=>h.map(O=>O.ff_speakers_id===r?{...O,redacted:m}:O)),await f(),!0)};return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("section",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-serif font-semibold text-foreground",children:"Speaker Redaction"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Search a person, then redact them. Public pages will show a black bar instead of their name and headshot."})]}),e.jsx(ae,{value:a,onChange:r=>o(r.target.value),placeholder:"Search speakers by name…",className:"max-w-md"}),k&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"Searching…"}),!k&&a.trim().length>=2&&p.length===0&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"No speakers found."}),p.length>0&&e.jsx("ul",{className:"max-w-2xl divide-y divide-border rounded-md border border-border",children:p.map(r=>e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>{j(r),P(r.redaction_reason??"")},className:"w-full text-left p-2 hover:bg-accent transition-colors flex items-center justify-between gap-3",children:[e.jsx(K,{speaker:r,siblings:p,size:"md"}),r.redacted&&e.jsx("span",{className:"text-[10px] uppercase tracking-wider text-destructive shrink-0",children:"Redacted"})]})},r.ff_speakers_id))})]}),g&&e.jsxs("section",{className:"max-w-2xl rounded-md border border-border p-4 space-y-4",children:[e.jsx(K,{speaker:g,size:"md"}),e.jsxs("dl",{className:"grid grid-cols-[8rem_1fr] gap-x-4 gap-y-1 text-sm",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Job title"}),e.jsx("dd",{className:"text-foreground",children:g.b2db_job_title||"-"}),e.jsx("dt",{className:"text-muted-foreground",children:"Company"}),e.jsx("dd",{className:"text-foreground",children:g.b2db_company||"-"}),e.jsx("dt",{className:"text-muted-foreground",children:"Profile slug"}),e.jsx("dd",{className:"text-foreground",children:g.slug||"-"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(ee,{htmlFor:"redaction-reason",children:"Reason (optional)"}),e.jsx(ae,{id:"redaction-reason",value:$,onChange:r=>P(r.target.value),placeholder:"e.g. GDPR erasure request received 30 July 2026"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(me,{id:"redact-toggle",checked:!!g.redacted,disabled:b,onCheckedChange:r=>A(g.ff_speakers_id,r,$)}),e.jsx(ee,{htmlFor:"redact-toggle",className:"cursor-pointer",children:g.redacted?"Redacted on public pages":"Redact on public pages"})]})]}),e.jsxs("section",{className:"space-y-3",children:[e.jsxs("h3",{className:"text-sm uppercase tracking-wider text-muted-foreground",children:["Currently redacted (",R.length,")"]}),T?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading…"}):R.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No speakers are redacted."}):e.jsx("ul",{className:"max-w-2xl divide-y divide-border rounded-md border border-border",children:R.map(r=>e.jsxs("li",{className:"flex items-center justify-between gap-3 p-2",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx(K,{speaker:r,size:"md"}),r.redaction_reason&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1 truncate",children:r.redaction_reason})]}),e.jsx(M,{variant:"outline",size:"sm",disabled:b,onClick:()=>A(r.ff_speakers_id,!1),children:"Un-redact"})]},r.ff_speakers_id))})]})]})},C=[{id:"394c83f4-4564-4dc0-8846-95cb0c770155",name:"Lauren Towner"}
1,{id:"30c5e9f0-c93a-486c-9ef4-84486491a66f",name:"Georgia Stubbs"},{id:"e9bbae0e-96fb-41e4-8b6f-ce4f5831312f",name:"Ali Paterson"}],J={w1:{singular:"press release",plural:"press releases",path:(s,a)=>`/admin/press-releases/${a}`},w2:{singular:"thought leadership",plural:"thought leadership",path:(s,a)=>`/admin/thought-leadership/${a}`},w3:{singular:"video",plural:"videos",path:(s,a)=>`/admin/videos/${a}`},"w3.1":{singular:"portrait video",plural:"portrait videos",path:(s,a)=>"/admin/portrait-videos"},w5:{singular:"event",plural:"events",path:(s,a)=>"/admin/event-partnerships"},"w3.1_scheduled":{singular:"portrait scheduled",plural:"portrait scheduled",path:(s,a)=>"/admin/portrait-videos"}};function Ae(s){const a=new Date(s),o=Math.floor(a.getMinutes()/20)*20;return a.setMinutes(o,0,0),a.toISOString()}function ne(s){const a=new Date(s);return`${String(a.getHours()).padStart(2,"0")}:${String(a.getMinutes()).padStart(2,"0")}`}function de(s){const a=new Date(s.getFullYear(),s.getMonth(),s.getDate(),0,0,0,0),o=new Date(a);return o.setDate(o.getDate()+1),{start:a,end:o}}function Oe(s){return`${s.getFullYear()}-${String(s.getMonth()+1).padStart(2,"0")}-${String(s.getDate()).padStart(2,"0")}`}function ze(s){const a=/^(\d{4})-(\d{2})-(\d{2})$/.exec(s);if(!a)return null;const o=new Date(Number(a[1]),Number(a[2])-1,Number(a[3]));return isNaN(o.getTime())?null:o}function oe(s){return new Date(s.getFullYear(),s.getMonth(),s.getDate(),0,0,0,0)}const Q=new Date(2026,2,16),Qe=()=>{var V,X;const[s,a]=ge(),o=d.useMemo(()=>oe(new Date),[]),p=d.useMemo(()=>{const t=s.get("date"),n=t?ze(t):null;return!n||n.getTime()>o.getTime()?o:oe(n)},[s,o]),_=p.getTime()===o.getTime(),k=p.getTime()<Q.getTime(),S=p.getTime()>Q.getTime(),g=!_,j=t=>{const n=t.getTime()>o.getTime()?o:t,i=new URLSearchParams(s);n.getTime()===o.getTime()?i.delete("date"):i.set("date",Oe(n)),a(i,{replace:!1})},$=()=>{if(S){const t=new Date(p);t.setDate(t.getDate()-1),j(t)}},P=()=>{if(g){const t=new Date(p);t.setDate(t.getDate()+1),j(t)}},[b,L]=d.useState([]),[R,E]=d.useState(!0),[T,B]=d.useState(!1),[f,A]=d.useState(null),[r,m]=d.useState(!1);d.useEffect(()=>{if(k){L([]),E(!1);return}let t=!1;return E(!0),(async()=>{const{start:n,end:i}=de(p),l=C.map(Y=>Y.id),u=n.toISOString(),c=i.toISOString(),[G,z,q,H,U,y]=await Promise.all([x.from("w1_press_releases").select("id,title,slug,approved_at,approved_by").in("approved_by",l).gte("approved_at",u).lt("approved_at",c),x.from("w2_thought_leadership").select("id,title,slug,approved_at,approved_by").in("approved_by",l).gte("approved_at",u).lt("approved_at",c),x.from("w3_videos").select("id,title,slug,approved_at,approved_by").in("approved_by",l).gte("approved_at",u).lt("approved_at",c),x.from("w3.1_portrait_videos").select("id,title,slug,approved_at,approved_by").in("approved_by",l).gte("approved_at",u).lt("approved_at",c),x.from("w3.1_portrait_videos").select("id,title,slug,scheduled_confirmed_at,scheduled_by").in("scheduled_by",l).gte("scheduled_confirmed_at",u).lt("scheduled_confirmed_at",c),x.from("w5_events").select("id,title,slug,approved_at,approved_by").in("approved_by",l).gte("approved_at",u).lt("approved_at",c)]),I=[],D=(Y,pe,W,Z)=>{(Y||[]).forEach(N=>{!N[W]||!N[Z]||I.push({kind:pe,id:N.id,title:N.title??"(untitled)",slug:N.slug??null,ts:N[W],person:N[Z]})})};D(G.data,"w1","approved_at","approved_by"),D(z.data,"w2","approved_at","approved_by"),D(q.data,"w3","approved_at","approved_by"),D(H.data,"w3.1","approved_at","approved_by"),D(U.data,"w3.1_scheduled","scheduled_confirmed_at","scheduled_by"),D(y.data,"w5","approved_at","approved_by"),t||(L(I),E(!1))})(),()=>{t=!0}},[p.getTime(),k]);const v=d.useMemo(()=>{const t=new Map;for(const n of C)t.set(n.id,new Map);for(const n of b){const i=Ae(n.ts),l=t.get(n.person);if(!l)continue;const u=l.get(i)??[];u.push(n),l.set(i,u)}return t},[b]),w=d.useMemo(()=>{const t=new Map;for(const n of b)t.set(n.person,(t.get(n.person)??0)+1);return t},[b]),{start:h}=d.useMemo(()=>de(p),[p]),O=d.useMemo(()=>{const t=T?0:6,n=T?24:19,i=[];for(let l=t;l<n;l++)for(let u=0;u<60;u+=20){const c=new Date(h);c.setHours(l,u,0,0),i.push(c.toISOString())}return i},[T,h.getTime()]),ie=f?((V=v.get(f.person))==null?void 0:V.get(f.bucket))??[]:[];d.useEffect(()=>{const t=n=>{const i=n.target;i&&(i.tagName==="INPUT"||i.tagName==="TEXTAREA"||i.isContentEditable)||r||f||(n.key==="ArrowLeft"?(n.preventDefault(),$()):n.key==="ArrowRight"&&(n.preventDefault(),P()))};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[p.getTime(),r,f,S,g]);const le=fe(p,"EEEE d MMMM yyyy"),ce=b.length;return e.jsx(he,{delayDuration:100,children:e.jsxs("div",{className:"p-6 space-y-6",children:[e.jsxs($e,{defaultValue:"team",className:"space-y-6",children:[e.jsxs(Pe,{children:[e.jsx(te,{value:"team",children:"Team"}),e.jsx(te,{value:"gdpr",children:"GDPR"})]}),e.jsxs(se,{value:"team",className:"space-y-6 mt-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(M,{variant:"outline",size:"icon",onClick:$,disabled:!S,"aria-label":"Previous day",children:e.jsx(xe,{className:"h-4 w-4"})}),e.jsxs(be,{open:r,onOpenChange:m,children:[e.jsx(ve,{asChild:!0,children:e.jsxs(M,{variant:"ghost",className:"text-xl font-serif gap-2",children:[e.jsx(Re,{className:"h-4 w-4 opacity-60"}),le]})}),e.jsx(_e,{className:"w-auto p-0",align:"center",children:e.jsx(Me,{mode:"single",selected:p,onSelect:t=>{t&&(j(t),m(!1))},disabled:t=>t.getTime()>o.getTime()||t.getTime()<Q.getTime(),initialFocus:!0,className:je("p-3 pointer-events-auto")})})]}),e.jsx(M,{variant:"outline",size:"icon",onClick:P,disabled:!g,"aria-label":"Next day",children:e.jsx(we,{className:"h-4 w-4"})}),!_&&e.jsx(M,{variant:"outline",size:"sm",onClick:()=>j(o),children:"Today"})]}),e.jsx(M,{variant:"outline",size:"sm",onClick:()=>B(t=>
1!t),children:T?"Show 06:00–19:00":"Show full 24h"})]}),k?e.jsx("div",{className:"border border-border rounded-md p-8 text-center text-sm text-muted-foreground max-w-3xl",children:"Activity tracking began on 16 March 2026."}):R?e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading…"}):ce===0?e.jsx("div",{className:"border border-border rounded-md p-8 text-center text-sm text-muted-foreground max-w-3xl",children:"No recorded activity on this day."}):e.jsx("div",{className:"border border-border rounded-md overflow-hidden max-w-3xl",children:e.jsxs("div",{className:"grid",style:{gridTemplateColumns:`72px repeat(${C.length}, 1fr)`},children:[e.jsx("div",{className:"bg-muted/40 border-b border-border p-2 text-xs text-muted-foreground",children:"Time"}),C.map(t=>e.jsxs("div",{className:"bg-muted/40 border-b border-l border-border p-2 text-sm font-medium",children:[e.jsx("div",{children:t.name}),e.jsxs("div",{className:"text-xs text-muted-foreground font-normal",children:[w.get(t.id)??0," action",(w.get(t.id)??0)===1?"":"s"]})]},t.id)),O.map(t=>{const i=new Date(t).getMinutes()===0;return e.jsxs("div",{className:"contents",children:[e.jsx("div",{className:`px-2 py-1 text-xs border-t border-border ${i?"text-foreground font-medium":"text-muted-foreground"}`,children:ne(t)}),C.map(l=>{var U;const u=((U=v.get(l.id))==null?void 0:U.get(t))??[],c=u.length,G=c===0?"bg-transparent":c<=2?"bg-primary/25":c<=6?"bg-primary/55":"bg-primary/85",z=new Map;for(const y of u)z.set(y.kind,(z.get(y.kind)??0)+1);const q=Array.from(z.entries()).map(([y,I])=>`${I} ${I===1?J[y].singular:J[y].plural}`).join(", "),H=e.jsx("button",{type:"button",disabled:c===0,onClick:()=>A({person:l.id,bucket:t}),className:`w-full h-6 border-t border-l border-border ${G} ${c>0?"hover:ring-1 hover:ring-primary cursor-pointer":"cursor-default"}`,"aria-label":c===0?"No activity":`${c} actions: ${q}`});return e.jsx("div",{children:c===0?H:e.jsxs(ye,{children:[e.jsx(Ne,{asChild:!0,children:H}),e.jsx(ke,{side:"top",children:e.jsxs("div",{className:"text-xs",children:[q," approved"]})})]})},l.id)})]},t)})]})})]}),e.jsx(se,{value:"gdpr",className:"mt-0",children:e.jsx(Ee,{})})]}),e.jsx(Se,{open:!!f,onOpenChange:t=>!t&&A(null),children:e.jsxs(Te,{children:[e.jsx(De,{children:e.jsx(Ce,{children:f?`${(X=C.find(t=>t.id===f.person))==null?void 0:X.name} - ${ne(f.bucket)}`:""})}),e.jsx("ul",{className:"space-y-2 max-h-[60vh] overflow-y-auto",children:ie.slice().sort((t,n)=>t.ts.localeCompare(n.ts)).map((t,n)=>e.jsxs("li",{className:"text-sm",children:[e.jsx("span",{className:"text-xs uppercase tracking-wider text-muted-foreground mr-2",children:t.kind}),e.jsx("a",{href:J[t.kind].path(t.slug??"",t.id),target:"_blank",rel:"noreferrer",className:"underline hover:text-primary",children:t.title}),e.jsx("span",{className:"text-xs text-muted-foreground ml-2",children:new Date(t.ts).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})})]},`${t.kind}-${t.id}-${n}`))})]})})]})})};export{Qe as default};

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.