aboutsummaryrefslogtreecommitdiff
path: root/src/routes/leaderboards/+page.svelte
blob: 1d66ef59fb0e2a355ad9b598cd645d78dee1935f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<script lang="ts">
	import Header from '$lib/Header.svelte'
	import Head from '$lib/Head.svelte'
	import Toc from '$lib/Toc.svelte'
	import Collapsible from '$lib/Collapsible.svelte'
	import { skyblockItemToUrl } from '$lib/minecraft/inventory'
	import { cleanId } from '$lib/utils'
	import ListItemWithIcon from '$lib/ListItemWithIcon.svelte'

	export let data: { [category: string]: string[] }
</script>

<Head title="Hypixel SkyBlock Leaderboards" />
<Header />

<main>
	<h1>SkyBlock Leaderboards</h1>
	<Toc categories={Object.keys(data)} />

	{#each Object.entries(data) as [category, leaderboards]}
		<section>
			<Collapsible id={category} lazy={false}>
				<ul>
					{#each leaderboards as leaderboard}
						{@const imageUrl = leaderboard.startsWith('collection_')
							? skyblockItemToUrl(leaderboard.slice(11))
							: null}
						{#if imageUrl}
							<ListItemWithIcon src={imageUrl}>
								<a href="/leaderboards/{leaderboard}">{cleanId(leaderboard)}</a>
							</ListItemWithIcon>
						{:else}
							<li><a href="/leaderboards/{leaderboard}">{cleanId(leaderboard)}</a></li>
						{/if}
					{/each}
				</ul>
			</Collapsible>
		</section>
	{/each}
</main>