Add delay component
This commit is contained in:
parent
bd2be948eb
commit
52c38966c4
|
@ -1,5 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Marker, Popup } from 'svelte-maplibre';
|
import { Marker, Popup } from 'svelte-maplibre';
|
||||||
|
import Delay from './micro/Delay.svelte';
|
||||||
|
|
||||||
export let lngLat: [number, number];
|
export let lngLat: [number, number];
|
||||||
export let lineNumber: string;
|
export let lineNumber: string;
|
||||||
|
@ -20,6 +21,12 @@ console.log("lineNumber: %s", lineNumber)
|
||||||
color: black;
|
color: black;
|
||||||
background-color: white;;
|
background-color: white;;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.popover-content {
|
||||||
|
color: black;
|
||||||
|
background-color: white;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<Marker {lngLat}>
|
<Marker {lngLat}>
|
||||||
|
@ -33,12 +40,14 @@ console.log("lineNumber: %s", lineNumber)
|
||||||
|
|
||||||
|
|
||||||
<Popup openOn="hover" offset={[0, -10]}>
|
<Popup openOn="hover" offset={[0, -10]}>
|
||||||
|
<div class="popover-content">
|
||||||
<h4>{lineNumber}: {lineName}</h4>
|
<h4>{lineNumber}: {lineName}</h4>
|
||||||
<p>Going from <i>{origin}</i> to <i>{destination}</i></p>
|
<p>
|
||||||
<ul>
|
Going from <i>{origin}</i> to <i>{destination}</i>
|
||||||
<li>Occupancy: {occupancy}</li>
|
<br />
|
||||||
<li>Delay: {delay}</li>
|
<Delay {delay} />
|
||||||
</ul>
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
</Popup>
|
</Popup>
|
||||||
</Marker>
|
</Marker>
|
|
@ -0,0 +1,22 @@
|
||||||
|
<script lang="ts">
|
||||||
|
/** The delay in seconds.*/
|
||||||
|
export let delay: number;
|
||||||
|
|
||||||
|
let delay_min = Math.round(delay / 60);
|
||||||
|
let delay_abs = Math.abs(delay_min);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
The bus is
|
||||||
|
{#if delay_min == 1}
|
||||||
|
<span>one minute delayed.</span>
|
||||||
|
{:else if delay_min > 1}
|
||||||
|
<span>{delay_abs} minutes delayed.</span>
|
||||||
|
{:else if delay_min == -1}
|
||||||
|
<span>one minute ahead of schedule.</span>
|
||||||
|
{:else if delay_min < -1}
|
||||||
|
<span>{delay_abs} minutes ahead of schedule.</span>
|
||||||
|
{:else}
|
||||||
|
<span>on time.</span>
|
||||||
|
{/if}
|
||||||
|
</div>
|
Loading…
Reference in New Issue