From 06a8ed945b4c517bb6cf5c84f0d06aa9ede37f11 Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Mon, 31 Oct 2022 20:31:03 +0100 Subject: [PATCH] tabbed bot page --- .../routes/bots/[bot_name]/__layout.svelte | 87 +++++++++++++++++++ .../src/routes/bots/[bot_name]/index.svelte | 31 ------- .../src/routes/bots/[bot_name]/stats.svelte | 17 +--- 3 files changed, 90 insertions(+), 45 deletions(-) create mode 100644 web/pw-server/src/routes/bots/[bot_name]/__layout.svelte diff --git a/web/pw-server/src/routes/bots/[bot_name]/__layout.svelte b/web/pw-server/src/routes/bots/[bot_name]/__layout.svelte new file mode 100644 index 0000000..baa8f99 --- /dev/null +++ b/web/pw-server/src/routes/bots/[bot_name]/__layout.svelte @@ -0,0 +1,87 @@ + + + + +
+
+

{bot["name"]}

+ {#if owner} + + by + + {owner["username"]} + + + {/if} +
+
+ index + matches + stats +
+
+ + + diff --git a/web/pw-server/src/routes/bots/[bot_name]/index.svelte b/web/pw-server/src/routes/bots/[bot_name]/index.svelte index a5934b6..afe2cc7 100644 --- a/web/pw-server/src/routes/bots/[bot_name]/index.svelte +++ b/web/pw-server/src/routes/bots/[bot_name]/index.svelte @@ -57,15 +57,6 @@ -->
-
-

{bot["name"]}

- {#if owner} - - {owner["username"]} - - {/if} -
- {#if $currentUser && $currentUser["user_id"] === bot["owner_id"]}
@@ -126,28 +117,6 @@ padding-bottom: 24px; } - .header { - display: flex; - justify-content: space-between; - align-items: flex-end; - margin-bottom: 60px; - border-bottom: 1px solid black; - } - - $header-space-above-line: 12px; - - .bot-name { - font-size: 24pt; - margin-bottom: $header-space-above-line; - } - - .owner-name { - font-size: 14pt; - text-decoration: none; - color: #333; - margin-bottom: $header-space-above-line; - } - .btn-container { padding: 24px; text-align: center; diff --git a/web/pw-server/src/routes/bots/[bot_name]/stats.svelte b/web/pw-server/src/routes/bots/[bot_name]/stats.svelte index 6b5a2e1..67b769f 100644 --- a/web/pw-server/src/routes/bots/[bot_name]/stats.svelte +++ b/web/pw-server/src/routes/bots/[bot_name]/stats.svelte @@ -12,11 +12,10 @@ apiClient.get("/api/leaderboard"), ]); - const { bot, owner } = botData; + const { bot } = botData; return { props: { bot, - owner, botStats, leaderboard, }, @@ -29,7 +28,7 @@ } } - function mergedStats(rawStats: object) { + function calcMergedStats(rawStats: object) { return Object.fromEntries( Object.entries(rawStats).map(([opponent, ms]) => { const mapStats = ms as { k: MatchupStats }; @@ -59,23 +58,13 @@
-
-

{bot["name"]}

- {#if owner} - - {owner["username"]} - - {/if} -
-

Stats

Rank