From 8cda16d1c9b57ce2b49983b79afd09c8d2320477 Mon Sep 17 00:00:00 2001
From: Ilion Beyst <ilion.beyst@gmail.com>
Date: Sat, 23 Apr 2022 11:28:40 +0200
Subject: show rules on first visit

---
 web/pw-server/src/routes/index.svelte | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(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 055112a..32efe69 100644
--- a/web/pw-server/src/routes/index.svelte
+++ b/web/pw-server/src/routes/index.svelte
@@ -8,7 +8,7 @@
   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";
-  import { getBotCode, saveBotCode } from "$lib/bot_code";
+  import { getBotCode, saveBotCode, hasBotCode } from "$lib/bot_code";
   import { debounce } from "$lib/utils";
   import SubmitPane from "$lib/components/SubmitPane.svelte";
   import OutputPane from "$lib/components/OutputPane.svelte";
@@ -29,6 +29,9 @@
   let editSession: Ace.EditSession;
 
   onMount(() => {
+    if (!hasBotCode()) {
+      viewMode = ViewMode.Rules;
+    }
     init_editor();
   });
 
-- 
cgit v1.2.3

