From 0e65f04e1e780865f80660df315e800e6b0cbccd Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Tue, 1 Nov 2022 22:36:19 +0100 Subject: move bot versions to its own tab --- .../src/routes/bots/[bot_name]/__layout.svelte | 5 ++ .../src/routes/bots/[bot_name]/index.svelte | 43 ----------- .../src/routes/bots/[bot_name]/versions.svelte | 85 ++++++++++++++++++++++ 3 files changed, 90 insertions(+), 43 deletions(-) create mode 100644 web/pw-server/src/routes/bots/[bot_name]/versions.svelte (limited to 'web/pw-server') diff --git a/web/pw-server/src/routes/bots/[bot_name]/__layout.svelte b/web/pw-server/src/routes/bots/[bot_name]/__layout.svelte index baa8f99..f445cbb 100644 --- a/web/pw-server/src/routes/bots/[bot_name]/__layout.svelte +++ b/web/pw-server/src/routes/bots/[bot_name]/__layout.svelte @@ -16,6 +16,8 @@ @@ -36,6 +38,9 @@ index matches stats + {#if $currentUser && $currentUser["user_id"] === bot["owner_id"]} + versions + {/if} 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 afe2cc7..ae38d13 100644 --- a/web/pw-server/src/routes/bots/[bot_name]/index.svelte +++ b/web/pw-server/src/routes/bots/[bot_name]/index.svelte @@ -20,8 +20,6 @@ return { props: { bot, - owner, - versions, botStats, matches: matchesPage["matches"], errorMatches: errorMatchesPage["matches"], @@ -43,8 +41,6 @@ import LinkButton from "$lib/components/LinkButton.svelte"; export let bot: object; - export let owner: object; - export let versions: object[]; export let matches: object[]; export let errorMatches: object[]; @@ -58,31 +54,6 @@
{#if $currentUser && $currentUser["user_id"] === bot["owner_id"]} -
- - Publish a new version by pushing a docker container to - registry.planetwars.dev/{bot["name"]}:latest, or using the web editor. -
- -
-

Versions

-
    - {#each versions.slice(0, 10) as version} -
  • - {dayjs(version["created_at"]).format("YYYY-MM-DD HH:mm")} - {#if version["container_digest"]} - {version["container_digest"]} - {:else} - view code - {/if} -
  • - {/each} -
- {#if versions.length == 0} - This bot does not have any versions yet. - {/if} -
-

Matches with errors

@@ -126,18 +97,4 @@ padding: 12px; text-align: center; } - - .versions { - margin: 30px 0; - } - - .version-list { - padding: 0; - } - - .bot-version { - display: flex; - justify-content: space-between; - padding: 4px 24px; - } diff --git a/web/pw-server/src/routes/bots/[bot_name]/versions.svelte b/web/pw-server/src/routes/bots/[bot_name]/versions.svelte new file mode 100644 index 0000000..73f891f --- /dev/null +++ b/web/pw-server/src/routes/bots/[bot_name]/versions.svelte @@ -0,0 +1,85 @@ + + + + + +
+
+ + Publish a new version by pushing a docker container to + registry.planetwars.dev/{bot["name"]}:latest, or using the web editor. +
+ +
+

Versions

+
    + {#each versions as version} +
  • + {dayjs(version["created_at"]).format("YYYY-MM-DD HH:mm")} + {#if version["container_digest"]} + {version["container_digest"]} + {:else} + view code + {/if} +
  • + {/each} +
+ {#if versions.length == 0} + This bot does not have any versions yet. + {/if} +
+
+ + -- cgit v1.2.3