Compare commits
6 Commits
c11279ba21
...
3a71072bc9
Author | SHA1 | Date | |
---|---|---|---|
3a71072bc9 | |||
ded50f8780 | |||
dc3b9ffc53 | |||
bab359c212 | |||
ee79599978 | |||
7cd4574580 |
@ -7,6 +7,13 @@
|
|||||||
import type { Room } from './types';
|
import type { Room } from './types';
|
||||||
|
|
||||||
let { room }: { room: Room } = $props();
|
let { room }: { room: Room } = $props();
|
||||||
|
|
||||||
|
let secondsRemaining = $state(room.secondsRemaining);
|
||||||
|
|
||||||
|
const interval = setInterval(() => {
|
||||||
|
if (secondsRemaining <= 0 || room.finished) clearInterval(interval);
|
||||||
|
secondsRemaining--;
|
||||||
|
}, 1000);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex flex-col gap-8 rounded-lg bg-medium p-6">
|
<div class="flex flex-col gap-8 rounded-lg bg-medium p-6">
|
||||||
@ -24,6 +31,9 @@
|
|||||||
room battle rank <Separator />
|
room battle rank <Separator />
|
||||||
{room.roomBattleRank}
|
{room.roomBattleRank}
|
||||||
</p>
|
</p>
|
||||||
|
{#if !room.finished}
|
||||||
|
<p class="flex items-center gap-2">seconds remaining <Separator /> {secondsRemaining}s</p>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1 +1,3 @@
|
|||||||
<div class="inline-block h-[2px] w-4 rounded-full bg-current brightness-50"></div>
|
<span class="inline-block"
|
||||||
|
><div class="h-[2px] w-4 rounded-full bg-current brightness-50"></div></span
|
||||||
|
>
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
{team.name}
|
{team.name}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{#if team.rank <= 5}
|
{#if team.rank <= 5 && team.rank !== 0}
|
||||||
<p class="font-bold">
|
<p class="font-bold">
|
||||||
#{team.rank}
|
#{team.rank}
|
||||||
</p>
|
</p>
|
||||||
|
@ -25,6 +25,8 @@ function toRoom(apiRoom: APIRoom): Room {
|
|||||||
createdAt: new Date(apiRoom.updatedAt),
|
createdAt: new Date(apiRoom.updatedAt),
|
||||||
gameVersion: apiRoom.dataVersion,
|
gameVersion: apiRoom.dataVersion,
|
||||||
roomBattleRank: apiRoom.roomRanking,
|
roomBattleRank: apiRoom.roomRanking,
|
||||||
|
secondsRemaining: apiRoom.restMSec,
|
||||||
|
finished: apiRoom.isFinished,
|
||||||
players: apiRoom.matchingMemberInfoList.map((apiPlayer) => toPlayer(apiPlayer))
|
players: apiRoom.matchingMemberInfoList.map((apiPlayer) => toPlayer(apiPlayer))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,8 @@ export interface Room {
|
|||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
gameVersion: string;
|
gameVersion: string;
|
||||||
roomBattleRank: number;
|
roomBattleRank: number;
|
||||||
|
secondsRemaining: number;
|
||||||
|
finished: boolean;
|
||||||
players: Player[];
|
players: Player[];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +71,7 @@ export interface APIRoom {
|
|||||||
dataVersion: string;
|
dataVersion: string;
|
||||||
romVersion: string;
|
romVersion: string;
|
||||||
roomRanking: number;
|
roomRanking: number;
|
||||||
roomMSec: number;
|
restMSec: number;
|
||||||
isFull: boolean;
|
isFull: boolean;
|
||||||
matchingMemberInfoList: APIPlayer[];
|
matchingMemberInfoList: APIPlayer[];
|
||||||
isFinished: boolean;
|
isFinished: boolean;
|
||||||
|
@ -1,26 +1,18 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { arrayPadEnd } from '$lib/array';
|
import { arrayPadEnd } from '$lib/array';
|
||||||
import Room from '$lib/Room.svelte';
|
import Room from '$lib/Room.svelte';
|
||||||
import axios from 'axios';
|
|
||||||
import type { PageData } from './$types';
|
import type { PageData } from './$types';
|
||||||
|
|
||||||
let props: { data: PageData } = $props();
|
let props: { data: PageData } = $props();
|
||||||
|
|
||||||
let data = $state(props.data);
|
let data = $state(props.data);
|
||||||
let refreshTimer = $state(60);
|
|
||||||
|
|
||||||
async function refresh() {
|
data.archivedRooms.forEach((archivedRoom) =>
|
||||||
data = await axios.get('/api/data').then((result) => result.data);
|
arrayPadEnd(archivedRoom.players, 4, {
|
||||||
}
|
name: 'CPU',
|
||||||
|
battleRank: 0,
|
||||||
$effect(() =>
|
rating: 0
|
||||||
data.archivedRooms.forEach((archivedRoom) =>
|
})
|
||||||
arrayPadEnd(archivedRoom.players, 4, {
|
|
||||||
name: 'CPU',
|
|
||||||
battleRank: 0,
|
|
||||||
rating: 0
|
|
||||||
})
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@ -28,11 +20,8 @@
|
|||||||
<section>
|
<section>
|
||||||
<h1 class="text-4xl font-bold">yukiotoko webui</h1>
|
<h1 class="text-4xl font-bold">yukiotoko webui</h1>
|
||||||
<p>a frontend redesign for <a href="http://yukiotoko.chara.lol/">yukiotoko</a></p>
|
<p>a frontend redesign for <a href="http://yukiotoko.chara.lol/">yukiotoko</a></p>
|
||||||
|
<p class="text-sub">refresh the page to fetch newer yukiotoko data</p>
|
||||||
</section>
|
</section>
|
||||||
<div>
|
|
||||||
<button class="bg-accent rounded-lg px-3 py-2" onclick={refresh}>Refresh</button>
|
|
||||||
<p class="text-sub">load the current data from yukiotoko</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col gap-8">
|
<div class="flex flex-col gap-8">
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
import { fetchData } from '$lib/server/fetchData';
|
|
||||||
|
|
||||||
export async function GET({}) {
|
|
||||||
return new Response(JSON.stringify(await fetchData()));
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user