1import{v as f,r as l,j as e,o as c,w as h,e as m}from"./index-BeS4oe1Y.js";import{S as p}from"./save-CDa3-zMy.js";import{C as u}from"./circle-check-CGkKFyKB.js";function N(){const{settings:a,loading:n}=f(),[s,i]=l.useState(null),[d,o]=l.useState(!1),[b,r]=l.useState(!1);l.useEffect(()=>{n||i({enabled:!!(a!=null&&a.enabled)})},[a,n]);const x=async()=>{o(!0),r(!1);try{a!=null&&a.id?await m.entities.LeaderboardSettings.update(a.id,{enabled:s.enabled}):await m.entities.LeaderboardSettings.create({enabled:s.enabled}),r(!0),setTimeout(()=>r(!1),2500)}catch(t){console.error(t)}finally{o(!1)}};return n||s===null?e.jsx("div",{className:"flex justify-center py-24",children:e.jsx(c,{className:"h-6 w-6 animate-spin text-amber-400"})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"font-display text-2xl font-semibold flex items-center gap-2",children:[e.jsx(h,{className:"h-6 w-6 text-amber-400"})," Leaderboard"]}),e.jsx("p",{className:"text-slate-400 mt-1",children:"Control whether the Collector Leaderboard is visible to users."})]}),e.jsxs("div",{className:"rounded-2xl border border-slate-800 bg-slate-900/40 p-5 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:"Leaderboard enabled"}),e.jsx("p",{className:"text-sm text-slate-400",children:"When off, the leaderboard tab is hidden, the page is unavailable, and the profile opt-in is hidden. Turn on once collection honesty controls are in place."})]}),e.jsx("button",{onClick:()=>i(t=>({...t,enabled:!t.enabled})),className:`relative inline-flex h-7 w-12 items-center rounded-full transition-colors ${s.enabled?"bg-amber-500":"bg-slate-700"}`,"aria-label":"Toggle leaderboard",children:e.jsx("span",{className:`inline-block h-5 w-5 transform rounded-full bg-white transition-transform ${s.enabled?"translate-x-6":"translate-x-1"}`})})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:x,disabled:d,className:"inline-flex items-center gap-2 rounded-lg bg-amber-500 px-4 py-2 text-sm font-semibold text-slate-950 hover:bg-amber-400 disabled:opacity-60",children:[d?e.jsx(c,{className:"h-4 w-4 animate-spin"}):e.jsx(p,{className:"h-4 w-4"})," Save"]}),b&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-sm text-emerald-400",children:[e.jsx(u,{className:"h-4 w-4"})," Saved"]})]})]})}export{N 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.