diff --git a/public/ranks/foil.png b/public/ranks/foil.png new file mode 100644 index 0000000..d86f40a Binary files /dev/null and b/public/ranks/foil.png differ diff --git a/public/ranks/glass2.png b/public/ranks/glass2.png new file mode 100644 index 0000000..94bbdbd Binary files /dev/null and b/public/ranks/glass2.png differ diff --git a/public/ranks/gold.png b/public/ranks/gold.png new file mode 100644 index 0000000..a2f035b Binary files /dev/null and b/public/ranks/gold.png differ diff --git a/public/ranks/holo.png b/public/ranks/holo.png new file mode 100644 index 0000000..c94e59c Binary files /dev/null and b/public/ranks/holo.png differ diff --git a/public/ranks/lucky.png b/public/ranks/lucky.png new file mode 100644 index 0000000..aa49177 Binary files /dev/null and b/public/ranks/lucky.png differ diff --git a/public/ranks/negative.png b/public/ranks/negative.png new file mode 100644 index 0000000..16e1b81 Binary files /dev/null and b/public/ranks/negative.png differ diff --git a/public/ranks/poly.png b/public/ranks/poly.png new file mode 100644 index 0000000..320542a Binary files /dev/null and b/public/ranks/poly.png differ diff --git a/public/ranks/steel.png b/public/ranks/steel.png new file mode 100644 index 0000000..cb7dfef Binary files /dev/null and b/public/ranks/steel.png differ diff --git a/public/ranks/stone.png b/public/ranks/stone.png new file mode 100644 index 0000000..ad5416c Binary files /dev/null and b/public/ranks/stone.png differ diff --git a/src/app/_components/leaderboard.tsx b/src/app/_components/leaderboard.tsx index f120e47..7c1d728 100644 --- a/src/app/_components/leaderboard.tsx +++ b/src/app/_components/leaderboard.tsx @@ -13,9 +13,14 @@ import { } from 'react' import { Badge } from '@/components/ui/badge' -import { CardContent } from '@/components/ui/card' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' +import { + Tooltip, + TooltipContent, + TooltipProvider, + TooltipTrigger, +} from '@/components/ui/mobile-tooltip' import { Slider } from '@/components/ui/slider' import { Table, @@ -44,11 +49,70 @@ import { import Link from 'next/link' import { useRouter, useSearchParams } from 'next/navigation' -const getMedal = (rank: number) => { - if (rank === 1) return - if (rank === 2) return - if (rank === 3) return - return null +const RANK_IMAGES = { + foil: '/ranks/foil.png', + glass: '/ranks/glass2.png', + gold: '/ranks/gold.png', + holographic: '/ranks/holo.png', + lucky: '/ranks/lucky.png', + negative: '/ranks/negative.png', + polychrome: '/ranks/poly.png', + steel: '/ranks/steel.png', + stone: '/ranks/stone.png', +} + +const EDITION_THRESHOLD = { + FOIL: 50, + HOLOGRAPHIC: 10, + POLYCHROME: 3, + NEGATIVE: 1, +} + +const ENHANCEMENT_THRESHOLD = { + STEEL: 320, + GOLD: 420, + LUCKY: 560, + GLASS: 880, +} + +const getMedal = (rank: number, mmr: number) => { + let enhancement = RANK_IMAGES.stone + let tooltip = 'Stone' + if (mmr >= ENHANCEMENT_THRESHOLD.STEEL) { + enhancement = RANK_IMAGES.steel + tooltip = 'Steel' + } + if (mmr >= ENHANCEMENT_THRESHOLD.GOLD) { + enhancement = RANK_IMAGES.gold + tooltip = 'Gold' + } + if (mmr >= ENHANCEMENT_THRESHOLD.LUCKY) { + enhancement = RANK_IMAGES.lucky + tooltip = 'Lucky' + } + if (mmr >= ENHANCEMENT_THRESHOLD.GLASS) { + enhancement = RANK_IMAGES.glass + tooltip = 'Glass' + } + + return ( + + + + + {`Rank + + + +

{tooltip}

+
+
+
+ ) } export function LeaderboardPage() { @@ -238,7 +302,7 @@ interface LeaderboardTableProps { sortColumn: string sortDirection: 'asc' | 'desc' onSort: (column: string) => void - getMedal: (rank: number) => React.ReactNode + getMedal: (rank: number, mmr: number) => React.ReactNode } function RawLeaderboardTable({ @@ -398,10 +462,12 @@ function RawLeaderboardTable({ 'transition-colors hover:bg-gray-50 dark:hover:bg-zinc-800/70' )} > - +
- {getMedal(entry.rank)} - {entry.rank} + + {entry.rank} + + {getMedal(entry.rank, entry.mmr)}
@@ -414,8 +480,7 @@ function RawLeaderboardTable({ {entry.streak >= 3 && ( - Can't stop winning - + )}