aboutsummaryrefslogtreecommitdiff
path: root/web/pw-server/src/lib/components/OutputPane.svelte
diff options
context:
space:
mode:
Diffstat (limited to 'web/pw-server/src/lib/components/OutputPane.svelte')
-rw-r--r--web/pw-server/src/lib/components/OutputPane.svelte48
1 files changed, 48 insertions, 0 deletions
diff --git a/web/pw-server/src/lib/components/OutputPane.svelte b/web/pw-server/src/lib/components/OutputPane.svelte
new file mode 100644
index 0000000..c72a22e
--- /dev/null
+++ b/web/pw-server/src/lib/components/OutputPane.svelte
@@ -0,0 +1,48 @@
+<script lang="ts">
+ export let matchLog: string;
+
+ function getStdErr(log: string, botId: number): string {
+ let output = [];
+ log
+ .split("\n")
+ .slice(0, -1)
+ .forEach((line) => {
+ let message = JSON.parse(line);
+ if (message["type"] === "stderr" && message["player_id"] === botId) {
+ output.push(message["message"]);
+ }
+ });
+ return output.join("\n");
+ }
+
+ $: botStdErr = getStdErr(matchLog, 1);
+</script>
+
+<div class="output">
+ {#if botStdErr.length > 0}
+ <h3 class="output-header">stderr:</h3>
+ <div class="output-text">
+ {botStdErr}
+ </div>
+ {/if}
+</div>
+
+<style lang="scss">
+ .output {
+ width: 100%;
+ overflow-y: scroll;
+ background-color: rgb(41, 41, 41);
+ padding: 15px;
+ }
+
+ .output-text {
+ color: #ccc;
+ font-family: monospace;
+ white-space: pre-wrap;
+ }
+
+ .output-header {
+ color: #eee;
+ padding-bottom: 20px;
+ }
+</style>