PageSourceSearch

https://player3.gg/assets/PartnerPayoutsPanel-D-v2mQrq.js

js player3.gg collected 2026-10-05 03:12:03 UTC 5,012 bytes, 1 lines download raw bytes

1import{a7 as h,a2 as c,t as o,r as j,a8 as y,o as l,j as e,M as u,B as _,k as N}from"./index-yLHt_u4B.js";const v=[{tier:1,games:5,payout:125},{tier:2,games:10,payout:300},{tier:3,games:15,payout:500}];function s(n){return`$${n.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2})}`}const x={pending:"bg-amber-500/15 text-amber-400 border-amber-500/30",paid:"bg-emerald-500/15 text-emerald-400 border-emerald-500/30",held:"bg-muted text-muted-foreground border-border"};function S(){const n=h(),{data:a=[],isLoading:p}=c({queryKey:["admin_partner_payouts"],queryFn:async()=>{const{data:r,error:t}=await o.from("partner_payouts").select("*").order("created_at",{ascending:!1});if(t)throw t;return r||[]}}),{data:i=[]}=c({queryKey:["admin_partner_payout_profiles",a.map(r=>r.partner_user_id)],enabled:a.length>0,queryFn:async()=>{const r=[...new Set(a.map(d=>d.partner_user_id))],{data:t}=await o.from("profiles").select("id, full_name, username").in("id",r);return t||[]}}),g=j.useMemo(()=>new Map(i.map(r=>[r.id,r])),[i]),m=y({mutationFn:async r=>{const{error:t}=await o.from("partner_payouts").update({status:"paid",paid_at:new Date().toISOString()}).eq("id",r);if(t)throw t},onSuccess:()=>{n.invalidateQueries({queryKey:["admin_partner_payouts"]}),l.success("Payout marked as paid")},onError:r=>l.error(r.message)}),f=a.filter(r=>r.status==="pending").reduce((r,t)=>r+Number(t.amount),0),b=a.filter(r=>r.status==="paid").reduce((r,t)=>r+Number(t.amount),0);return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"rounded-lg border border-primary/20 bg-primary/5 px-4 py-3 text-sm text-muted-foreground flex items-start gap-2.5",children:[e.jsx(u,{name:"favorite",size:18,className:"text-primary mt-0.5 shrink-0"}),e.jsxs("div",{children:[e.jsx("p",{children:"Partner payouts are tier-based:"}),e.jsx("div",{className:"flex gap-4 mt-1 text-xs",children:v.map(r=>e.jsxs("span",{className:"text-foreground",children:["Tier ",r.tier,": ",r.games," games → ",e.jsx("strong",{children:s(r.payout)})]},r.tier))})]})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-lg border border-border bg-card p-4",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Total Owed"}),e.jsx("p",{className:"text-xl font-bold font-mono text-amber-400",children:s(f)})]}),e.jsxs("div",{className:"rounded-lg border border-border bg-card p-4",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Total Paid"}),e.jsx("p",{className:"text-xl font-bold font-mono text-emerald-400",children:s(b)})]}),e.jsxs("div",{className:"rounded-lg border border-border bg-card p-4",children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Total Records"}),e.jsx("p",{className:"text-xl font-bold font-mono text-foreground",children:a.length})]})]}),p?e.jsx("div",{className:"text-muted-foreground text-sm",children:"Loading partner payouts..."}):a.length===0?e.jsxs("div",{className:"rounded-lg border border-border bg-card p-8 text-center",children:[e.jsx(u,{name:"favorite",size:40,className:"text-muted-foreground/40 mx-auto mb-3"}),e.jsx("p",{className:"text-muted-foreground",children:"No partner payouts yet."}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Payouts are generated when partners complete a tier."})]}):e.jsxs("div",{className:"rounded-lg border border-border overflow-hidden",children:[e.jsxs("div",{className:"hidden md:grid grid-cols-[1.5fr_0.8fr_0.8fr_1fr_1fr_0.8fr_80px] gap-2 px-6 py-3 bg-secondary/50 text-xs text-muted-foreground font-display font-medium",children:[e.jsx("span",{children:"Partner"}),e.jsx("span",{children:"Tier"}),e.jsx("span",{children:"Games"}),e.jsx("span",{children:"Amount"}),e.jsx("span",{children:"Date"}),e.jsx("span",{children:"Status"}),e.jsx("span",{})]}),a.map(r=>{const t=g.get(r.partner_user_id),d=new Date(r.created_at).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"2-digit"});return e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[1.5fr_0.8fr_0.8fr_1fr_1fr_0.8fr_80px] gap-2 px-6 py-3 border-b border-border text-sm items-center hover:bg-secondary/20 transition-colors",children:[e.jsx("span",{className:"text-foreground truncate",children:(t==null?void 0:t.full_name)||(t==null?void 0:t.username)||"Unknown"}),e.jsxs("span",{className:"font-mono text-foreground",children:["Tier ",r.tier]}),e.jsx("span",{className:"font-mono text-muted-foreground",children:r.games_in_tier}),e.jsx("span",{className:"font-mono font-medium text-foreground",children:s(Number(r.amount))}),e.jsx("span",{className:"text-muted-foreground font-mono text-xs",children:d}),e.jsx(_,{variant:"outline",className:`text-xs font-mono capitalize ${x[r.status]||x.pending}`,children:r.status}),e.jsx("div",{children:r.status==="pending"&&e.jsx(N,{size:"sm",variant:"outline",onClick:()=>m.mutate(r.id),disabled:m.isPending,className:"text-xs h-7",children:"Mark Paid"})})]},r.id)})]})]})}export{S 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.