aboutsummaryrefslogtreecommitdiff
path: root/web/pw-server/src/routes
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-02-07 21:36:54 +0100
committerIlion Beyst <ilion.beyst@gmail.com>2022-02-07 21:36:54 +0100
commitdc415a81259dba1afdc3570c9882288940bd3c29 (patch)
tree655767587169ff47016d28dad2300d175024b336 /web/pw-server/src/routes
parent4feebe50430236a331b439c31af13d0d390be805 (diff)
downloadplanetwars.dev-dc415a81259dba1afdc3570c9882288940bd3c29.tar.xz
planetwars.dev-dc415a81259dba1afdc3570c9882288940bd3c29.zip
cleanup editor code
Diffstat (limited to 'web/pw-server/src/routes')
-rw-r--r--web/pw-server/src/routes/index.svelte26
1 files changed, 12 insertions, 14 deletions
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;