From 42c8efb4f3b8faffdd82d407e3cad3768be01ef4 Mon Sep 17 00:00:00 2001
From: mat <github@matdoes.dev>
Date: Tue, 22 Feb 2022 19:16:09 +0000
Subject: add leaderboards

---
 src/lib/sections/Leaderboards.svelte | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 create mode 100644 src/lib/sections/Leaderboards.svelte

(limited to 'src/lib/sections/Leaderboards.svelte')

diff --git a/src/lib/sections/Leaderboards.svelte b/src/lib/sections/Leaderboards.svelte
new file mode 100644
index 0000000..69b586e
--- /dev/null
+++ b/src/lib/sections/Leaderboards.svelte
@@ -0,0 +1,22 @@
+<script lang="ts">
+	import { API_URL } from '$lib/api'
+
+	import type { CleanMemberProfile } from '$lib/APITypes'
+	import { cleanId } from '$lib/utils'
+
+	export let data: CleanMemberProfile
+</script>
+
+{#await fetch(`${API_URL}player/${data.member.uuid}/${data.profile.uuid}/leaderboards`).then( r => r.json() )}
+	Loading...
+{:then leaderboards}
+	<ul>
+		{#each leaderboards as leaderboard}
+			<li class="leaderboard-item">
+				<a href="/leaderboard/{leaderboard.name}" class="leaderboard-item-anchor">
+					{leaderboard.positionIndex}) <b>{cleanId(leaderboard.name)}</b>: {leaderboard.value}
+				</a>
+			</li>
+		{/each}
+	</ul>
+{/await}
-- 
cgit 

