diff --git a/web-frontend/src/lib/Map.svelte b/web-frontend/src/lib/Map.svelte index d27a1ad..d38d98c 100644 --- a/web-frontend/src/lib/Map.svelte +++ b/web-frontend/src/lib/Map.svelte @@ -45,13 +45,28 @@ }); -
-
-
+
+
+
diff --git a/web-frontend/src/lib/common.js b/web-frontend/src/lib/common.js index 7ecc046..7f96454 100644 --- a/web-frontend/src/lib/common.js +++ b/web-frontend/src/lib/common.js @@ -1,4 +1,4 @@ -import init, { address_from_lat_lon } from 'xpin-wasm'; +import init from 'xpin-wasm'; import * as xpinWasm from 'xpin-wasm'; export const WasmStatus = { diff --git a/web-frontend/src/routes/+layout.svelte b/web-frontend/src/routes/+layout.svelte index dd748ec..46572e7 100644 --- a/web-frontend/src/routes/+layout.svelte +++ b/web-frontend/src/routes/+layout.svelte @@ -2,8 +2,14 @@ import '../app.css'; + +
-
+
+
diff --git a/web-frontend/src/routes/encode/+page.svelte b/web-frontend/src/routes/app/+page.svelte similarity index 84% rename from web-frontend/src/routes/encode/+page.svelte rename to web-frontend/src/routes/app/+page.svelte index e44049c..377eb9d 100644 --- a/web-frontend/src/routes/encode/+page.svelte +++ b/web-frontend/src/routes/app/+page.svelte @@ -4,7 +4,8 @@ import { onMount, onDestroy } from 'svelte'; import AddressInput from '$lib/AddressInput.svelte'; import { browser } from '$app/environment'; - import leaflet from 'leaflet'; + let leaflet; + // import leaflet from 'leaflet'; import Map from '$lib/Map.svelte'; @@ -19,6 +20,7 @@ }; onMount(async () => { + leaflet = await import('leaflet'); wasm = await getWasm(); if (browser) { @@ -48,11 +50,13 @@ let outputValue = ''; const input = () => { try { - outputValue = wasm.call.address_to_lat_lon(addr); - let latlng = new leaflet.LatLng(outputValue[0], outputValue[1]); - map.panTo(latlng, 20); - leaflet.popup().setLatLng(latlng).setContent(`${outputValue}
hi`).openOn(map); - map.setView(latlng); + if (browser) { + outputValue = wasm.call.address_to_lat_lon(addr); + let latlng = new leaflet.LatLng(outputValue[0], outputValue[1]); + map.panTo(latlng, 20); + leaflet.popup().setLatLng(latlng).setContent(`${outputValue}
hi`).openOn(map); + map.setView(latlng); + } } catch (e) { console.error(e); outputValue = `${e}`; diff --git a/web-frontend/src/routes/decode/+page.svelte b/web-frontend/src/routes/decode/+page.svelte deleted file mode 100644 index eecd672..0000000 --- a/web-frontend/src/routes/decode/+page.svelte +++ /dev/null @@ -1,53 +0,0 @@ - - -

Decode

- -

Status: {wasm.status}

-

WasmError: {wasm.error}

-

OutputValue: {outputValue}

-

Input value: {inputValue}

- - - -