PageSourceSearch

https://younghollywood.com/assets/admin.talent-B7Vcqyty.js

js younghollywood.com collected 2026-09-24 21:07:06 UTC 15,588 bytes, 1 lines download raw bytes

1import{Q as E,U as R,X as q,r as d,Y as D,j as e}from"./index-BZbnK03S.js";import{supabase as c}from"./client-DrdvKyjq.js";import{t as i}from"./index-N4zCLFOf.js";import{M as N,f as g}from"./MediaUploader-C43mfj4I.js";import{S as P}from"./SortableRows-CnUun_S6.js";import"./tslib.es6-eMSY344_.js";const B=E({method:"POST"}).middleware([R]).handler(q("06236115fd696cbcfdd3d14871281cbf1ec659fa7975ed25e08f9fab62fe32ad")),F=["actor","musician","athlete","influencer","creator"],m={id:null,name:"",slug:"",role_type:"actor",photo_url:"",hero_image_url:"",bio:"",meta_title:"",meta_description:"",birth_date:null,birth_place:"",known_for:"",ai_priority_until:null,social_handles:{instagram:"",tiktok:"",twitter:"",youtube:""},is_featured:!1,is_trending:!1,is_evergreen:!1,needs_review:!1,trending_order:null,featured_video_slug:""};function z(o){return o.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function U(){const[o,x]=d.useState([]),[a,r]=d.useState(null),[b,f]=d.useState(!1),[u,w]=d.useState(""),k=D(B);async function C(){if(!a?.name?.trim()){i.error("Enter a name first.");return}if(!(a.bio?.trim()&&!confirm("Replace the existing bio with an AI-generated one?"))){f(!0);try{const{bio:t}=await k({data:{name:a.name.trim(),role:a.role_type??null,hint:a.bio??null}});r(l=>l&&{...l,bio:t}),i.success("Bio generated — review before saving.")}catch(t){i.error(t?.message??"Failed to generate bio")}finally{f(!1)}}}async function h(){const{data:t}=await c.from("talent").select("*").order("name");x(t??[])}d.useEffect(()=>{h()},[]);async function S(){if(!a)return;const t={...a,slug:a.slug||z(a.name)},l=!t.id;l&&delete t.id;const s=l?c.from("talent").insert(t):c.from("talent").update(t).eq("id",t.id),{error:v}=await s;if(v){i.error(g(v),{duration:8e3});return}i.success("Saved"),r(null),h()}async function _(t){if(!confirm("Delete this talent profile? This cannot be undone."))return;const{error:l}=await c.from("talent").delete().eq("id",t);if(l){i.error(g(l),{duration:8e3});return}i.success("Deleted"),h()}const j=o.filter(t=>!u||t.name.toLowerCase().includes(u.toLowerCase())||t.slug.includes(u.toLowerCase())),y=d.useMemo(()=>o.filter(t=>t.is_trending).sort((t,l)=>(t.trending_order??999)-(l.trending_order??999)),[o]),p=d.useMemo(()=>o.filter(t=>t.needs_review),[o]);async function T(t){const{error:l}=await c.from("talent").update({is_evergreen:!0}).eq("id",t);if(l){i.error(g(l),{duration:8e3});return}i.success("Promoted to Evergreen"),h()}return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[e.jsx("h1",{className:"yh-headline text-4xl",children:"Talent"}),e.jsx("button",{onClick:()=>r({...m}),className:"bg-cobalt text-cobalt-foreground px-4 py-2 yh-eyebrow",children:"+ New talent"})]}),y.length>0&&e.jsxs("div",{className:"mt-6 border border-border p-4",children:[e.jsx("h2",{className:"yh-eyebrow text-sm",children:"Trending talent — drag to reorder"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:'Controls the order on the homepage "Trending" rail.'}),e.jsx("div",{className:"mt-3",children:e.jsx(P,{items:y,table:"talent",orderField:"trending_order",renderRow:t=>e.jsxs("div",{className:"flex items-center gap-3",children:[t.photo_url&&e.jsx("img",{src:t.photo_url,alt:"",className:"w-8 h-8 rounded-full object-cover shrink-0",loading:"lazy",decoding:"async"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium truncate",children:t.name}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["#",t.trending_order??"—"," · ",t.role_type]})]}),e.jsx("button",{onClick:()=>r({...m,...t,social_handles:t.social_handles??{}}),className:"yh-eyebrow text-hotpink text-sm",children:"Edit"})]})})})]}),p.length>0&&e.jsxs("div",{className:"mt-6 border-2 border-amber-500 bg-amber-500/5 p-4",children:[e.jsxs("h2",{className:"yh-eyebrow text-sm text-amber-700 dark:text-amber-400",children:["⚠ Talent awaiting review (",p.length,")"]}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Newly-created talent rows that haven't been promoted to Evergreen or flagged Trending. They have ",e.jsx("strong",{children:"no public profile page"})," and are excluded from sitemaps until you promote or delete them."]}),e.jsx("ul",{className:"mt-3 divide-y divide-border",children:p.map(t=>e.jsxs("li",{className:"flex items-center gap-3 py-2",children:[t.photo_url?e.jsx("img",{src:t.photo_url,alt:"",className:"w-8 h-8 rounded-full object-cover shrink-0",loading:"lazy",decoding:"async"}):e.jsx("div",{className:"w-8 h-8 rounded-full bg-muted shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-medium truncate",children:t.name}),e.jsxs("div",{className:"text-xs text-muted-foreground truncate",children:["/",t.slug," · ",t.role_type??"—"]})]}),e.jsx("button",{onClick:()=>T(t.id),className:"yh-eyebrow text-xs bg-emerald-600 text-white px-3 py-1.5 hover:bg-emerald-700",children:"Promote to Evergreen"}),e.jsx("button",{onClick:()=>r({...m,...t,social_handles:t.social_handles??{}}),className:"yh-eyebrow text-xs text-hotpink",children:"Edit"}),e.jsx("button",{onClick:()=>_(t.id),className:"yh-eyebrow text-xs text-muted-foreground hover:text-destructive",children:"Delete"})]},t.id))})]}),e.jsx("input",{value:u,onChange:t=>w(t.target.value),placeholder:"Search…",className:"mt-6 border border-input p-2 w-64"}),e.jsxs("table",{className:"mt-4 w-full border border-border text-sm",children:[e.jsx("thead",{className:"bg-secondary text-left",children:e.jsxs("tr",{children:[e.jsx("th",{className:"p-3",children:"Name"}),e.jsx("th",{className:"p-3",children:"Role"}),e.jsx("th",{className:"p-3",children:"Flags"}),e.jsx("th",{})]})}),e.jsxs("tbody",{children:[j.map(t=>e.jsxs("tr",{className:"border-t border-border",children:[e.jsx("td",{className:"p-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[t.photo_url&&e.jsx("img",{src:t.photo_url,alt:"",className:"w-8 h-8 rounded-full object-cover",loading:"lazy",decoding:"async"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:t.name}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["/",t.slug]})]})]})}),e.jsx("td",{className:"p-3",children:e.jsx("span",{className:"yh-eyebrow",children:t.role_type})}),e.jsxs("td",{className:"p-3 text-xs",children:[t.is_featured&&e.jsx("span",{className:"mr-2 bg-cobalt text-cobalt-foreground px-1.5 py-0.5",children:"Featured"}),t.is_evergreen&&e.jsx("span",{className:"mr-2 bg-emerald-600 text-white px-1.5 py-0.5",children:"Evergreen"}),t.is_trending&&e.jsxs("span",{className:"bg-hotpink text-white px-1.5 py-0.5",children:["Trending #",t.trending_order??"—"]}),!t.is_featured&&!t.is_evergreen&&!t.is_trending&&e.jsx("span",{className:"text-muted-foreground",children:"No public page"}),t.photo_verified===!1&&e.jsx("span",{className:"ml-2 border border-amber-500 text-amber-700 dark:text-amber-400 px-1.5 py-0.5",title:t.photo_verification_note??"Photo needs review",children:"Needs photo review"})]}),e.jsxs("td",{className:"p-3 text-right whitespace-nowrap",children:[e.jsx("button",{onClick:()=>r({...m,...t,social_handles:t.social_handles??{}}),className:"yh-eyebrow text-hotpink mr-3",children:"Edit"}),e.jsx("button",{onClick:()=>_(t.id),className:"yh-eyebrow text-muted-foreground hover:text-destructive",children:"Delete"})]})]},t.id)),j.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"p-6 text-center text-muted-foreground",children:"No talent yet."})})]})]}),a&&e.jsx("div",{className:"fixed inset-0 bg-black/50 z-50 flex items-start justify-center overflow-y-auto p-6",onClick:()=>r(null),children:e.jsxs("div",{className:"bg-background border border-border max-w-2xl w-full p-6 my-10",onClick:t=>t.stopPropagation(),children:[e.jsx("h2",{className:"yh-headline text-2xl mb-4",children:a.id?"Edit talent":"New talent"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(n,{label:"Name",children:e.jsx("input",{value:a.name,onChange:t=>r({...a,name:t.target.value}),className:"w-full border border-input p-2"})}),e.jsx(n,{label:"Slug (auto from name if empty)",children:e.jsx("input",{value:a.slug,onChange:t=>r({...a,slug:t.target.value}),className:"w-full border border-input p-2"})}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(n,{label:"Role",children:e.jsx("select",{value:a.role_type??"actor",onChange:t=>r({...a,role_type:t.target.value}),className:"w-full border border-input p-2",children:F.map(t=>e.jsx("option",{value:t,children:t},t))})}),e.jsx(n,{label:"Trending order (1 = first)",children:e.jsx("input",{type:"number",value:a.trending_order??"",onChange:t=>r({...a,trending_order:t.target.value?Number(t.target.value):null}),className:"w-full border border-input p-2"})})]}),e.jsx(n,{label:"Photo (square, used on cards)",children:e.jsx(N,{value:a.p
1hoto_url,onChange:t=>r(l=>l&&{...l,photo_url:t}),onUploaded:a.id?async t=>{const{error:l}=await c.from("talent").update({photo_url:t,photo_focal_x:50,photo_focal_y:50}).eq("id",a.id);if(l)throw l;r(s=>s&&{...s,photo_url:t,photo_focal_x:50,photo_focal_y:50}),h()}:void 0,folder:"talent",focal:{x:a.photo_focal_x??50,y:a.photo_focal_y??30,onChange:(t,l)=>r(s=>s&&{...s,photo_focal_x:t,photo_focal_y:l})}})}),e.jsx(n,{label:"Hero image (wide, used on profile page)",children:e.jsx(N,{value:a.hero_image_url,onChange:t=>r(l=>l&&{...l,hero_image_url:t}),onUploaded:a.id?async t=>{const{error:l}=await c.from("talent").update({hero_image_url:t,hero_focal_x:50,hero_focal_y:50}).eq("id",a.id);if(l)throw l;r(s=>s&&{...s,hero_image_url:t,hero_focal_x:50,hero_focal_y:50}),h()}:void 0,folder:"talent",focal:{x:a.hero_focal_x??50,y:a.hero_focal_y??30,onChange:(t,l)=>r(s=>s&&{...s,hero_focal_x:t,hero_focal_y:l})}})}),e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"yh-eyebrow text-muted-foreground text-xs",children:["Bio (",(a.bio??"").length," chars)"]}),e.jsx("button",{type:"button",onClick:C,disabled:b||!a.name?.trim(),className:"yh-eyebrow text-xs text-hotpink hover:underline disabled:opacity-50 disabled:no-underline",children:b?"Generating…":"✨ Generate with AI"})]}),e.jsx("textarea",{value:a.bio??"",onChange:t=>r({...a,bio:t.target.value}),className:"mt-1 w-full border border-input p-2",rows:5,placeholder:"3-4 sentences covering signature roles, hits, and accolades…"})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(n,{label:"Instagram",children:e.jsx("input",{value:a.social_handles?.instagram??"",onChange:t=>r({...a,social_handles:{...a.social_handles,instagram:t.target.value}}),className:"w-full border border-input p-2",placeholder:"@handle"})}),e.jsx(n,{label:"TikTok",children:e.jsx("input",{value:a.social_handles?.tiktok??"",onChange:t=>r({...a,social_handles:{...a.social_handles,tiktok:t.target.value}}),className:"w-full border border-input p-2",placeholder:"@handle"})}),e.jsx(n,{label:"Twitter / X",children:e.jsx("input",{value:a.social_handles?.twitter??"",onChange:t=>r({...a,social_handles:{...a.social_handles,twitter:t.target.value}}),className:"w-full border border-input p-2",placeholder:"@handle"})}),e.jsx(n,{label:"YouTube",children:e.jsx("input",{value:a.social_handles?.youtube??"",onChange:t=>r({...a,social_handles:{...a.social_handles,youtube:t.target.value}}),className:"w-full border border-input p-2",placeholder:"@handle"})})]}),e.jsxs("div",{className:"flex flex-wrap gap-6",children:[e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:!!a.is_evergreen,onChange:t=>r({...a,is_evergreen:t.target.checked})})," ",e.jsx("span",{className:"yh-eyebrow",children:"Evergreen A-list"})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:!!a.is_trending,onChange:t=>r({...a,is_trending:t.target.checked})})," ",e.jsx("span",{className:"yh-eyebrow",children:"Trending"})]}),e.jsxs("label",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:!!a.is_featured,onChange:t=>r({...a,is_featured:t.target.checked})})," ",e.jsx("span",{className:"yh-eyebrow",children:"Featured (homepage)"})]})]}),e.jsxs("p",{className:"text-xs text-muted-foreground -mt-1",children:["Only ",e.jsx("strong",{children:"Evergreen"})," or ",e.jsx("strong",{children:"Trending"})," talent get a public /talent profile page and appear in sitemaps. Everyone else is taggable in articles but has no standalone page."]}),e.jsx(n,{label:"Pinned featured video slug (overrides auto-pick on profile)",children:e.jsx("input",{value:a.featured_video_slug??"",onChange:t=>r({...a,featured_video_slug:t.target.value.trim()||null}),className:"w-full border border-input p-2 font-mono text-sm",placeholder:"e.g. selena-gomez-by-selena-gomez"})}),e.jsxs("div",{className:"grid grid-cols-3 gap-3 pt-2 border-t border-border",children:[e.jsx(n,{label:"Date of birth (verified only)",children:e.jsx("input",{type:"date",value:a.birth_date??"",onChange:t=>r({...a,birth_date:t.target.value||null}),className:"w-full border border-input p-2"})}),e.jsx(n,{label:"Birthplace",children:e.jsx("input",{value:a.birth_place??"",onChange:t=>r({...a,birth_place:t.target.value||null}),className:"w-full border border-input p-2",placeholder:"Cullman, Alabama"})}),e.jsx(n,{label:"Known for (what they're in now)",children:e.jsx("input",{value:a.known_for??"",onChange:t=>r({...a,known_for:t.target.value||null}),className:"w-full border border-input p-2",placeholder:"Roofman (2026)"})})]}),e.jsx("div",{className:"pt-2 border-t border-border",children:e.jsx(n,{label:"Priority AI coverage until",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"date",value:a.ai_priority_until?String(a.ai_priority_until).slice(0,10):"",onCh
1ange:t=>r({...a,ai_priority_until:t.target.value?new Date(`${t.target.value}T12:00:00Z`).toISOString():null}),className:"border border-input p-2"}),e.jsx("button",{type:"button",onClick:()=>r({...a,ai_priority_until:new Date(Date.now()+21*864e5).toISOString()}),className:"border border-input px-2 py-1 text-xs",children:"+21 days"}),e.jsx("button",{type:"button",onClick:()=>r({...a,ai_priority_until:null}),className:"border border-input px-2 py-1 text-xs",children:"Clear"})]})})}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 pt-2 border-t border-border",children:[e.jsx(n,{label:`Meta title (${(a.meta_title??"").length}/60)`,children:e.jsx("input",{value:a.meta_title??"",onChange:t=>r({...a,meta_title:t.target.value}),className:"w-full border border-input p-2",maxLength:60})}),e.jsx(n,{label:`Meta description (${(a.meta_description??"").length}/160)`,children:e.jsx("input",{value:a.meta_description??"",onChange:t=>r({...a,meta_description:t.target.value}),className:"w-full border border-input p-2",maxLength:160})})]})]}),e.jsxs("div",{className:"mt-6 flex justify-end items-center gap-3",children:[e.jsx("span",{className:"yh-eyebrow text-xs text-muted-foreground",children:"Changes aren't saved until you click Save →"}),e.jsx("button",{onClick:()=>r(null),className:"border border-foreground px-4 py-2 yh-eyebrow",children:"Cancel"}),e.jsx("button",{onClick:S,className:"bg-cobalt text-cobalt-foreground px-4 py-2 yh-eyebrow",children:"Save"})]})]})})]})}function n({label:o,children:x}){return e.jsxs("label",{className:"block",children:[e.jsx("span",{className:"yh-eyebrow text-muted-foreground text-xs",children:o}),e.jsx("div",{className:"mt-1",children:x})]})}export{U 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.