Skip to content

Commit

Permalink
feat: add public transit for tenants
Browse files Browse the repository at this point in the history
  • Loading branch information
tjorbo committed Dec 11, 2023
1 parent 013cc94 commit 4bd0835
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/components/details/NahShLink.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<template>
<info-detail img-alt="NAH.SH">
<info-detail img-alt="ÖPNV">
<template #icon>
<icon-nah-sh/>
<icon-vbn
v-if="tenant === 'hb'"
/>
<icon-nah-sh
v-else
/>
</template>
<template #text>
<a :href="nahShLink" target="_blank">{{ linkText }}</a>
Expand All @@ -19,7 +24,7 @@ export default {
props: {
linkText: {
type: String,
default: i18n.t('nahSh.showDepartures')
default: process.env.VUE_APP_TENANT === 'hb' ? i18n.t('vbn.showDepartures') : i18n.t('nahSh.showDepartures')
},
startPos: {
type: [Object, Boolean],
Expand All @@ -36,6 +41,9 @@ export default {
},
computed: {
nahShLink() {
if (process.env.VUE_APP_TENANT === 'hb') {
return 'https://www.vbn.de/fahrplaner'
}
return `https://nah.sh.hafas.de/bin/query.exe/dn?SID=${this.nahShSID}&ZID=${this.nahShZID}&date=${this.nahShDate}&time=${this.nahShTime}&timesel=depart&externalCall=yes&start=yes`
},
nahShSID() {
Expand All @@ -60,7 +68,8 @@ export default {
},
nahShTime() {
return moment().format('HH:mm')
}
},
tenant: function () { return process.env.VUE_APP_TENANT }
},
methods: {
/*
Expand Down
5 changes: 5 additions & 0 deletions src/components/icons/IconVbn.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<path
d="m 7.3438561,1.7610509 c -1.8140336,0 -3.9909804,1.0147481 -3.9909804,3.748957 v 7.4445351 5.188826 c 0,0 0,1.365193 1.3303268,1.365193 v 1.365194 c 0,0 0,1.365193 1.3303268,1.365193 1.3303268,0 1.3303268,-1.365193 1.3303268,-1.365193 v -1.365194 h 9.3122879 v 1.365194 c 0,0 0,1.365193 1.330327,1.365193 1.330327,0 1.330327,-1.365193 1.330327,-1.365193 v -1.365194 c 0,0 1.330326,0 1.330326,-1.365193 V 5.5100079 c 0,-2.7925027 -1.644284,-3.748957 -3.458317,-3.748957 z m 0.3325817,2.0477898 h 8.6471242 c 0.18425,0 0.332582,0.1522191 0.332582,0.3412984 0,0.1890793 -0.148332,0.3412982 -0.332582,0.3412982 H 7.6764378 c -0.1842503,0 -0.3325817,-0.1522189 -0.3325817,-0.3412982 0,-0.1890793 0.1483314,-0.3412984 0.3325817,-0.3412984 z M 6.0135293,5.8566305 H 17.986471 c 1.330327,0 1.330327,1.3198688 1.330327,1.3198688 v 4.1409037 c 0,0 0,1.365193 -1.330327,1.365193 H 6.0135293 c -1.3303268,0 -1.3303268,-1.365193 -1.3303268,-1.365193 V 7.2218237 c 0,0 0,-1.3651932 1.3303268,-1.3651932 z m 0,9.5563525 c 0.7347395,0 1.3303268,0.611197 1.3303268,1.365193 0,0.753997 -0.5955873,1.365194 -1.3303268,1.365194 -0.7347395,0 -1.3303268,-0.611198 -1.3303268,-1.365194 0,-0.753996 0.5955873,-1.365193 1.3303268,-1.365193 z m 11.9729417,0 c 0.734739,0 1.330327,0.611197 1.330327,1.365193 0,0.753997 -0.595588,1.365194 -1.330327,1.365194 -0.73474,0 -1.330327,-0.611198 -1.330327,-1.365194 0,-0.753996 0.595587,-1.365193 1.330327,-1.365193 z"
/>
</template>
2 changes: 2 additions & 0 deletions src/icons.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import IconSearch from './components/icons/IconSearch.vue'
import IconSettings from './components/icons/IconSettings.vue'
import IconTriangleUp from './components/icons/IconTriangleUp.vue'
import IconTriangleDown from './components/icons/IconTriangleDown.vue'
import IconVbn from './components/icons/IconVbn.vue'
import IconControls from './components/icons/IconControls.vue'
import IconClose from './components/icons/IconClose.vue'
import IconInfo from './components/icons/IconInfo.vue'
Expand Down Expand Up @@ -56,6 +57,7 @@ Vue.component('IconSearch', IconSearch)
Vue.component('IconSettings', IconSettings)
Vue.component('IconTriangleUp', IconTriangleUp)
Vue.component('IconTriangleDown', IconTriangleDown)
Vue.component('IconVbn', IconVbn)
Vue.component('IconControls', IconControls)
Vue.component('IconClose', IconClose)
Vue.component('IconInfo', IconInfo)
Expand Down
3 changes: 3 additions & 0 deletions src/locales/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,9 @@
"start": "Din position"
}
},
"vbn": {
"showDepartures": "Vis afgangstider for VBN"
},
"socialLinks": {
"noSocialMedia": "Der findes ingen sociale netværk."
},
Expand Down
3 changes: 3 additions & 0 deletions src/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,9 @@
"start": "Ihr Standort"
}
},
"vbn": {
"showDepartures": "VBN Fahrzeiten anzeigen"
},
"socialLinks": {
"noSocialMedia": "Keine sozialen Netzwerke vorhanden."
},
Expand Down
3 changes: 3 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,9 @@
"start": "Your location"
}
},
"vbn": {
"showDepartures": "Show VBN timetable"
},
"socialLinks": {
"noSocialMedia": "No existing social networks."
},
Expand Down

0 comments on commit 4bd0835

Please sign in to comment.