feat(directions): on-demand road-data layer loading with loading-state CTA
This commit is contained in:
parent
5c29320e6b
commit
9ef58e62c8
@ -18,6 +18,8 @@
|
|||||||
graphLabel?: string;
|
graphLabel?: string;
|
||||||
/** Called by the on-demand CTA to load the routable layer. */
|
/** Called by the on-demand CTA to load the routable layer. */
|
||||||
onLoadGraph?: () => void;
|
onLoadGraph?: () => void;
|
||||||
|
/** True while the road data layer is being loaded on demand. */
|
||||||
|
graphLoading?: boolean;
|
||||||
/** Loaded POIs available for avoidance + search. */
|
/** Loaded POIs available for avoidance + search. */
|
||||||
searchables: Searchable[];
|
searchables: Searchable[];
|
||||||
/** Live route progress (0..1) while computing. */
|
/** Live route progress (0..1) while computing. */
|
||||||
@ -42,6 +44,7 @@
|
|||||||
hasGraph,
|
hasGraph,
|
||||||
graphLabel = 'the road data layer',
|
graphLabel = 'the road data layer',
|
||||||
onLoadGraph,
|
onLoadGraph,
|
||||||
|
graphLoading = false,
|
||||||
searchables = [],
|
searchables = [],
|
||||||
progress = 0,
|
progress = 0,
|
||||||
computing = false,
|
computing = false,
|
||||||
@ -245,7 +248,9 @@
|
|||||||
<div class="cta">
|
<div class="cta">
|
||||||
<strong>Road data layer needed for route computation</strong>
|
<strong>Road data layer needed for route computation</strong>
|
||||||
<p>The {graphLabel} isn't loaded yet. Load it to enable routing.</p>
|
<p>The {graphLabel} isn't loaded yet. Load it to enable routing.</p>
|
||||||
<button class="cta-btn" onclick={() => onLoadGraph?.()} disabled={computing}>Load road data</button>
|
<button class="cta-btn" onclick={() => onLoadGraph?.()} disabled={computing || graphLoading}>
|
||||||
|
{graphLoading ? 'Loading road data…' : 'Load road data'}
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|||||||
@ -581,6 +581,7 @@
|
|||||||
hasGraph={!!routeGraph}
|
hasGraph={!!routeGraph}
|
||||||
graphLabel={graphLabel}
|
graphLabel={graphLabel}
|
||||||
onLoadGraph={() => loadRouteGraph(true)}
|
onLoadGraph={() => loadRouteGraph(true)}
|
||||||
|
graphLoading={routeLoading}
|
||||||
searchables={searchables}
|
searchables={searchables}
|
||||||
savedPoints={savedPointsList}
|
savedPoints={savedPointsList}
|
||||||
onPickSavedPoint={(p) => setSavedPointAsOrigin(p)}
|
onPickSavedPoint={(p) => setSavedPointAsOrigin(p)}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user