Skip to content

Commit

Permalink
Show import errors as popups, not an easy-to-miss message
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreegster committed Mar 29, 2024
1 parent 338660d commit 38ee8be
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions web/src/common/import/ImportControls.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
type Imported =
| { kind: "nothing" }
| { kind: "loading"; msg: string }
| { kind: "error"; msg: string }
| {
kind: "done";
boundaryGj: Feature<Polygon>;
Expand Down Expand Up @@ -82,7 +81,8 @@
networkStore.set(imported.network);
boundaryGjStore.set(imported.boundaryGj);
} catch (err: any) {
imported = { kind: "error", msg: err.toString() };
window.alert(err.toString());
imported = { kind: "nothing" };
}
}
Expand Down Expand Up @@ -121,7 +121,8 @@
}
function error(e: CustomEvent<string>) {
imported = { kind: "error", msg: e.detail };
window.alert(e.detail);
imported = { kind: "nothing" };
}
function loading(e: CustomEvent<string>) {
Expand Down Expand Up @@ -153,8 +154,6 @@
<p>Use the polygon tool to select an area to import</p>
{:else if imported.kind === "loading"}
<p>{imported.msg}</p>
{:else if imported.kind === "error"}
<p>Error: {imported.msg}</p>
{:else if imported.kind === "done"}
<div>
<button type="button" on:click={update}>Update OSM data</button>
Expand Down
2 changes: 1 addition & 1 deletion web/src/common/osm_input/OverpassSelector.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
return;
}
if (map.getZoom() < 15) {
dispatch("error", "Zoom in more to import");
dispatch("error", "Zoom in more to import (or draw a custom area)");
return;
}
await importPolygon(mapBoundsToGeojson());
Expand Down

0 comments on commit 38ee8be

Please sign in to comment.