mirror of https://github.com/hykilpikonna/AquaDX
[F] Fix ranking typing
parent
37f67469a6
commit
ece64c3f4a
|
@ -46,12 +46,11 @@ h1
|
|||
|
||||
|
||||
blockquote
|
||||
//background: rgba(255, 210, 210, .1)
|
||||
$c1: rgba(255, 149, 149, 0.05)
|
||||
$c2: rgba(255, 152, 152, 0.12)
|
||||
background: repeating-linear-gradient(45deg, $c1, $c1 10px, $c2 10px, $c2 20px)
|
||||
padding: 10px 20px 10px 20px
|
||||
margin: 0
|
||||
margin: 16px 0
|
||||
border-left: solid #ff7c7c 3px
|
||||
border-radius: 5px
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ export interface UserMe {
|
|||
emailConfirmed: boolean
|
||||
ghostCard: Card
|
||||
cards: Card[]
|
||||
computedName: string
|
||||
computedName: string,
|
||||
}
|
||||
|
||||
export interface CardSummaryGame {
|
||||
|
|
|
@ -1,5 +1,14 @@
|
|||
import { AQUA_HOST, DATA_HOST } from "./config";
|
||||
import type { AllMusic, Card, CardSummary, GenericGameSummary, MusicMeta, TrendEntry, UserMe } from "./generalTypes";
|
||||
import type {
|
||||
AllMusic,
|
||||
Card,
|
||||
CardSummary,
|
||||
GenericGameSummary,
|
||||
GenericRanking,
|
||||
MusicMeta,
|
||||
TrendEntry,
|
||||
UserMe
|
||||
} from "./generalTypes";
|
||||
import type { GameName } from "./scoring";
|
||||
|
||||
interface RequestInitWithParams extends RequestInit {
|
||||
|
@ -119,7 +128,7 @@ export const GAME = {
|
|||
post(`/api/v2/game/${game}/trend`, { username }),
|
||||
userSummary: (username: string, game: GameName): Promise<GenericGameSummary> =>
|
||||
post(`/api/v2/game/${game}/user-summary`, { username }),
|
||||
ranking: (game: GameName): Promise<GenericGameSummary> =>
|
||||
ranking: (game: GameName): Promise<GenericRanking[]> =>
|
||||
post(`/api/v2/game/${game}/ranking`, { }),
|
||||
|
||||
}
|
||||
|
|
|
@ -1,38 +1,34 @@
|
|||
<script lang="ts">
|
||||
import {CHARTJS_OPT, clz, registerChart, renderCal, title} from "../libs/ui";
|
||||
import { DATA, GAME } from "../libs/sdk";
|
||||
import type { GenericRanking } from "../libs/generalTypes";
|
||||
title(`Ranking`)
|
||||
import { title } from "../libs/ui";
|
||||
import { GAME } from "../libs/sdk";
|
||||
import type { GenericRanking } from "../libs/generalTypes";
|
||||
|
||||
let d: {
|
||||
user: GenericRanking
|
||||
} | null = null
|
||||
title(`Ranking`)
|
||||
|
||||
let d: { users: GenericRanking[] }
|
||||
|
||||
Promise.all([
|
||||
GAME.ranking('mai2')
|
||||
]).then(([user]) => {
|
||||
console.log(user)
|
||||
|
||||
d = {user}
|
||||
localStorage.setItem("tmp-ranking-details", JSON.stringify(d))
|
||||
]).then(([ users ]) => {
|
||||
d = { users }
|
||||
})
|
||||
</script>
|
||||
|
||||
<main class="content">
|
||||
<h2>Global Leaderboard</h2>
|
||||
<h2>Global Leaderboard</h2>
|
||||
|
||||
{#if d !== null}
|
||||
{#each d.user as user}
|
||||
<div class="lb-placement">
|
||||
{#if d}
|
||||
{#each d.users as user}
|
||||
<div class="lb-placement">
|
||||
<p class="placement-rank">{user.rank}</p>
|
||||
<h4 class="placement-name">{user.name}</h4>
|
||||
<h4 class="placement-accuracy">{(user.accuracy / 1).toFixed(2)}%</h4>
|
||||
<h4 class="placement-accuracy">{(+user.accuracy).toFixed(2)}%</h4>
|
||||
<h4 class="placement-rating">{user.rating}</h4>
|
||||
<h4 class="placement-full-combo">{user.fullCombo}</h4>
|
||||
<h4 class="placement-all-perfect">{user.allPerfect}</h4>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
{:else}
|
||||
{:else}
|
||||
<p>Please Wait...</p>
|
||||
{/if}
|
||||
{/if}
|
||||
</main>
|
Loading…
Reference in New Issue