Skip to content

Commit 8b1661a

Browse files
committed
Bugfixing + Aria-Labels + tooltip
1 parent 559dc86 commit 8b1661a

File tree

7 files changed

+93
-120
lines changed

7 files changed

+93
-120
lines changed

packages/clients/snowbox/src/mapConfiguration.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,8 @@ export const mapConfiguration = {
281281
},
282282
},
283283
addressSearch: {
284+
addLoading: 'plugin/loadingIndicator/addLoadingKey',
285+
removeLoading: 'plugin/loadingIndicator/removeLoadingKey',
284286
searchMethods: [
285287
{
286288
queryParameters: {
@@ -294,6 +296,10 @@ export const mapConfiguration = {
294296
],
295297
minLength: 3,
296298
waitMs: 300,
299+
loadingIndicator: {
300+
loaderStyle: 'SpinnerLoader',
301+
displayComponent: true,
302+
},
297303
},
298304
},
299305
}

packages/plugins/Routing/src/components/Routing.vue

Lines changed: 78 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<v-text-field
1212
v-model="startpointInput"
1313
:label="$t('common:plugins.routing.startLabel')"
14+
:aria-label="$t('common:plugins.routing.startLabel')"
1415
@input="handleAddressSearch('start')"
1516
></v-text-field>
1617
<v-list
@@ -36,6 +37,7 @@
3637
<v-text-field
3738
v-model="endpointInput"
3839
:label="$t('common:plugins.routing.endLabel')"
40+
:aria-label="$t('common:plugins.routing.endLabel')"
3941
@input="handleAddressSearch('end')"
4042
></v-text-field>
4143
<v-list
@@ -57,47 +59,60 @@
5759
</v-list>
5860
</div>
5961

60-
<v-btn @click="reset"
62+
<v-btn
63+
:aria-label="$t('common:plugins.routing.resetButton')"
64+
@click="reset"
6165
>{{ $t('common:plugins.routing.resetButton') }}
6266
</v-btn>
6367

6468
<v-select
6569
v-model="selectedTravelModeItem"
66-
clearable
6770
:label="$t('common:plugins.routing.modeLabel')"
71+
:aria-label="$t('common:plugins.routing.modeLabel')"
6872
:items="translatedTravelModeOptions"
6973
item-value="key"
7074
item-text="translatedKey"
7175
></v-select>
7276
<v-select
7377
v-model="selectedPreferenceItem"
74-
clearable
7578
:label="$t('common:plugins.routing.preferenceLabel')"
79+
:aria-label="$t('common:plugins.routing.preferenceLabel')"
7680
:items="translatedPreferenceOptions"
7781
item-value="key"
7882
item-text="translatedKey"
7983
></v-select>
8084

81-
<div>
85+
<div class="select">
8286
{{ $t('common:plugins.routing.avoidRoutesTitle') }}
83-
<v-layout row wrap>
84-
<v-flex>
85-
<v-checkbox
86-
v-for="(routeType, i) in selectableRouteTypesToAvoid"
87-
:key="i"
88-
v-model="selectedRouteTypesToAvoidItem"
89-
:label="$t(translatedRouteTypeToAvoid(routeType.key))"
90-
:value="routeType.key"
91-
></v-checkbox>
92-
</v-flex>
93-
</v-layout>
94-
</div>
87+
<v-checkbox
88+
v-for="(routeType, i) in RouteTypesToAvoidForSelectedProfile"
89+
:key="i"
90+
v-model="selectedRouteTypesToAvoidItem"
91+
:label="$t(translatedRouteTypeToAvoid(routeType.key))"
92+
:aria-label="$t(translatedRouteTypeToAvoid(routeType.key))"
93+
:value="routeType.key"
94+
></v-checkbox>
9595

96-
<v-btn :disabled="disableSendButton" @click="sendRequest">{{
97-
$t('common:plugins.routing.sendRequestButton')
98-
}}</v-btn>
96+
</div>
97+
<v-tooltip left :disabled="!areFieldsMissing">
98+
<template #activator="{ on }">
99+
<div v-on="on">
100+
<v-btn
101+
:aria-label="$t('common:plugins.routing.sendRequestButton')"
102+
:disabled="areFieldsMissing"
103+
@click="sendRequest"
104+
>
105+
{{ $t('common:plugins.routing.sendRequestButton') }}
106+
</v-btn>
107+
</div>
108+
</template>
109+
<span>{{ $t('common:plugins.routing.toolTip') }}</span>
110+
</v-tooltip>
99111

100-
<v-btn @click="showSteps = !showSteps">
112+
<v-btn
113+
:aria-label="$t('common:plugins.routing.routeDetails')"
114+
@click="showSteps = !showSteps"
115+
>
101116
{{ $t('common:plugins.routing.routeDetails') }}
102117
</v-btn>
103118
<div v-if="showSteps && Object.keys(searchResponseData).length !== 0">
@@ -121,7 +136,6 @@ export default Vue.extend({
121136
showSteps: false,
122137
startDropdownOpen: false,
123138
endDropdownOpen: false,
124-
disableSendButton: false,
125139
}),
126140
computed: {
127141
...mapGetters(['hasSmallDisplay']),
@@ -132,16 +146,15 @@ export default Vue.extend({
132146
'selectableTravelModes',
133147
'selectablePreferences',
134148
'selectableRouteTypesToAvoid',
135-
// TODO: warum ist selectedRTTA aufgezählt, aber selectedPreferences nicht? Kann beides raus?
136149
'selectedRouteTypesToAvoid',
150+
'selectedTravelMode',
151+
'selectedPreference',
137152
'searchResults',
138153
'searchResponseData',
139154
'start',
140155
'end',
141156
'startAddress',
142157
'endAddress',
143-
// TODO: löschen, falls es sich in debouncedSendSearchRequest nicht einfügen lässt
144-
'waitMs',
145158
]),
146159
startpointInput: {
147160
get() {
@@ -222,19 +235,47 @@ export default Vue.extend({
222235
return this.selectedRouteTypesToAvoid
223236
},
224237
set(value: string): void {
225-
console.error(this.selectedRouteTypesToAvoid)
226238
this.setSelectedRouteTypesToAvoid(value)
227239
},
228240
},
229241
searchResponseSegments: {
230242
get(): object {
231-
console.error(
232-
'Search Response Segments or Steps: ',
233-
this.searchResponseData.features[0].properties.segments[0].steps
234-
)
235243
return this.searchResponseData.features[0].properties.segments[0].steps
236244
},
237245
},
246+
RouteTypesToAvoidForSelectedProfile() {
247+
if (
248+
this.selectedTravelMode === 'driving-car' ||
249+
this.selectedTravelMode === 'driving-hgv' ||
250+
this.selectedTravelMode === ''
251+
) {
252+
return this.selectableRouteTypesToAvoid
253+
}
254+
return [
255+
{
256+
key: 'ferries',
257+
localKey: 'common:plugins.routing.avoidRoutes.ferries',
258+
},
259+
]
260+
},
261+
areFieldsMissing() {
262+
const areStartAndStartAddressMissing =
263+
this.start.length === 0 && this.startAddress === ''
264+
const areEndAndEndAddressMissing =
265+
this.end.length === 0 && this.endAddress === ''
266+
const isSelectedTravelModeMissing = this.selectedTravelMode === ''
267+
const isSelectedPreferenceMissing = this.selectedPreference === ''
268+
const isSelectedRouteTypesToAvoidMissing =
269+
this.selectedRouteTypesToAvoid.length === 0
270+
271+
return Boolean(
272+
areStartAndStartAddressMissing ||
273+
areEndAndEndAddressMissing ||
274+
isSelectedTravelModeMissing ||
275+
isSelectedPreferenceMissing ||
276+
isSelectedRouteTypesToAvoidMissing
277+
)
278+
},
238279
},
239280
mounted() {
240281
this.initializeTool()
@@ -259,7 +300,6 @@ export default Vue.extend({
259300
this.sendSearchRequest(payload)
260301
}, 300),
261302
handleAddressSearch(inputType) {
262-
console.error(inputType)
263303
const input =
264304
inputType === 'start' ? this.startpointInput : this.endpointInput
265305
@@ -270,17 +310,9 @@ export default Vue.extend({
270310
this.startDropdownOpen = false
271311
this.endDropdownOpen = true
272312
}
273-
this.debouncedSendSearchRequest({ input, inputType })
274-
},
275-
disableSendRequest() {
276-
console.error('Ist der Send-Button disabled?', this.disableSendButton)
277-
(this.selectedTravelMode &&
278-
this.selectedPreference &&
279-
this.selectedRouteTypesToAvoid
280-
)
281-
? this.disableSendButton = true
282-
: this.disableSendButton = false
283-
console.error('Ist der Send-Button disabled?', this.disableSendButton)
313+
this.$nextTick(() => {
314+
this.debouncedSendSearchRequest({ input, inputType })
315+
})
284316
},
285317
reset() {
286318
this.showSteps = false
@@ -290,7 +322,6 @@ export default Vue.extend({
290322
if (result.strassenname) {
291323
this.startpointInput = result.displayName
292324
this.setStart(result.position)
293-
console.error('Result Position:', result.position)
294325
this.setStartAddress(result.displayName)
295326
this.startDropdownOpen = false
296327
this.$nextTick(() => {
@@ -317,7 +348,6 @@ export default Vue.extend({
317348
const localKey = this.selectableRouteTypesToAvoid.find(
318349
(element) => element.key === myKey
319350
).localKey
320-
console.error(localKey)
321351
return localKey
322352
},
323353
},
@@ -334,7 +364,11 @@ export default Vue.extend({
334364
padding-left: 20px;
335365
padding-right: 20px;
336366
}
337-
367+
.select {
368+
display: flex;
369+
flex-direction: row;
370+
justify-content: center;
371+
}
338372
.dropdown {
339373
max-height: 300px; /* adjusts the hight */
340374
overflow-y: auto; /* enables scrolling */

packages/plugins/Routing/src/language.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const language: LanguageOption[] = [
3737
ferries: 'Fähren',
3838
},
3939
sendRequestButton: 'Absenden',
40+
toolTip: 'Wähle für jede Kategorie mindestens eine Option.',
4041
routeDetails: 'Details zur Route',
4142
},
4243
},
@@ -77,6 +78,7 @@ const language: LanguageOption[] = [
7778
ferries: 'ferries',
7879
},
7980
sendRequestButton: 'Send',
81+
toolTip: 'Choose at least one option for each category.',
8082
routeDetails: 'Route Details',
8183
},
8284
},

0 commit comments

Comments
 (0)