const { useState: useStateL, useMemo: useMemoL } = React; function LeaderboardPage({ onOpenProfile }) { const [tab, setTab] = useStateL("all"); const sorted = useMemoL(() => { const arr = [...DB.players]; if (tab === "tarneeb") arr.sort((a,b) => b.tarneeb - a.tarneeb); else if (tab === "trix") arr.sort((a,b) => b.trix - a.trix); else arr.sort((a,b) => b.wins - a.wins); return arr; }, [tab, DB.players]); return (
لوحة السماور
طرنيب · تركس · لا رحمة
{DB.matches.length}
مباراة
{[{ id: "all", label: "الكل" }, { id: "tarneeb", label: "طرنيب" }, { id: "trix", label: "تركس" }].map(t => (
setTab(t.id)}>{t.label}
))}
{sorted.map((p, i) => ( onOpenProfile(p.id)} /> ))}
{DB.loading && (
جاري التحديث…
)}
); } Object.assign(window, { LeaderboardPage });