blob: 450fdf24387fd00e60d62a1897730250b721e139 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
<script lang="ts">
import { parsePlayerLog, PlayerLog } from "$lib/log_parser";
import LogTurn from "./LogTurn.svelte";
export let matchLog: string;
export let playerId: number;
let playerLog: PlayerLog;
let showRawStderr = false;
$: if (matchLog) {
playerLog = parsePlayerLog(playerId, matchLog);
} else {
playerLog = [];
}
</script>
<div class="output">
{#if showRawStderr}
<div class="output-text stderr-text">
{playerLog.flatMap((turn) => turn.stderr).join("\n")}
</div>
{:else}
<!-- The log should be rerendered when playerId changes -->
{#key playerId}
<div class="log-contents">
{#each playerLog as logTurn, turnNum}
<LogTurn {logTurn} {turnNum} />
{/each}
</div>
{/key}
{/if}
</div>
<style lang="scss">
.output {
background-color: rgb(41, 41, 41);
}
</style>
|