From 3cf58d0d90a9370f7f1e198d2af44fb04332d2a3 Mon Sep 17 00:00:00 2001
From: Dustin Carlino
Date: Thu, 8 Aug 2024 20:51:46 +0100
Subject: [PATCH] Open a score mode desire line in route mode for details
---
web/src/App.svelte | 20 +++++++++++++-------
web/src/NavBar.svelte | 21 +++++++++++++--------
web/src/RouteMode.svelte | 27 +++++++--------------------
web/src/ScoreMode.svelte | 30 +++++++++++++++++++++++-------
web/src/stores.ts | 23 ++++++++++++++++++++---
5 files changed, 76 insertions(+), 45 deletions(-)
diff --git a/web/src/App.svelte b/web/src/App.svelte
index 35ac73c..0701184 100644
--- a/web/src/App.svelte
+++ b/web/src/App.svelte
@@ -18,6 +18,7 @@
model,
maptilerApiKey,
showAbout,
+ routeMode,
} from "./stores";
import TitleMode from "./title/TitleMode.svelte";
import {
@@ -57,7 +58,7 @@
}
console.log("New map model loaded");
zoomToFit();
- $mode = "route";
+ $mode = routeMode();
}
$: gotModel($model);
@@ -90,7 +91,7 @@
Severance Snape
- {#if $mode != "title"}
+ {#if $mode.kind != "title"}
@@ -136,18 +137,23 @@
- {#if $mode == "title"}
+ {#if $mode.kind == "title"}
{/if}
{#if $model}
- {#if $mode == "route"}
-
- {:else if $mode == "score"}
+ {#if $mode.kind == "route"}
+
+ {:else if $mode.kind == "score"}
- {:else if $mode == "debug"}
+ {:else if $mode.kind == "debug"}
{/if}
{/if}
diff --git a/web/src/NavBar.svelte b/web/src/NavBar.svelte
index f920a49..e0e4549 100644
--- a/web/src/NavBar.svelte
+++ b/web/src/NavBar.svelte
@@ -1,28 +1,33 @@
+
diff --git a/web/src/stores.ts b/web/src/stores.ts
index 21cc64d..10f4495 100644
--- a/web/src/stores.ts
+++ b/web/src/stores.ts
@@ -1,19 +1,36 @@
import { MapModel } from "backend";
import type { FeatureCollection } from "geojson";
import type { Map } from "maplibre-gl";
-import { writable, type Writable } from "svelte/store";
+import { get, writable, type Writable } from "svelte/store";
export let maptilerApiKey = "MZEJTanw3WpxRvt7qDfo";
-export type Mode = "title" | "score" | "route" | "debug";
+export type Mode =
+ | { kind: "title" }
+ | { kind: "score" }
+ | { kind: "route"; route_a: [number, number]; route_b: [number, number] }
+ | { kind: "debug" };
export interface RouteGJ extends FeatureCollection {
direct_length: number;
route_length: number;
}
-export let mode: Writable = writable("title");
+export let mode: Writable = writable({ kind: "title" });
export let model: Writable = writable(null);
export let map: Writable