2024-02-29 13:55:46 +08:00
|
|
|
<script lang="ts">
|
2024-03-01 00:07:44 +08:00
|
|
|
import { clz, title } from "../libs/ui";
|
2024-02-29 23:42:22 +08:00
|
|
|
import { GAME } from "../libs/sdk";
|
|
|
|
import type { GenericRanking } from "../libs/generalTypes";
|
2024-03-01 11:48:41 +08:00
|
|
|
import ErrorMessage from "../ErrorMessage.svelte";
|
|
|
|
|
|
|
|
title(`Ranking`);
|
|
|
|
|
|
|
|
let d: { users: GenericRanking[] };
|
|
|
|
let ifError = null;
|
|
|
|
Promise.all([GAME.ranking("mai2")])
|
|
|
|
.then(([users]) => {
|
|
|
|
d = { users };
|
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
ifError = error;
|
|
|
|
});
|
2024-02-29 13:55:46 +08:00
|
|
|
</script>
|
|
|
|
|
2024-03-01 00:07:44 +08:00
|
|
|
<main class="content leaderboard">
|
2024-02-29 23:42:22 +08:00
|
|
|
<h2>Global Leaderboard</h2>
|
2024-02-29 13:55:46 +08:00
|
|
|
|
2024-02-29 23:42:22 +08:00
|
|
|
{#if d}
|
2024-03-01 00:07:44 +08:00
|
|
|
<div class="leaderboard-container">
|
|
|
|
<div class="lb-user">
|
|
|
|
<span class="rank"></span>
|
|
|
|
<span class="name"></span>
|
|
|
|
<span class="rating">Rating</span>
|
|
|
|
<span class="accuracy">Accuracy</span>
|
|
|
|
<span class="fc">FC</span>
|
|
|
|
<span class="ap">AP</span>
|
2024-02-29 23:42:22 +08:00
|
|
|
</div>
|
2024-03-01 00:07:44 +08:00
|
|
|
{#each d.users as user, i (user.rank)}
|
2024-03-01 11:48:41 +08:00
|
|
|
<div class={clz({ alternate: i % 2 === 1 }, "lb-user")}>
|
2024-03-01 00:07:44 +08:00
|
|
|
<span class="rank">#{user.rank}</span>
|
2024-03-01 11:48:41 +08:00
|
|
|
<a class="name" href="/u/61702139">{user.name}</a>
|
2024-03-01 00:07:44 +08:00
|
|
|
<span class="rating">{user.rating.toLocaleString()}</span>
|
|
|
|
<span class="accuracy">{(+user.accuracy).toFixed(2)}%</span>
|
|
|
|
<span class="fc">{user.fullCombo}</span>
|
|
|
|
<span class="ap">{user.allPerfect}</span>
|
|
|
|
</div>
|
|
|
|
{/each}
|
|
|
|
</div>
|
2024-03-01 11:48:41 +08:00
|
|
|
{:else if ifError}
|
|
|
|
<ErrorMessage {ifError}/>
|
2024-02-29 23:42:22 +08:00
|
|
|
{:else}
|
2024-02-29 13:55:46 +08:00
|
|
|
<p>Please Wait...</p>
|
2024-02-29 23:42:22 +08:00
|
|
|
{/if}
|
2024-03-01 00:07:44 +08:00
|
|
|
</main>
|
|
|
|
|
|
|
|
<style lang="sass">
|
|
|
|
@import "../vars"
|
|
|
|
|
|
|
|
.leaderboard-container
|
|
|
|
display: flex
|
|
|
|
flex-direction: column
|
|
|
|
|
|
|
|
.lb-user
|
|
|
|
display: flex
|
|
|
|
align-items: center
|
|
|
|
justify-content: space-between
|
|
|
|
width: 100%
|
|
|
|
gap: 12px
|
|
|
|
border-radius: 12px
|
|
|
|
padding: 6px 12px
|
|
|
|
box-sizing: border-box
|
|
|
|
|
|
|
|
> *:not(.name)
|
|
|
|
text-align: center
|
|
|
|
|
|
|
|
.name
|
|
|
|
min-width: 100px
|
|
|
|
flex: 1
|
|
|
|
|
|
|
|
.accuracy, .rating
|
|
|
|
width: 15%
|
|
|
|
min-width: 45px
|
|
|
|
|
|
|
|
.rating
|
|
|
|
font-weight: bold
|
|
|
|
color: white
|
|
|
|
|
|
|
|
.fc, .ap
|
|
|
|
width: 5%
|
|
|
|
min-width: 20px
|
|
|
|
|
|
|
|
@media (max-width: $w-mobile)
|
|
|
|
font-size: 0.9rem
|
|
|
|
|
|
|
|
.accuracy
|
|
|
|
display: none
|
|
|
|
|
|
|
|
&.alternate
|
|
|
|
background-color: $ov-light
|
2024-03-01 11:48:41 +08:00
|
|
|
</style>
|