From 9be403c7eba5b7953c0c3c1cbc14693ddfaa85b6 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Thu, 27 Apr 2023 21:22:31 -0400 Subject: [PATCH] Improve url format definition --- web-frontend/src/lib/common.js | 15 +++++++++++ web-frontend/src/routes/app/+page.svelte | 25 ++++++++++++------- .../src/routes/app/CoordinateInfo.svelte | 12 +-------- 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/web-frontend/src/lib/common.js b/web-frontend/src/lib/common.js index 8962149..3bdcd2e 100644 --- a/web-frontend/src/lib/common.js +++ b/web-frontend/src/lib/common.js @@ -1,6 +1,21 @@ import init from 'xpin-wasm'; import * as xpinWasm from 'xpin-wasm'; +export function rustEnumToArray(e) { + let ret = []; + for (let k in e) { + // Add the string coordinate types + if (!isNaN(k * 1)) { + // This is a numeric key, not a string key + // So skip it + continue; + } + + ret.push(k); + } + return ret; +} + export const WasmStatus = { NotLoaded: -1, Loaded: 0, diff --git a/web-frontend/src/routes/app/+page.svelte b/web-frontend/src/routes/app/+page.svelte index 5f7327e..d58e48f 100644 --- a/web-frontend/src/routes/app/+page.svelte +++ b/web-frontend/src/routes/app/+page.svelte @@ -1,5 +1,5 @@