1import{am as x,_ as o,j as s,S as p,N as u,ao as h,L as f,ah as g,aB as j,aA as b,F as N,al as _}from"./index-CgATW1b_.js";import{C as w}from"./card-CxPkOzgf.js";import{T as L}from"./trophy-DgA2z7gQ.js";import{C as k}from"./crown-BklYvNAx.js";import{M as v}from"./message-square-CVtyF2l4.js";const F=()=>{const{user:r,subscribed:c,loading:d}=x(),[n,l]=o.useState([]),[i,m]=o.useState(!0);return o.useEffect(()=>{(async()=>{const{data:a,error:t}=await _.rpc("get_leaderboard");!t&&a&&l(a),m(!1)})()},[]),d?null:s.jsxs(s.Fragment,{children:[s.jsx(p,{title:"Leaderboard | 100 Great Books",description:"See the top readers and club leaders in our community."}),s.jsx(u,{}),s.jsx("main",{className:"min-h-screen bg-background",children:s.jsxs("div",{className:"max-w-4xl mx-auto px-4 py-12",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-8",children:[s.jsx(L,{className:"w-8 h-8 text-foreground"}),s.jsx("h1",{className:"font-serif text-3xl font-bold text-foreground",children:"Leaderboard"})]}),i?s.jsx("div",{className:"flex justify-center py-12",children:s.jsx(h,{className:"w-6 h-6 animate-spin text-muted-foreground"})}):n.length===0?s.jsxs("div",{className:"text-center py-16",children:[s.jsx("p",{className:"text-muted-foreground mb-4",children:"No data yet. Be the first to start reading!"}),!c&&s.jsx(f,{to:"/membership",children:s.jsx(g,{children:"Join to get started"})})]}):s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"grid grid-cols-5 gap-4 px-4 py-2 text-xs font-sans font-semibold text-muted-foreground uppercase tracking-wider",children:[s.jsx("span",{children:"Rank"}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(j,{className:"w-3 h-3"})," Books"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(b,{className:"w-3 h-3"})," Members"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(k,{className:"w-3 h-3"})," Clubs"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(v,{className:"w-3 h-3"})," Posts"]})]}),n.map((e,a)=>{const t=e.user_id===(r==null?void 0:r.id);return e.books_completed*10+e.club_members_total*5+e.discussions_count*2+e.clubs_owned*3,s.jsxs(w,{className:`grid grid-cols-5 gap-4 px-4 py-3 items-center transition-colors ${t?"border-foreground bg-secondary":""}`,children:[s.jsxs("span",{className:"font-serif font-bold text-foreground flex items-center gap-2",children:[a===0&&s.jsx("span",{className:"text-[hsl(var(--nyt-highlight))]",children:"ð¥"}),a===1&&s.jsx("span",{children:"ð¥"}),a===2&&s.jsx("span",{children:"ð¥"}),"#",a+1,t&&s.jsx("span",{className:"text-xs font-sans font-normal text-muted-foreground",children:"(you)"})]}),s.jsx("span",{className:"font-mono text-sm text-foreground",children:e.books_completed}),s.jsx("span",{className:"font-mono text-sm text-foreground",children:e.club_members_total}),s.jsx("span",{className:"font-mono text-sm text-foreground",children:e.clubs_owned}),s.jsx("span",{className:"font-mono text-sm text-foreground",children:e.discussions_count})]},e.user_id)})]})]})}),s.jsx(N,{})]})};export{F 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.