-
Notifications
You must be signed in to change notification settings - Fork 5
feat(routing): migrate plugin #842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 55 commits
Commits
Show all changes
67 commits
Select commit
Hold shift + click to select a range
f609911
refactor: remove unused package @polar/lib-idx
dopenguin 5e594a8
refactor(routing): add basic plugin structure
dopenguin c8f8aed
refactor(routing): migrate configuration options
dopenguin 15e8fff
refactor(routing): add basic ui skeleton
dopenguin 440ace0
refactor(routing): remove extra style end tag
dopenguin 04e6e98
Merge branch 'vue3/feat-context-menu' into vue3/migrate-plugin-routing
dopenguin d6565c3
refactor(routing): add missing classes to add and remove buttons
dopenguin 54c3cab
Merge branch 'vue3/feat-context-menu' into vue3/migrate-plugin-routing
dopenguin 02fe673
fix: add name prop so radio inputs are properly grouped together as o…
dopenguin 38370cf
Merge branch 'vue3/fix-polar-input' into vue3/migrate-plugin-routing
dopenguin 3887afb
Merge branch 'next' into vue3/migrate-plugin-routing
dopenguin b23841e
feat: add reusable toggle button component
dopenguin 366b4e0
refactor(routing): add toggle buttons to switch the selected travel mode
dopenguin 8b5a531
refactor: add routing to MapConfiguration
dopenguin b1d1268
refactor: add routing configuration to snowbox
dopenguin d6372bf
refactor(routing): move travelModes to the store
dopenguin dba4e6e
refactor(routing): update default values and configurability of selec…
dopenguin 3db5c27
refactor(routing): add possibility to select a preference for a route…
dopenguin 58e43d6
refactor(routing): reset plugin on teardown
dopenguin 28a7dd5
refactor(routing): add possibility to select route types to avoid
dopenguin 06e894f
refactor(routing): add possibility to sent routing requests
dopenguin 4146efb
Merge branch 'next' into vue3/migrate-plugin-routing
dopenguin 30c9d79
refactor(routing): add reset and details buttons
dopenguin ca62527
refactor(routing): add possibility to view route details
dopenguin 76a60df
refactor(routing): update draw interaction to only be set as long as …
dopenguin 502fbad
Merge branch 'vue3/refactor-polar-select' into vue3/migrate-plugin-ro…
dopenguin cd3e6be
Merge branch 'next' into vue3/migrate-plugin-routing
dopenguin e50c504
refactor(routing): improve ux and accessibility of routing details
dopenguin 09f2b47
refactor(routing): always display routing details when available
dopenguin 9224521
refactor(routing): remove last kern-description classes
dopenguin c005a7c
refactor: improve accessibility and styling of PolarToggleButton
dopenguin e7c57ca
fix(routing): correctly associate label with the input
dopenguin d10b6be
fix(routing): remove unused import
dopenguin 9f18c73
refactor(routing): further improve accessibility of routing details
dopenguin 7fcc370
refactor(routing): correctly place aria live region for routing details
dopenguin 366adcf
refactor(routing): add TSDoc and reorder exported parameters and func…
dopenguin 8cbb1a7
refactor(routing): add comment regarding the structure of routingResp…
dopenguin 7b21bc9
refactor(routing): add information when a route gets requested
dopenguin 21567a2
refactor(routing): update fetchRoute to only set the Authorization he…
dopenguin cd89787
refactor(routing): add a return type for the fetch response
dopenguin 03f7769
refactor(routing): add an AbortController to abort ongoing routing re…
dopenguin f125fc1
Merge branch 'vue3/feat-context-menu' into vue3/migrate-plugin-routing
dopenguin 85c8c49
fix: various linting issues (mostly import order)
dopenguin f462539
Merge branch 'vue3/feat-context-menu' into vue3/migrate-plugin-routing
dopenguin 8bde552
feat: add reusable toggle button component
dopenguin 8dfea9a
fix(routing): use non-deprecated css parameter
dopenguin a5f3c31
fix(routing): add newly required prop
dopenguin d1be3c4
fix(routing): remove draw interaction if a user loses focus through k…
dopenguin 16c98ad
refactor(routing): use consistent naming for start and end
dopenguin bda5ec3
Merge branch 'vue3/feat-context-menu' into vue3/migrate-plugin-routing
dopenguin df712a9
refactor: add TSDoc for routing in MapConfiguration
dopenguin 8f829c4
Merge branch 'vue3/feat-context-menu' into vue3/migrate-plugin-routing
dopenguin 5088e5d
Merge branch 'next' into vue3/migrate-plugin-routing
dopenguin 4eb47ac
fix(routing): remove disallowed file extensions from imports
dopenguin d1b8e95
refactor: add routing to the generic client
dopenguin 9f1bf80
refactor(routing): add default icon
dopenguin e0e7b67
refactor(routing): update tsdoc to reflect current implementation
dopenguin fdefe8e
refactor(iconMenu): add hint for routing
dopenguin cf55a71
fix: use correct plugin id
dopenguin 96d49c4
refactor(routing): shorten getter
dopenguin 95e974c
refactor(routing): move watcher definitions to store scope
dopenguin 8c04226
refactor(routing): remove redundant url encoding
dopenguin 35d0bac
refactor(routing): add composable for the route layer
dopenguin bb8948e
feat: allow composables in plugins
dopenguin d5702fd
refactor(routing): format distance and duration numbers based on lang…
dopenguin 239a12a
refactor(routing): hoist layer composable to store scope
dopenguin 569ba75
Merge branch 'next' into vue3/migrate-plugin-routing
dopenguin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,193 @@ | ||
| <template> | ||
| <div class="routing-live-region"> | ||
| <hr class="kern-divider" aria-hidden="true" /> | ||
| <span role="status" aria-live="polite"> | ||
| {{ | ||
| $t(($) => $.ariaLive, { | ||
| ns: PluginId, | ||
| steps: steps.length, | ||
| duration: formatDuration(duration), | ||
| distance: formatDistance(distance), | ||
| }) | ||
| }} | ||
| </span> | ||
| </div> | ||
| <section v-show="showDetails"> | ||
| <div class="routing-details-header"> | ||
| <h3>{{ $t(($) => $.label.details, { ns: PluginId }) }}</h3> | ||
| <span aria-hidden="true"> | ||
| {{ | ||
| $t(($) => $.duration, { | ||
| ns: PluginId, | ||
| duration: formatDuration(duration), | ||
| }) | ||
| }} | ||
| </span> | ||
| <span aria-hidden="true"> | ||
| {{ | ||
| $t(($) => $.distance, { | ||
| ns: PluginId, | ||
| distance: formatDistance(distance), | ||
| }) | ||
| }} | ||
| </span> | ||
| </div> | ||
| <ol :aria-label="$t(($) => $.label.steps, { ns: PluginId })"> | ||
| <li v-for="(step, i) in steps" :key="i"> | ||
| <span class="routing-instruction"> | ||
| {{ step.instruction }} | ||
| </span> | ||
| <div class="routing-badges"> | ||
| <span | ||
| class="kern-badge" | ||
| :aria-label=" | ||
| $t(($) => $.duration, { | ||
| ns: PluginId, | ||
| duration: formatDuration(step.duration), | ||
| }) | ||
| " | ||
| > | ||
| <span class="kern-icon kern-icon--pace" aria-hidden="true" /> | ||
| <span class="kern-label" aria-hidden="true"> | ||
| {{ formatDuration(step.duration) }} | ||
| </span> | ||
| </span> | ||
| <span | ||
| class="kern-badge" | ||
| :aria-label=" | ||
| $t(($) => $.distance, { | ||
| ns: PluginId, | ||
| distance: formatDistance(step.distance), | ||
| }) | ||
| " | ||
| > | ||
| <span class="kern-icon kern-icon--arrow-range" aria-hidden="true" /> | ||
| <span class="kern-label" aria-hidden="true"> | ||
| {{ formatDistance(step.distance) }} | ||
| </span> | ||
| </span> | ||
| </div> | ||
| </li> | ||
| </ol> | ||
| </section> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { storeToRefs } from 'pinia' | ||
| import { computed } from 'vue' | ||
|
|
||
| import { useRoutingStore } from '../store' | ||
| import { PluginId } from '../types' | ||
|
|
||
| const routingStore = useRoutingStore() | ||
| const { showDetails } = storeToRefs(routingStore) | ||
|
|
||
| const segments = computed( | ||
| () => routingStore.routeFeature?.properties.segments ?? [] | ||
| ) | ||
| const distance = computed(() => | ||
| segments.value.reduce((acc, segment) => acc + segment.distance, 0) | ||
| ) | ||
| const duration = computed(() => | ||
| segments.value.reduce((acc, segment) => acc + segment.duration, 0) | ||
| ) | ||
| const steps = computed(() => segments.value.flatMap((segment) => segment.steps)) | ||
|
|
||
| function formatDistance(distance: number) { | ||
| if (distance >= 1000) { | ||
| return `${(distance / 1000).toFixed(1)} km` | ||
| } | ||
| return `${distance} m` | ||
|
oeninghe-dataport marked this conversation as resolved.
Outdated
|
||
| } | ||
| function formatDuration(duration: number) { | ||
| if (duration >= 3600) { | ||
| return `${(duration / 3600).toFixed(2)} h` | ||
| } else if (duration >= 60) { | ||
| return `${(duration / 60).toFixed(1)} min` | ||
| } | ||
| return `${duration} sec` | ||
|
dopenguin marked this conversation as resolved.
|
||
| } | ||
| </script> | ||
|
|
||
| <style scoped> | ||
| .routing-live-region { | ||
| position: relative; | ||
| width: 100%; | ||
|
|
||
| hr { | ||
| width: 100%; | ||
| } | ||
|
|
||
| span { | ||
| position: absolute; | ||
| inset: 0; | ||
| opacity: 0; | ||
| pointer-events: none; | ||
| margin: calc(-1 * var(--kern-metric-space-small)) 0; | ||
| } | ||
| } | ||
|
|
||
| section { | ||
| margin-top: var(--kern-metric-space-small); | ||
|
|
||
| .routing-details-header { | ||
| position: relative; | ||
| display: flex; | ||
| justify-content: center; | ||
| gap: var(--kern-metric-space-small); | ||
| margin-bottom: var(--kern-metric-space-small); | ||
|
|
||
| h3 { | ||
| position: absolute; | ||
| inset: 0; | ||
| opacity: 0; | ||
| pointer-events: none; | ||
| margin: 0; | ||
| } | ||
|
|
||
| span { | ||
| font-size: var(--kern-typography-font-size-medium-static); | ||
| } | ||
| } | ||
|
|
||
| ol { | ||
| display: flex; | ||
| flex-direction: column; | ||
| gap: var(--kern-metric-space-small); | ||
| padding: 0; | ||
|
|
||
| li { | ||
| display: flex; | ||
| flex-wrap: wrap; | ||
| align-items: center; | ||
| gap: var(--kern-metric-space-small); | ||
| padding: var(--kern-metric-space-small); | ||
| padding-left: var(--kern-metric-space-default); | ||
| border-radius: var(--kern-metric-border-radius-default); | ||
| background-color: var(--kern-color-layout-background-hued); | ||
| white-space: break-spaces; | ||
| overflow-wrap: break-word; | ||
|
|
||
| .routing-instruction { | ||
| font-weight: var(--kern-typography-font-weight-label-default); | ||
| color: var(--kern-color-layout-text-default); | ||
| } | ||
|
|
||
| .routing-badges { | ||
| display: flex; | ||
| gap: var(--kern-metric-space-small); | ||
| width: 100%; | ||
| color: var(--kern-color-layout-text-default); | ||
|
|
||
| .kern-badge { | ||
| box-sizing: content-box; | ||
| justify-content: center; | ||
| width: var(--kern-metric-dimension-5x-large); | ||
| border: var(--kern-metric-border-width-light) solid | ||
| var(--kern-color-decorative-border-contextual); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| </style> | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.