PageSourceSearch

https://getcosmos.app/assets/SportsReconcilePage-BcuQ3qaV.js

js getcosmos.app collected 2026-10-09 22:01:29 UTC 4,805 bytes, 1 lines download raw bytes

1import{g as x,s as b,r as y,j as e}from"./index-CoKw7wIX.js";import{u as m,A as c}from"./useAdminAccess-BPrEDVkl.js";function f(){return x({mutationFn:async({league:i="NFL",dryRun:s})=>{const{data:a,error:l}=await b.functions.invoke("admin-reconcile-sports-duplicates",{body:{league:i,dryRun:s}});if(l)throw l;const n=a;if(!(n!=null&&n.ok)||!n.result)throw new Error((n==null?void 0:n.error)??"reconcile_failed");return n.result}})}const h={padding:"6px 8px",background:"rgba(255,255,255,0.06)",color:"inherit",border:"1px solid rgba(255,255,255,0.15)",borderRadius:8},p={padding:"10px 14px",borderRadius:10,border:"1px solid rgba(255,255,255,0.18)",background:"rgba(255,255,255,0.08)",color:"inherit",cursor:"pointer",fontWeight:600};function k(){const{status:i}=m(),s=f(),[a,l]=y.useState("NFL");if(i==="loading")return e.jsx(c,{title:"Reconcile sports duplicates",children:e.jsx("div",{className:"v2-admin-empty",children:"Checking access…"})});if(i!=="allowed")return null;const n=()=>{window.confirm(`Run LIVE reconciliation for ${a}? This will merge duplicate events, reassign user content, and delete losing rows. Losers will keep working URLs via aliases.`)&&s.mutate({league:a,dryRun:!1})},r=s.data;return e.jsx(c,{title:"Reconcile sports duplicates",children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20,paddingBottom:60},children:[e.jsx("p",{style:{opacity:.75,fontSize:14,lineHeight:1.5},children:"Detects duplicate sports events by season + unordered team pair + event date. Dry run previews only; Live merges losers into winners, reassigns posts, photos, comments, check-ins, likes, notifications, and inserts URL aliases so old links keep working."}),e.jsxs("div",{style:{display:"flex",gap:12,alignItems:"center",flexWrap:"wrap"},children:[e.jsxs("label",{style:{fontSize:13,opacity:.75,display:"flex",gap:8,alignItems:"center"},children:["League",e.jsx("select",{value:a,onChange:t=>l(t.target.value),style:h,children:["NFL","NBA","NHL","MLB","WNBA","MLS","NWSL"].map(t=>e.jsx("option",{value:t,children:t},t))})]}),e.jsx("button",{onClick:()=>s.mutate({league:a,dryRun:!0}),disabled:s.isPending,style:p,children:s.isPending?"Running…":"Dry run"}),e.jsx("button",{onClick:n,disabled:s.isPending,style:{...p,background:"rgba(220,80,80,0.18)",borderColor:"rgba(220,80,80,0.35)"},children:"Run live"})]}),s.error&&e.jsx("div",{style:{padding:12,borderRadius:10,background:"rgba(220,80,80,0.15)",border:"1px solid rgba(220,80,80,0.35)",fontSize:13},children:s.error.message}),r&&e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(140px, 1fr))",gap:10},children:[e.jsx(o,{label:"Mode",value:r.dry_run?"Dry run":"Live"}),e.jsx(o,{label:"Candidate groups",value:r.candidateGroups}),e.jsx(o,{label:"Skipped (locks)",value:r.skippedCollisions}),e.jsx(o,{label:"Aliases created",value:r.aliasesCreated})]}),e.jsxs("section",{children:[e.jsx(d,{children:"Per-table moves"}),e.jsx(u,{obj:r.perTableMoves})]}),e.jsxs("section",{children:[e.jsx(d,{children:"Deduplications (removed duplicate child rows)"}),e.jsx(u,{obj:r.dedups})]}),r.groups.length>0&&e.jsxs("section",{children:[e.jsxs(d,{children:["Groups (",r.groups.length,")"]}),e.jsx("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:8},children:r.groups.slice(0,100).map((t,g)=>e.jsxs("li",{style:{padding:10,borderRadius:8,background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.08)",fontSize:12,fontFamily:"ui-monospace, monospace"},children:[e.jsxs("div",{children:[t.event_date," · season ",t.season]}),e.jsxs("div",{style:{opacity:.75},children:["winner: ",t.winner]}),e.jsxs("div",{style:{opacity:.75},children:["losers: ",t.losers.join(", ")]})]},g))})]})]})]})})}function o({label:i,value:s}){return e.jsxs("div",{style:{padding:12,borderRadius:10,background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.08)"},children:[e.jsx("div",{style:{fontSize:11,opacity:.6,textTransform:"uppercase",letterSpacing:.5},children:i}),e.jsx("div",{style:{fontSize:18,fontWeight:600,marginTop:4},children:s})]})}function d({children:i}){return e.jsx("h3",{style:{fontSize:13,opacity:.75,margin:"0 0 8px",textTransform:"uppercase",letterSpacing:.5},children:i})}function u({obj:i}){const s=Object.entries(i);return e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(160px, 1fr))",gap:6,fontSize:13},children:s.map(([a,l])=>e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",padding:"6px 10px",borderRadius:6,background:"rgba(255,255,255,0.03)"},children:[e.jsx("span",{style:{opacity:.7},children:a}),e.jsx("span",{style:{fontVariantNumeric:"tabular-nums"},children:l})]},a))})}export{k 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.