-
Notifications
You must be signed in to change notification settings - Fork 3
POLAR@3: Improve support for using multiple map #356
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 all commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
dc85645
refactor(core): enable TypeScript support for i18n
oeninghe-dataport 0c5d11b
refactor(core): configuration-agnostic i18n plugin
oeninghe-dataport 55eec5b
refactor(core): use precise type for locale overrides
oeninghe-dataport 869433f
refactor(core): pass mapConfig via props to CE
oeninghe-dataport 1792840
Merge branch 'vue3/migrate-plugin-toast' into feature/multiple-elements
oeninghe-dataport 04a0681
refactor(iconMenu): adapt to refactored core
oeninghe-dataport a7af0e8
Merge branch 'vue3/migrate-plugin-toast' into feature/multiple-elements
oeninghe-dataport 3e942d5
feat(fullscreen): allow passing no options
oeninghe-dataport fd71c31
refactor(core): use reactive for plugin array in plugin store
oeninghe-dataport 955041c
chore: move d-ts files to @types folder
oeninghe-dataport c34a8a5
fix(core): declare store explicit as exposed
oeninghe-dataport f139ea4
chore: improve iceberg
oeninghe-dataport a201b30
chore: improve iceberg [wip]
oeninghe-dataport 72a5689
Merge branch 'next' into feature/multiple-elements
dopenguin 59de509
Merge branch 'next' into feature/multiple-elements
dopenguin bda1ebd
Merge branch 'next' into feature/multiple-elements
dopenguin 899e38d
refactor(iconMenu): remove pluginStore from store
oeninghe-dataport 27343bd
docs(core): clarify usage of register/createMap and add missing docs
oeninghe-dataport b4413d0
Merge branch 'next' into feature/multiple-elements
oeninghe-dataport 3cfc4cf
style(snowbox): fix HTML indentation
oeninghe-dataport 7a90f58
style(iceberg): remove superfluous type hint
oeninghe-dataport f3deaec
refactor(core): move action logger to separate file
oeninghe-dataport fe38c75
build: accept HMR for pinia stores
oeninghe-dataport 0e432d7
fix: do not create pinia stores w/o instance reference anymore
oeninghe-dataport 0fddd2a
Merge branch 'next' into feature/multiple-elements
oeninghe-dataport 6697f1b
fix(core): adapt subscribe and updateState to multi-map support
oeninghe-dataport 51776c7
test(iceberg): improve styling
oeninghe-dataport ea5c7a2
test(iceberg): add language switcher
oeninghe-dataport 024e6b5
style(iceberg): fix HTML indentation
oeninghe-dataport b43828b
fix(core): live translation updates for overlay messages
oeninghe-dataport cc3ed40
fix(toast): live translation updates for toast messages
oeninghe-dataport 952e614
Merge branch 'next' into feature/multiple-elements
oeninghe-dataport e0f3b57
fix(core): initialize serviceRegister to ensure sync map creation
oeninghe-dataport 725b14b
refactor(core): remove map null-checks from PolarMap SFC
oeninghe-dataport 492c983
test(snowbox): fix selectedCoordinates subscribe
oeninghe-dataport e8ad512
test(snowbox): add jsconfig.json for IntelliSense in VSCode
oeninghe-dataport 96504e3
test(snowbox): do not use internal POLAR APIs for language change
oeninghe-dataport fb755d9
refactor(core): simplify language property in export store
oeninghe-dataport 68ba7c3
test(snowbox): use getStore instead of map.store.getPluginStore
oeninghe-dataport 25d932f
style: enforce use of self-closing tags
oeninghe-dataport fecdbce
style(core): add hint on exposed store DOM prop
oeninghe-dataport 393a7a5
refactor(core): use typed pinia extensions
oeninghe-dataport 9806e7d
feat(core): provide convenience wrapper createMap (similar to POLAR@2)
oeninghe-dataport fafeae0
refactor(core): split exported utils to separate files
oeninghe-dataport d512aaa
refactor(core): move re-compution of t result to notifyUser
oeninghe-dataport ab0711b
test(iceberg): enable checkServiceAvailability
oeninghe-dataport 0184567
fix(core): revert to-be-discussed live-updates
oeninghe-dataport 16e5a21
fix(core): revert to-be-discussed default style for polar-map
oeninghe-dataport 86ac358
build(iceberg): add missing d.ts reference
oeninghe-dataport 022f91b
chore: move computedT to match architectural constraints
oeninghe-dataport 085c76a
docs(core): add hint about plugin.options
oeninghe-dataport 6c09939
fix(core): revert to-be-discussed watcher for live-updates
oeninghe-dataport 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,37 +1,108 @@ | ||
| <template> | ||
| <h1 class="kern-heading-display">Eisberg-Register</h1> | ||
| <h2 class="kern-heading-large">Nicht genehmigten Eisberg melden</h2> | ||
| <polar-map ref="map"></polar-map> | ||
| <main :class="$style.main"> | ||
| <div v-if="view !== 'menu'" style="margin-bottom: 2em"> | ||
| <a href="#" class="kern-link" @click.prevent="view = 'menu'"> | ||
| <span class="kern-icon kern-icon--arrow-back" aria-hidden="true" /> | ||
| Zurück zur Übersicht | ||
| </a> | ||
| </div> | ||
| <TaskMenu | ||
| v-if="view === 'menu'" | ||
| :config-tasks="configTasks" | ||
| @select="view = $event" | ||
| /> | ||
| <IcebergMap v-else-if="view === 'map'" /> | ||
| <component :is="configTaskComponent" v-else-if="configTaskComponent" /> | ||
| <div | ||
| v-if="view !== 'menu'" | ||
| style="display: flex; gap: 2em; margin-top: 2em" | ||
| > | ||
| <button | ||
| v-if="viewIndex > 1" | ||
| class="kern-btn kern-btn--secondary" | ||
| style="flex: 1" | ||
| @click="viewIndex = viewIndex - 1" | ||
| > | ||
| <span class="kern-icon kern-icon--arrow-back" aria-hidden="true" /> | ||
| <span class="kern-label">Zurück</span> | ||
| </button> | ||
| <button | ||
| v-if="viewIndex <= configTasks.length" | ||
| class="kern-btn kern-btn--primary" | ||
| style="flex: 1" | ||
| @click="viewIndex = viewIndex + 1" | ||
| > | ||
| <span class="kern-label">Weiter</span> | ||
| <span class="kern-icon kern-icon--arrow-forward" aria-hidden="true" /> | ||
| </button> | ||
| </div> | ||
| </main> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { useTemplateRef } from 'vue' | ||
| import { createMap } from '@polar/polar' | ||
| const map = useTemplateRef('map') | ||
| import { computed, ref } from 'vue' | ||
| import kernExtraIcons from 'virtual:kern-extra-icons' | ||
| import LayoutChooser from './components/LayoutChooser.vue' | ||
| import TaskMenu from './components/TaskMenu.vue' | ||
| import IcebergMap from './components/IcebergMap.vue' | ||
|
|
||
| createMap( | ||
| const configTasks = [ | ||
| { | ||
| layers: [ | ||
| { | ||
| id: '23420', | ||
| visibility: true, | ||
| type: 'background', | ||
| name: 'snowbox.layers.basemap', | ||
| }, | ||
| ], | ||
| id: 'choose-layout', | ||
| label: 'Layout wählen', | ||
| component: LayoutChooser, | ||
| }, | ||
| 'https://geodienste.hamburg.de/services-internet.json' | ||
| ] | ||
| const tasks = computed(() => [ | ||
| 'menu', | ||
| ...configTasks.map(({ id }) => id), | ||
| 'map', | ||
| ]) | ||
|
|
||
| const view = ref('menu') | ||
| const viewIndex = computed({ | ||
| get: () => tasks.value.indexOf(view.value), | ||
| set: (value) => { | ||
| view.value = tasks.value[value] || 'menu' | ||
| }, | ||
| }) | ||
|
|
||
| const configTaskComponent = computed( | ||
| () => configTasks.find((task) => task.id === view.value)?.component | ||
| ) | ||
|
|
||
| document.adoptedStyleSheets.push(kernExtraIcons) | ||
| if (import.meta.hot) { | ||
| import.meta.hot.on('kern-extra-icons', ({ icons }) => { | ||
| icons.forEach((icon) => kernExtraIcons.insertRule(icon)) | ||
| }) | ||
| } | ||
dopenguin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| </script> | ||
|
|
||
| <!-- eslint-disable-next-line vue/enforce-style-attribute --> | ||
| <style> | ||
| @import url('@kern-ux/native/dist/kern.css'); | ||
| @import url('@kern-ux/native/dist/fonts/fira-sans.css'); | ||
| @import url('@polar/polar/polar.css'); | ||
| </style> | ||
|
|
||
| <style scoped> | ||
| .kern-link { | ||
| color: blue !important; | ||
| & > .kern-icon { | ||
| background-color: blue !important; | ||
| } | ||
| } | ||
| </style> | ||
|
|
||
| <style module> | ||
| .main { | ||
| position: relative; | ||
| margin: 2em 4em; | ||
|
|
||
| polar-map { | ||
| width: 100%; | ||
| height: 20em; | ||
| @media (max-width: 65em) { | ||
| margin: 1.5em 0.5em; | ||
| } | ||
| } | ||
| </style> | ||
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,84 @@ | ||
| <template> | ||
| <div :class="$style['language-chooser']"> | ||
| <button class="kern-btn kern-btn--secondary" @click="switchLanguage"> | ||
| <span class="kern-icon kern-icon--flag" /> | ||
| <span class="kern-label">{{ | ||
| language === 'de' ? 'Switch to English' : 'Zu Deutsch wechseln' | ||
| }}</span> | ||
| </button> | ||
| </div> | ||
| <polar-map | ||
| v-if="store.serviceRegister.length" | ||
| ref="map" | ||
| :map-configuration="store.mapConfiguration" | ||
| :service-register="store.serviceRegister" | ||
| /> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import { ref, useTemplateRef, watch } from 'vue' | ||
|
|
||
| import { addPlugins, getStore, subscribe } from '@polar/polar' | ||
| import type { PolarContainer } from '@polar/polar' | ||
| import pluginIconMenu from '@polar/polar/plugins/iconMenu' | ||
| import pluginFullscreen from '@polar/polar/plugins/fullscreen' | ||
| import pluginToast from '@polar/polar/plugins/toast' | ||
|
|
||
| import { useIcebergStore } from '../stores/iceberg' | ||
|
|
||
| const store = useIcebergStore() | ||
|
|
||
| const language = ref('de') | ||
|
|
||
| const map = useTemplateRef<typeof PolarContainer>('map') | ||
| watch(map, (map) => { | ||
| if (!map) { | ||
| return | ||
| } | ||
| addPlugins(map, [ | ||
| pluginIconMenu({ | ||
| displayComponent: true, | ||
| layoutTag: 'TOP_RIGHT', | ||
| menus: [ | ||
| { | ||
| plugin: pluginFullscreen(), | ||
| hint: 'Full of yourself', | ||
| }, | ||
| ], | ||
| }), | ||
dopenguin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| pluginToast({ | ||
| displayComponent: true, | ||
| layoutTag: 'BOTTOM_MIDDLE', | ||
| }), | ||
| ]) | ||
|
|
||
| subscribe(map, 'core', 'language', (newLanguage) => { | ||
| language.value = newLanguage as string | ||
| }) | ||
| }) | ||
|
|
||
| function switchLanguage() { | ||
| if (!map.value) { | ||
| return | ||
| } | ||
|
|
||
| const coreStore = getStore(map.value, 'core') | ||
| coreStore.language = language.value === 'de' ? 'en' : 'de' | ||
| } | ||
| </script> | ||
|
|
||
| <style scoped> | ||
| @import url('@polar/polar/polar.css'); | ||
|
|
||
| polar-map { | ||
| display: block; | ||
| width: 100%; | ||
| height: 20em; | ||
| } | ||
| </style> | ||
|
|
||
| <style module> | ||
| .language-chooser { | ||
| margin-bottom: 1em; | ||
| } | ||
| </style> | ||
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,47 @@ | ||
| <template> | ||
| <fieldset class="kern-fieldset"> | ||
| <legend class="kern-label">Welches Kartenlayout möchten Sie nutzen?</legend> | ||
| <div class="kern-fieldset__body"> | ||
| <div | ||
| v-for="layout of layouts" | ||
| :key="layout.value" | ||
| class="kern-form-check" | ||
| > | ||
| <input | ||
| :id="`${id}-${layout.value}`" | ||
| v-model="store.mapConfiguration.layout" | ||
| class="kern-form-check__radio" | ||
| :name="`${id}-layout`" | ||
| type="radio" | ||
| :value="layout.value" | ||
| /> | ||
| <label :for="`${id}-${layout.value}`" class="kern-label"> | ||
| {{ layout.label }} | ||
| </label> | ||
| </div> | ||
| </div> | ||
| </fieldset> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| import type { MapConfiguration } from '@polar/polar' | ||
| import { useId } from 'vue' | ||
| import { useIcebergStore } from '../stores/iceberg' | ||
|
|
||
| const id = useId() | ||
| const store = useIcebergStore() | ||
|
|
||
| const layouts = [ | ||
| { | ||
| value: 'standard', | ||
| label: 'Standard-Layout', | ||
| }, | ||
| { | ||
| value: 'nineRegions', | ||
| label: 'Klassisches Layout', | ||
| }, | ||
| ] satisfies { | ||
| value: MapConfiguration['layout'] | ||
| label: string | ||
| }[] | ||
| </script> |
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,55 @@ | ||
| <template> | ||
| <div class="kern-task-list"> | ||
| <div class="kern-task-list__header"> | ||
| <h2 class="kern-heading-medium">Karte konfigurieren</h2> | ||
| </div> | ||
| <ul class="kern-task-list__list"> | ||
| <li | ||
| v-for="(task, idx) of configTasks" | ||
| :key="idx" | ||
| class="kern-task-list__item" | ||
| > | ||
| <span class="kern-number">{{ idx + 1 }}</span> | ||
| <div :id="`task${idx + 1}-title`" class="kern-task-list__title"> | ||
| <a | ||
| href="#" | ||
| class="kern-link kern-link--stretched" | ||
| @click.prevent="emit('select', task.id)" | ||
| > | ||
| {{ task.label }} | ||
| </a> | ||
| </div> | ||
| </li> | ||
| </ul> | ||
| <div class="kern-task-list__header"> | ||
| <h2 class="kern-heading-medium">Eisberg-Meldung</h2> | ||
| </div> | ||
| <ul class="kern-task-list__list"> | ||
| <li class="kern-task-list__item"> | ||
| <span class="kern-number">{{ props.configTasks.length + 1 }}</span> | ||
| <div :id="`task-map-title`" class="kern-task-list__title"> | ||
| <a | ||
| href="#" | ||
| class="kern-link kern-link--stretched" | ||
| @click="emit('select', 'map')" | ||
| > | ||
| Karte anzeigen | ||
| </a> | ||
| </div> | ||
| </li> | ||
| </ul> | ||
| </div> | ||
| </template> | ||
|
|
||
| <script setup lang="ts"> | ||
| const props = defineProps<{ | ||
| configTasks: { | ||
| id: string | ||
| label: string | ||
| }[] | ||
| }>() | ||
|
|
||
| const emit = defineEmits<{ | ||
| select: [string] | ||
| }>() | ||
| </script> |
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 |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| import { createApp } from 'vue' | ||
| import { createPinia } from 'pinia' | ||
| import { register as registerPolar } from '@polar/polar' | ||
| import App from './App.vue' | ||
| createApp(App).mount('#app') | ||
|
|
||
| registerPolar() | ||
| createApp(App).use(createPinia()).mount('#app') |
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,9 @@ | ||
| import type { PolarContainer } from '@polar/polar' | ||
|
|
||
| declare module 'vue' { | ||
| interface GlobalComponents { | ||
| /* eslint-disable @typescript-eslint/naming-convention */ | ||
| 'polar-map': typeof PolarContainer | ||
| /* eslint-enable @typescript-eslint/naming-convention */ | ||
| } | ||
| } |
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.