Skip to content

Commit

Permalink
Use the three-piece layout
Browse files Browse the repository at this point in the history
  • Loading branch information
dabreegster committed Sep 4, 2024
1 parent 6f4bb15 commit 62f9a7e
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 62 deletions.
8 changes: 5 additions & 3 deletions web/src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import { type LayersControls } from "./common";
import Header from "./Header.svelte";
import Layers from "./Layers.svelte";
import Layout from "./Layout.svelte";
import { Layout } from "svelte-utils/top_bar_layout";
import Loader from "./Loader.svelte";
import SidebarControls from "./SidebarControls.svelte";
Expand Down Expand Up @@ -51,8 +51,10 @@
</script>

<Layout>
<div slot="left">
<div slot="top">
<Header app="main" />
</div>
<div slot="left">
<label>
{#if pmtiles == null}
Open a <i>.pmtiles</i>
Expand Down Expand Up @@ -83,7 +85,7 @@
<SidebarControls {outputMetadata} {map} bind:controls />
{/if}
</div>
<div slot="main" style="position:relative; width: 100%; height: 100vh;">
<div slot="main" style="position:relative; width: 100%; height: 100%;">
<MapLibre
style="https://api.maptiler.com/maps/dataviz/style.json?key=MZEJTanw3WpxRvt7qDfo"
standardControls
Expand Down
6 changes: 4 additions & 2 deletions web/src/EdgeCostApp.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
} from "./common";
import CostFunction from "./CostFunction.svelte";
import Header from "./Header.svelte";
import Layout from "./Layout.svelte";
import { Layout } from "svelte-utils/top_bar_layout";
import { Popup, makeColorRamp } from "svelte-utils/map";
import {
Loading,
Expand Down Expand Up @@ -211,8 +211,10 @@
</script>

<Layout>
<div slot="left">
<div slot="top">
<Header app="costs" />
</div>
<div slot="left">
<label>
Open an <i>.osm.pbf</i>
file
Expand Down
60 changes: 35 additions & 25 deletions web/src/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,46 @@
// TODO Merge apps into one page, or detect what the user's loading?
export let app: string;
let show = false;
function switchApp() {
if (app == "main") {
window.location.href = "index.html";
} else if (app == "interactive") {
window.location.href = "interactive.html";
} else if (app == "costs") {
window.location.href = "edge_cost.html";
}
}
let showAbout = false;
</script>

<div style="display: flex; justify-content: space-between">
<img src={logoUrl} width="100" alt="od2net logo by Hadrien Salat" />
<div style="display: flex">
<button class="outline" on:click={() => (showAbout = true)}>
<img src={logoUrl} width="100" alt="od2net logo by Hadrien Salat" />
</button>

<select bind:value={app} on:change={switchApp}>
<option value="main">Pre-built route networks</option>
<option value="interactive">Interactively generate route networks</option>
<option value="costs">Explore edge costs</option>
</select>
<nav>
<ul>
<li>
<button
on:click={() => (window.location.href = "index.html")}
disabled={app == "main"}
>
Pre-built route networks
</button>
</li>
<li>
<button
on:click={() => (window.location.href = "interactive.html")}
disabled={app == "interactive"}
>
Interactively generate route networks
</button>
</li>
<li>
<button
on:click={() => (window.location.href = "edge_cost.html")}
disabled={app == "costs"}
>
Explore edge costs
</button>
</li>
</ul>
</nav>
</div>

<button on:click={() => (show = true)}>About</button>

<br />
<br />

{#if show}
<Modal on:close={() => (show = false)} let:dialog>
{#if showAbout}
<Modal on:close={() => (showAbout = false)} let:dialog>
<div style="display: flex; justify-content: space-between">
<h1>About od2net</h1>
<button on:click={() => dialog.close()}>Close</button>
Expand Down
6 changes: 4 additions & 2 deletions web/src/InteractiveApp.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import CostFunction from "./CostFunction.svelte";
import Header from "./Header.svelte";
import Layers from "./Layers.svelte";
import Layout from "./Layout.svelte";
import { Layout } from "svelte-utils/top_bar_layout";
import { Loading } from "svelte-utils";
import { OverpassSelector } from "svelte-utils/overpass";
import SidebarControls from "./SidebarControls.svelte";
Expand Down Expand Up @@ -111,8 +111,10 @@
</script>

<Layout>
<div slot="left">
<div slot="top">
<Header app="interactive" />
</div>
<div slot="left">
<label>
Open an <i>.osm.pbf</i>
file
Expand Down
30 changes: 0 additions & 30 deletions web/src/Layout.svelte

This file was deleted.

0 comments on commit 62f9a7e

Please sign in to comment.