PageSourceSearch

https://mostreams-com.lovable.app/assets/sales-CZDOM9Mt.js

js mostreams-com.lovable.app collected 2026-10-03 03:36:08 UTC 8,239 bytes, 1 lines download raw bytes

1import{aK as j,aL as g,aM as v,bz as N,y,O as b,r as u,j as e,bA as w,t as h,ae as S}from"./index-BNrdOJig.js";import{I as T}from"./info-BRKP8n8_.js";import{C as F}from"./calendar-DPBDZjL-.js";import{T as k}from"./trending-up-DKvEzUeP.js";import{T as M}from"./trending-down-FO_JX3x_.js";const $=j({method:"POST"}).middleware([g]).handler(v("bfd951825b0dbd0425a8c580046c454875ec120609b8b25be49eddbfa6a26687"));function R(r){const a=(r/100).toFixed(2),[t,l]=a.split(".");return{whole:t,decimal:l}}function n(r){return`$${(r/100).toFixed(2)}`}function L(r){const[a,t]=r.split("-").map(Number);return new Date(a,(t??1)-1,1).toLocaleString("en-US",{month:"long",year:"numeric"})}function A(r){if(!r.length)return{start:"—",end:"—"};const a=t=>new Date(t).toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric"});return{start:a(r[0].day),end:a(r[r.length-1].day)}}function C({series:r}){if(r.length<2)return e.jsx("div",{className:"h-[220px] flex items-center justify-center text-sm text-muted-foreground",children:"No earnings yet — once stores deliver statements, your trend will appear here."});const l=Math.max(...r.map(o=>o.cents),1),c=1200/(r.length-1),s=r.map((o,x)=>[x*c,220-o.cents/l*200-10]).map(([o,x],f)=>`${f===0?"M":"L"}${o.toFixed(1)},${x.toFixed(1)}`).join(" "),p=`${s} L1200,220 L0,220 Z`;return e.jsxs("svg",{viewBox:"0 0 1200 220",className:"w-full h-[220px]",preserveAspectRatio:"none",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"salesFill",x1:"0",x2:"0",y1:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"hsl(var(--primary))",stopOpacity:"0.35"}),e.jsx("stop",{offset:"100%",stopColor:"hsl(var(--primary))",stopOpacity:"0"})]})}),e.jsx("path",{d:p,fill:"url(#salesFill)"}),e.jsx("path",{d:s,fill:"none",stroke:"hsl(var(--primary))",strokeWidth:"2.5"})]})}function i({title:r,action:a,children:t}){return e.jsxs("div",{className:"rounded-2xl border border-border bg-card",children:[e.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-border",children:[e.jsx("h3",{className:"text-sm font-semibold",children:r}),a]}),e.jsx("div",{className:"p-3",children:t})]})}function d({left:r,right:a}){return e.jsxs("div",{className:"flex items-center justify-between px-2 py-2 rounded-lg hover:bg-muted/40",children:[e.jsx("div",{className:"flex items-center gap-3 min-w-0",children:r}),e.jsx("div",{className:"text-sm font-medium tabular-nums",children:a})]})}function z(){const r=N(),a=y($),{data:t,isLoading:l}=b({queryKey:["sales-overview"],queryFn:()=>a()}),c=u.useMemo(()=>R(t?.totalCents??0),[t]),m=u.useMemo(()=>A(t?.series??[]),[t]);return e.jsxs(w,{profile:r,title:"Sales",subtitle:"All earnings rolled up across every store, territory and release.",children:[e.jsxs("div",{className:"rounded-2xl border border-border bg-card p-6 mb-6",children:[e.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground mb-1",children:["Total Earnings ",e.jsx(T,{className:"w-3 h-3"})]}),e.jsxs("div",{className:"flex items-baseline gap-0.5",children:[e.jsx("span",{className:"text-2xl font-semibold mr-1",children:"$"}),e.jsx("span",{className:"font-display text-5xl md:text-6xl font-bold tracking-tight",children:c.whole}),e.jsx("span",{className:"text-xl font-semibold text-muted-foreground align-super ml-0.5",children:c.decimal})]}),e.jsx("div",{className:"mt-4",children:l?e.jsx("div",{className:"h-[220px] animate-pulse rounded-lg bg-muted/40"}):e.jsx(C,{series:t?.series??[]})}),e.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground mt-2",children:[e.jsx("span",{children:m.start}),e.jsx("span",{children:m.end})]}),e.jsx("div",{className:"mt-4 flex flex-wrap gap-2",children:["Monthly Sales","By Release","By Track","6-Month Overview","All Reports →"].map(s=>e.jsx("span",{className:"text-xs px-3 py-1.5 rounded-full bg-muted/60 text-foreground/80",children:s},s))})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsx(i,{title:"Top Releases",action:e.jsx("span",{className:"text-xs text-muted-foreground",children:"View all →"}),children:(t?.topReleases??[]).length===0?e.jsx("div",{className:"px-2 py-6 text-sm text-muted-foreground",children:"No release sales yet."}):t.topReleases.map(s=>e.jsx(d,{left:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-10 h-10 rounded bg-muted overflow-hidden flex-shrink-0",children:s.cover_url&&e.jsx("img",{src:h(s.cover_url,960),alt:"",className:"w-full h-full object-cover",loading:"lazy",decoding:"async"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-medium truncate",children:s.title}),e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:s.artist})]})]}),right:n(s.cents)},s.id))}),e.jsx(i,{title:"Top Tracks",action:e.jsx("span",{className:"text-xs text-muted-foreground",children:"View all →"}),children:(t?.topTracks??[]).length===0?e.jsx("div",{className:"px-2 py-6 text-sm text-muted-foreground",children:"No track sales yet."}):t.topTracks.map(s=>e.jsx(d,{left:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-10 h-10 rounded bg-muted overflow-hidden flex-shrink-0",children:s.cover_url&&e.jsx("img",{src:h(s.cover_url,960),alt:"",className:"w-full h-full object-cover",loading:"lazy",decoding:"async"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-medium truncate",children:s.title}),e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:s.artist})]})]}),right:n(s.cents)},s.id))}),e.jsx(i,{title:"Top Stores/Services",action:e.jsx("span",{className:"text-xs text-muted-foreground",children:"View all →"}),children:(t?.topStores??[]).length===0?e.jsx("div",{className:"px-2 py-6 text-sm text-muted-foreground",children:"No store revenue yet."}):t.topStores.map(s=>e.jsx(d,{left:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-7 h-7 rounded bg-muted flex items-center justify-center text-[10px] font-semibold text-muted-foreground",children:s.label.slice(0,2).toUpperCase()}),e.jsx("span",{className:"text-sm",children:s.label})]}),right:n(s.cents)},s.dsp))}),e.jsx(i,{title:"Top Territories",action:e.jsx("span",{className:"text-xs text-muted-foreground",children:"View all →"}),children:(t?.topTerritories??[]).length===0?e.jsx("div",{className:"px-2 py-6 text-sm text-muted-foreground",children:"No territory revenue yet."}):t.topTerritories.map(s=>e.jsx(d,{left:e.jsxs(e.Fragment,{children:[e.jsx(S,{code:s.code,className:"w-6 h-6 rounded-full"}),e.jsx("span",{className:"text-sm",children:s.name})]}),right:n(s.cents)},s.code))}),e.jsx(i,{title:"Top Artists",action:e.jsx("span",{className:"text-xs text-muted-foreground",children:"View all →"}),children:(t?.topArtists??[]).length===0?e.jsx("div",{className:"px-2 py-6 text-sm text-muted-foreground",children:"No artist revenue yet."}):t.topArtists.map(s=>e.jsx(d,{left:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-9 h-9 rounded bg-muted overflow-hidden flex-shrink-0",children:s.avatar_url&&e.jsx("img",{src:h(s.avatar_url,960),alt:"",className:"w-full h-full object-cover",loading:"lazy",decoding:"async"})}),e.jsx("span",{className:"text-sm font-medium truncate",children:s.name})]}),right:n(s.cents)},s.id))}),e.jsx(i,{title:"Recent Months",action:e.jsx("span",{className:"text-xs text-muted-foreground",children:"View all →"}),children:(t?.recentMonths??[]).length===0?e.jsx("div",{className:"px-2 py-6 text-sm text-muted-foreground",children:"No monthly data yet."}):t.recentMonths.map(s=>e.jsx(d,{left:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-9 h-9 rounded bg-primary/10 flex items-center justify-center text-primary",children:e.jsx(F,{className:"w-4 h-4"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm font-medium",children:L(s.month)}),s.mom!=null&&e.jsxs("div",{className:`inline-flex items-center gap-1 text-[11px] px-1.5 py-0.5 rounded ${s.mom>=0?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400":"bg-rose-500/10 text-rose-600 dar
1k:text-rose-400"}`,children:[s.mom>=0?e.jsx(k,{className:"w-3 h-3"}):e.jsx(M,{className:"w-3 h-3"}),Math.abs(s.mom).toFixed(1),"% MoM"]})]})]}),right:n(s.cents)},s.month))})]})]})}export{z 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.