-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from QPixel/id-page
Id page
- Loading branch information
Showing
10 changed files
with
228 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,5 @@ pnpm-debug.log* | |
# macOS-specific files | ||
.DS_Store | ||
|
||
.vercel | ||
.vercel | ||
.env*.local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
<script lang="ts"> | ||
import { leaderboard_store } from "./get-leaderboard"; | ||
export let serverData: any; | ||
leaderboard_store.init(serverData); | ||
</script> | ||
|
||
{#await leaderboard_store.init()} | ||
<p>Loading</p> | ||
{:then} | ||
{#if $leaderboard_store.length !== 0} | ||
<div class="space-y-4"> | ||
<ol class="divide-solid divide-y border-2 rounded-lg p-2"> | ||
{#each $leaderboard_store as player, i} | ||
<li class="text-xl p-2"> | ||
{i + 1}. {player.resolved_username} - {player.total} | ||
</li> | ||
{/each} | ||
</ol> | ||
</div> | ||
{:else} | ||
<p>No players have been added to the leaderboard yet.</p> | ||
{/if} | ||
{:catch error} | ||
<p class="text-red-500">{error.message}</p> | ||
{/await} | ||
{#if $leaderboard_store.length !== 0} | ||
<div class="space-y-4"> | ||
<ol class="divide-solid divide-y border-2 rounded-lg p-2"> | ||
{#each $leaderboard_store as player, i} | ||
<li class="text-xl p-2"> | ||
{i + 1}. {player.resolved_username} - {player.total} | ||
</li> | ||
{/each} | ||
</ol> | ||
</div> | ||
{:else} | ||
<p>No players have been added to the leaderboard yet.</p> | ||
{/if} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
--- | ||
import "../styles/global.css"; | ||
import { | ||
Card, | ||
CardContent, | ||
CardTitle, | ||
CardHeader, | ||
} from "$lib/components/ui/card"; | ||
import Counter from "$lib/components/counter.svelte"; | ||
import Leaderboard from "$lib/components/leaderboard.svelte"; | ||
import { getCounterData } from "./api/counter"; | ||
import { getLeaderboard } from "./api/leaderboard"; | ||
import SpeedInsights from "@vercel/speed-insights/astro"; | ||
const { id } = Astro.params; | ||
if (typeof id !== "undefined") { | ||
if (isNaN(parseInt(id))) { | ||
return new Response("Invalid ID", { status: 400 }); | ||
} | ||
} | ||
const counterData = await getCounterData(); | ||
const leaderboardData = await getLeaderboard(); | ||
--- | ||
|
||
<html lang="en" class="dark"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" /> | ||
<meta name="viewport" content="width=device-width" /> | ||
<meta name="generator" content={Astro.generator} /> | ||
<title>Womp Womp</title> | ||
</head> | ||
<body class="bg-background min-h-screen w-full"> | ||
<main | ||
class="min-h-screen flex md:justify-center items-center flex-col max-w-lg p-2 mx-auto" | ||
> | ||
<header class="text-left mt-16"> | ||
<h1 class="font-semibold text-3xl">The Womp Womp Counter</h1> | ||
</header> | ||
<div class="h-full w-full space-y-5 mt-5"> | ||
<Card class="w-full"> | ||
<CardContent class="pt-6"> | ||
<Counter | ||
client:load | ||
isAuthed={typeof id !== "undefined"} | ||
id={parseInt(id!)} | ||
serverData={counterData} | ||
/> | ||
</CardContent> | ||
</Card> | ||
<Card class="w-full"> | ||
<CardHeader> | ||
<CardTitle class={"text-4xl"}>Leaderboard</CardTitle> | ||
</CardHeader> | ||
<CardContent> | ||
<Leaderboard client:load serverData={leaderboardData} /> | ||
</CardContent> | ||
</Card> | ||
</div> | ||
</main> | ||
<SpeedInsights /> | ||
</body> | ||
</html> |
Oops, something went wrong.