diff options
author | Ilion Beyst <ilion.beyst@gmail.com> | 2022-10-15 20:23:20 +0200 |
---|---|---|
committer | Ilion Beyst <ilion.beyst@gmail.com> | 2022-10-15 23:28:36 +0200 |
commit | 8feccfeb234b69b1069d6b972f13b77ee2c0459f (patch) | |
tree | fce00b2e7eed89813f0932b4fba3ed1e4ff692da /web/pw-server/src/routes | |
parent | b51b7a331ddfd93675e93d88cf267494b9c1b083 (diff) | |
download | planetwars.dev-8feccfeb234b69b1069d6b972f13b77ee2c0459f.tar.xz planetwars.dev-8feccfeb234b69b1069d6b972f13b77ee2c0459f.zip |
show player logs on view match page
Diffstat (limited to 'web/pw-server/src/routes')
-rw-r--r-- | web/pw-server/src/routes/editor.svelte | 1 | ||||
-rw-r--r-- | web/pw-server/src/routes/matches/[match_id].svelte | 42 |
2 files changed, 42 insertions, 1 deletions
diff --git a/web/pw-server/src/routes/editor.svelte b/web/pw-server/src/routes/editor.svelte index ff8232c..ee4eef9 100644 --- a/web/pw-server/src/routes/editor.svelte +++ b/web/pw-server/src/routes/editor.svelte @@ -12,7 +12,6 @@ import { debounce } from "$lib/utils"; import SubmitPane from "$lib/components/SubmitPane.svelte"; import OutputPane from "$lib/components/OutputPane.svelte"; - import BotName from "./bots/[bot_name].svelte"; enum ViewMode { Editor, diff --git a/web/pw-server/src/routes/matches/[match_id].svelte b/web/pw-server/src/routes/matches/[match_id].svelte index 11d6ee3..25438ad 100644 --- a/web/pw-server/src/routes/matches/[match_id].svelte +++ b/web/pw-server/src/routes/matches/[match_id].svelte @@ -22,6 +22,9 @@ <script lang="ts"> import { onMount } from "svelte"; import Visualizer from "$lib/components/Visualizer.svelte"; + import PlayerLog from "$lib/components/PlayerLog.svelte"; + import Select from "svelte-select"; + import { PLAYER_COLORS } from "$lib/constants"; export let matchLog: string | undefined; export let matchData: object; @@ -30,13 +33,35 @@ const apiClient = new ApiClient(); matchLog = await apiClient.getText(`/api/matches/${matchData["id"]}/log`); }); + + let selectedPlayer; + + $: matchPlayerSelectItems = matchData["players"].map((player: any, index: number) => ({ + color: PLAYER_COLORS[index], + value: index, + playerId: index + 1, // stoopid player number + 1 + label: player["bot_name"], + })); </script> <div class="container"> <Visualizer {matchLog} {matchData} /> + <div class="output-pane"> + <div class="player-select"> + <Select items={matchPlayerSelectItems} clearable={false} bind:value={selectedPlayer}> + <div slot="item" let:item> + <span style:color={item.color}>{item.label}</span> + </div> + </Select> + </div> + <div class="player-log"> + <PlayerLog {matchLog} playerId={selectedPlayer?.playerId} /> + </div> + </div> </div> <style lang="scss"> + @use "src/styles/variables"; .container { display: flex; // these are needed for making the visualizer fill the screen. @@ -44,4 +69,21 @@ flex-grow: 1; overflow: hidden; } + + .player-select { + padding: 20px; + } + + .player-log { + padding: 15px; + overflow-y: scroll; + } + + .output-pane { + width: 600px; + // overflow: hidden; + display: flex; + flex-direction: column; + background-color: variables.$bg-color; + } </style> |