From 003c551e7320912d468b00905da234ad262b5446 Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Sat, 25 Dec 2021 20:28:10 +0100 Subject: implement basic MatchBrowser component --- web/pw-frontend/src/App.svelte | 37 +----------- web/pw-frontend/src/assets/svelte.png | Bin 5185 -> 0 bytes web/pw-frontend/src/lib/MatchBrowser.svelte | 89 ++++++++++++++++++++++++++++ web/pw-frontend/src/lib/Visualizer.svelte | 18 +++++- 4 files changed, 106 insertions(+), 38 deletions(-) delete mode 100644 web/pw-frontend/src/assets/svelte.png create mode 100644 web/pw-frontend/src/lib/MatchBrowser.svelte (limited to 'web/pw-frontend/src') diff --git a/web/pw-frontend/src/App.svelte b/web/pw-frontend/src/App.svelte index 614cf6f..468b925 100644 --- a/web/pw-frontend/src/App.svelte +++ b/web/pw-frontend/src/App.svelte @@ -1,11 +1,9 @@
- - - +
diff --git a/web/pw-frontend/src/assets/svelte.png b/web/pw-frontend/src/assets/svelte.png deleted file mode 100644 index e673c91..0000000 Binary files a/web/pw-frontend/src/assets/svelte.png and /dev/null differ diff --git a/web/pw-frontend/src/lib/MatchBrowser.svelte b/web/pw-frontend/src/lib/MatchBrowser.svelte new file mode 100644 index 0000000..71fadb2 --- /dev/null +++ b/web/pw-frontend/src/lib/MatchBrowser.svelte @@ -0,0 +1,89 @@ + + +
+ + + diff --git a/web/pw-frontend/src/lib/Visualizer.svelte b/web/pw-frontend/src/lib/Visualizer.svelte index 35b0677..297659c 100644 --- a/web/pw-frontend/src/lib/Visualizer.svelte +++ b/web/pw-frontend/src/lib/Visualizer.svelte @@ -2,12 +2,24 @@ import { onMount } from 'svelte'; import * as visualizer from '../lib/visualizer/index'; + export let matchLog = null; + + let initialized = false; + onMount(() => { visualizer.init(); - fetch("match.log") - .then(response => response.text()) - .then(data => visualizer.set_instance(data)); + initialized = true; + visualizer.set_loading(false); }); + + $: if (initialized) { + if (matchLog === null) { + visualizer.set_loading(true); + } else { + visualizer.set_instance(matchLog); + visualizer.set_loading(false); + } + }
-- cgit v1.2.3