PageSourceSearch

https://mostreams-com.lovable.app/assets/chart-registration-ygAqjX5M.js

js mostreams-com.lovable.app collected 2026-10-03 03:35:29 UTC 3,537 bytes, 1 lines download raw bytes

1import{r as a,j as e,B as k,s as o,v as b}from"./index-BNrdOJig.js";import{B as w,D as y,E as S}from"./BackOfficeWorkspace-BsNQ8xko.js";import{I as B}from"./input-CwAqzCK4.js";import{submitPlatformForm as C}from"./platform-submissions-D3ZGXLMB.js";function E(){const[r,x]=a.useState([]),[u,f]=a.useState([]),[n,j]=a.useState("Billboard Hot 100"),[i,m]=a.useState(""),[c,h]=a.useState(""),[_,g]=a.useState(!1),p=async()=>{const{data:t}=await o.auth.getUser(),s=t.user?.id;if(!s)return;const[{data:d},{data:l}]=await Promise.all([o.from("chart_registrations").select("*").eq("user_id",s).order("submitted_at",{ascending:!1}),o.from("tracks").select("id, title").eq("owner_id",s).eq("removed",!1).order("created_at",{ascending:!1}).limit(50)]);x(d??[]),f(l??[]),!i&&l&&l[0]&&m(l[0].id)};a.useEffect(()=>{p()},[]);const v=async()=>{g(!0);const{data:t}=await o.auth.getUser(),s=c?Math.round(parseFloat(c)*100):0,{error:d}=await o.from("chart_registrations").insert({user_id:t.user.id,track_id:i||null,chart_name:n,promo_budget_cents:s,status:"submitted"});if(g(!1),d)return b.error(d.message);h(""),b.success("Chart registration submitted."),C({formType:"chart-registration",subject:`Chart registration: ${n}`,payload:{chart_name:n,track_id:i||null,promo_budget_cents:s}}),p()};return e.jsx(w,{title:"Chart Registration",subtitle:"Register tracks with Billboard, Rolling Stone, and DSP charts",intro:"Submit a track for chart consideration. We forward eligible entries to our chart partners in the next reporting window.",kpis:[{label:"Total submissions",value:r.length},{label:"In review",value:r.filter(t=>t.status==="submitted"||t.status==="in_review").length},{label:"Charted",value:r.filter(t=>t.status==="charted").length},{label:"Promo budget",value:`$${(r.reduce((t,s)=>t+(s.promo_budget_cents??0),0)/100).toFixed(0)}`}],toolbar:e.jsxs(e.Fragment,{children:[e.jsxs("select",{value:n,onChange:t=>j(t.target.value),className:"rounded-md bg-background border border-border px-3 py-2 text-sm",children:[e.jsx("option",{children:"Billboard Hot 100"}),e.jsx("option",{children:"Billboard 200"}),e.jsx("option",{children:"Billboard R&B/Hip-Hop"}),e.jsx("option",{children:"Rolling Stone 200"}),e.jsx("option",{children:"Spotify Viral 50"}),e.jsx("option",{children:"Apple Music Top 100"})]}),e.jsxs("select",{value:i,onChange:t=>m(t.target.value),className:"rounded-md bg-background border border-border px-3 py-2 text-sm min-w-[200px]",children:[e.jsx("option",{value:"",children:"— Select track —"}),u.map(t=>e.jsx("option",{value:t.id,children:t.title},t.id))]}),e.jsx(B,{placeholder:"Promo budget $",value:c,onChange:t=>h(t.target.value),className:"w-32",type:"number"}),e.jsx(k,{onClick:v,disabled:_||!i,children:"Register"})]}),children:e.jsx(y,{title:"Your submissions",children:r.length===0?e.jsx(S,{title:"No chart submissions yet",description:"Pick a track and a chart above to get started."}):e.jsx("ul",{className:"divide-y divide-white/5 text-sm",children:r.map(t=>e.jsxs("li",{className:"px-5 py-3 grid grid-cols-5 gap-2 items-center",children:[e.jsx("div",{className:"col-span-2 font-semibold",children:t.chart_name}),e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:t.track_id?u.find(s=>s.id===t.track_id)?.title??t.track_id.slice(0,8):"—"}),e.jsxs("div",{className:"text-xs",children:["$",((t.promo_budget_cents??0)/100).toFixed(0)]}),e.jsxs("div",{className:"text-xs text-right",children:[t.status," · ",new Date(t.submitted_at).toLocaleDateString()]})]},t.id))})})})}export{E 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.