From dc415a81259dba1afdc3570c9882288940bd3c29 Mon Sep 17 00:00:00 2001
From: Ilion Beyst <ilion.beyst@gmail.com>
Date: Mon, 7 Feb 2022 21:36:54 +0100
Subject: cleanup editor code

---
 web/pw-server/src/routes/index.svelte | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

(limited to 'web/pw-server/src/routes/index.svelte')

diff --git a/web/pw-server/src/routes/index.svelte b/web/pw-server/src/routes/index.svelte
index 76f6295..7cecba7 100644
--- a/web/pw-server/src/routes/index.svelte
+++ b/web/pw-server/src/routes/index.svelte
@@ -1,12 +1,12 @@
 <script lang="ts">
-  import { goto } from "$app/navigation";
   import Visualizer from "$lib/components/Visualizer.svelte";
+  import EditorView from "$lib/components/EditorView.svelte";
   import { onMount } from "svelte";
   import "./style.css";
 
-  import ace from "ace-builds/src-noconflict/ace?client";
-  import Editor from "$lib/components/Editor.svelte";
   import type { Ace } from "ace-builds";
+  import ace from "ace-builds/src-noconflict/ace?client";
+  import * as AcePythonMode from "ace-builds/src-noconflict/mode-python?client";
 
   let matches = [];
 
@@ -15,12 +15,11 @@
 
   let editSession: Ace.EditSession;
 
-  onMount(async () => {
-    await init_editor();
+  onMount(() => {
+    init_editor();
   });
 
-  async function init_editor() {
-    const AcePythonMode = await import("ace-builds/src-noconflict/mode-python");
+  function init_editor() {
     editSession = new ace.EditSession("");
     editSession.setMode(new AcePythonMode.Mode());
   }
@@ -85,7 +84,11 @@
       </div>
       <ul class="match-list">
         {#each matches as match}
-          <li class="match-card sidebar-item" on:click={() => selectMatch(match.matchId)}>
+          <li
+            class="match-card sidebar-item"
+            on:click={() => selectMatch(match.matchId)}
+            class:selected={match.matchId === selectedMatchId}
+          >
             <div class="match-name">{match.matchId}</div>
           </li>
         {/each}
@@ -95,7 +98,7 @@
       {#if selectedMatchLog !== undefined}
         <Visualizer matchLog={selectedMatchLog} />
       {:else}
-        <Editor {editSession} />
+        <EditorView {editSession} />
       {/if}
     </div>
     <div class="sidebar-right">
@@ -168,11 +171,6 @@
     background-color: #333;
   }
 
-  .toolbar-editor {
-    padding: 15px;
-    color: #eee;
-  }
-
   .match-list {
     list-style: none;
     color: #eee;
-- 
cgit v1.2.3

