import{j as e}from"./vendor-motion-D282nMnh.js";import{a as d}from"./vendor-icons-C0JR74dJ.js";import{i as o,j as c,L as x,B as m,C as p,T as b,f as g,c as u}from"./index-DemuRWa7.js";import"./vendor-react-7wvOsoTm.js";function w(){const[s,i]=d.useState(""),r=o(),a=c(s||void 0);if(a._loading)return e.jsx(x,{label:"Loading leaderboard…"});const l=a.top;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-lg font-bold",children:a.title||"Leaderboard"}),e.jsxs("div",{className:"flex items-center gap-3",children:[r.views.length>0&&e.jsxs("div",{className:"flex gap-1",children:[e.jsx("button",{onClick:()=>i(""),className:`px-3 py-1 rounded text-xs font-medium transition-colors ${s?"bg-gray-700 text-gray-300 hover:bg-gray-600":"bg-purple-600 text-white"}`,children:"All"}),r.views.map(t=>e.jsx("button",{onClick:()=>i(t),className:`px-3 py-1 rounded text-xs font-medium capitalize transition-colors ${s===t?"bg-purple-600 text-white":"bg-gray-700 text-gray-300 hover:bg-gray-600"}`,children:t},t))]}),e.jsxs(m,{color:"purple",children:[l.length," entries"]})]})]}),e.jsx(p,{children:e.jsx(b,{columns:[{key:"rank",label:"#",w:"40px"},{key:"idea_id",label:"Idea"},{key:"title",label:"Title"},{key:"metric",label:a.metric||"Metric"},{key:"time",label:"Training Time"}],rows:l.map((t,n)=>({rank:e.jsx("span",{className:n<3?"text-amber-400 font-bold":"",children:n+1}),idea_id:e.jsx(u,{ideaId:t.idea_id}),title:e.jsx("span",{className:"text-xs text-gray-400 truncate block max-w-[300px]",children:t.title||"-"}),metric:e.jsx("span",{className:"font-mono text-emerald-400",children:typeof t.metric_value=="number"?t.metric_value.toFixed(4):"-"}),time:e.jsx("span",{className:"text-xs text-gray-500",children:t.training_time?g(t.training_time/60):"-"})}))})})]})}export{w as default};
