Skip to content

Commit

Permalink
Factorize legal (#40) (#41)
Browse files Browse the repository at this point in the history
* 1.1.0-RC1

* feat: factorize legal notice in common, adapt conf
  • Loading branch information
MaYohann authored Mar 7, 2024
1 parent 91c093f commit e29f0e8
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 83 deletions.
45 changes: 38 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"dependencies": {
"@kyvg/vue3-notification": "^2.9.0",
"@pinia/testing": "^0.0.14",
"@sigrennesmetropole/cooperation_jn_common_ui": "0.0.36",
"@sigrennesmetropole/cooperation_jn_common_ui": "0.0.37",
"@tailwindcss/forms": "^0.5.3",
"@turf/boolean-intersects": "^6.5.0",
"@turf/distance": "^6.5.0",
Expand Down Expand Up @@ -59,6 +59,7 @@
"@import-meta-env/typescript": "^0.3.1",
"@import-meta-env/unplugin": "^0.4.8",
"@rushstack/eslint-patch": "^1.1.4",
"@types/dompurify": "^3.0.5",
"@types/jest": "^29.4.0",
"@types/jsdom": "^20.0.0",
"@types/node": "^17.0.29",
Expand Down
8 changes: 4 additions & 4 deletions src/components/legal/CGULegal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ let configStore = useConfigStore()
<UiCGULegal>
<li>
<a
:href="configStore.config?.wave.carte_ondes_url"
:href="configStore.config?.wave.links.carte_ondes_url"
target="_blank"
class="underline"
>{{ configStore.config?.wave.carte_ondes_url }}</a
>{{ configStore.config?.wave.links.carte_ondes_url }}</a
>
: ce site permet la consultation des mesures en temps réel d'exposition
aux ondes électromagnétiques
</li>
<li>
<a
:href="configStore.config?.wave.carto_radio_url"
:href="configStore.config?.wave.links.carto_radio_url"
target="_blank"
class="underline"
>{{ configStore.config?.wave.carto_radio_url }}</a
>{{ configStore.config?.wave.links.carto_radio_url }}</a
>
: ce site permet la consultation à la fois des mesures ponctuelles et des
sites émetteurs d'ondes au sein de la Ville de Rennes
Expand Down
4 changes: 2 additions & 2 deletions src/components/legal/LegalNotice.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ let configStore = useConfigStore()

<template>
<UiLegalNotice
:contact_link="configStore.config?.link.contact_link"
:current_url="configStore.config?.link.ondes_link"
:contact_link="configStore.config?.common.links.contact_link!"
:current_url="configStore.config?.common.links.ondes_link!"
>
</UiLegalNotice>
</template>
4 changes: 2 additions & 2 deletions src/components/legal/PrivacyLegal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ let configStore = useConfigStore()

<template>
<UiPrivacyLegal
:current_url="configStore.config?.link.ondes_link"
:contact_link="configStore.config?.link.contact_link"
:current_url="configStore.config?.common.links.ondes_link!"
:contact_link="configStore.config?.common.links.contact_link!"
>
</UiPrivacyLegal>
</template>
8 changes: 4 additions & 4 deletions src/components/legal/SiteMap.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ let configStore = useConfigStore()
</script>
<template>
<UiSiteMap
:coopterr_url="configStore.config?.link.coopterr_link"
:ondes_url="configStore.config?.link.ondes_link"
:solaire_url="configStore.config?.link.solar_link"
:trambus_url="configStore.config?.link.trambus_link"
:coopterr_url="configStore.config?.common.links.coopterr_link!"
:ondes_url="configStore.config?.common.links.ondes_link!"
:solaire_url="configStore.config?.common.links.solar_link!"
:trambus_url="configStore.config?.common.links.trambus_link!"
>
</UiSiteMap>
</template>
18 changes: 10 additions & 8 deletions src/components/search_bar/SearchBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import InputSearch from '@/components/search_bar/InputSearch.vue'
import { createVPForTypeAddress, addPin } from '@/services/searchBarService'
// @ts-ignore : Could not find a declaration file for module 'dompurify'
import DOMPurify from 'dompurify'
import { getNumberFromConfig } from '@/services/configService'
import { useConfigStore } from '@/stores/config'
const props = defineProps({
isRedirectOnSearch: {
Expand All @@ -33,6 +33,7 @@ const props = defineProps({
const search = ref('')
const addressStore = useAddressStore()
const router = useRouter()
const configStore = useConfigStore()
const autocompletion: Ref<AutoCompletion> = ref({
addressRva: [],
Expand Down Expand Up @@ -73,13 +74,14 @@ onMounted(() => {
if (addressStore.address !== '') {
search.value = addressStore.address
}
size_begin_search = getNumberFromConfig('address.size_begin_search')
nb_addresses_rva = getNumberFromConfig('address.nb_addresses_rva')
nb_addresses_organization = getNumberFromConfig(
'address.nb_addresses_organization'
)
nb_addresses_communes = getNumberFromConfig('address.nb_addresses_communes')
nb_addresses_streets = getNumberFromConfig('address.nb_addresses_streets')
size_begin_search = configStore.config?.common.address.size_begin_search!
nb_addresses_rva = configStore.config?.common.address.nb_addresses_rva!
nb_addresses_organization =
configStore.config?.common.address.nb_addresses_organization!
nb_addresses_communes =
configStore.config?.common.address.nb_addresses_communes!
nb_addresses_streets =
configStore.config?.common.address.nb_addresses_streets!
})
function searchFiltered() {
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/WaveObservatoryComponent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useConfigStore } from '@/stores/config'
let configStore = useConfigStore()
function goToWaveObservatory() {
window.open(configStore.config?.wave.carte_ondes_url, '_blank')
window.open(configStore.config?.wave.links.carte_ondes_url, '_blank')
}
</script>

Expand Down
33 changes: 0 additions & 33 deletions src/services/configService.ts

This file was deleted.

22 changes: 1 addition & 21 deletions src/stores/config.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,7 @@
import { ref } from 'vue'
import type { Ref } from 'vue'
import { defineStore } from 'pinia'

type ConfigType = {
address: {
size_begin_search: number
nb_addresses_rva: number
nb_addresses_organization: number
nb_addresses_communes: number
nb_addresses_streets: number
}
link: {
coopterr_link: string
solar_link: string
trambus_link: string
ondes_link: string
contact_link: string
}
wave: {
carte_ondes_url: string
carto_radio_url: string
}
}
import type { ConfigType } from '@sigrennesmetropole/cooperation_jn_common_ui'

export const useConfigStore = defineStore('configStore', () => {
const config: Ref<ConfigType | null> = ref(null)
Expand Down

0 comments on commit e29f0e8

Please sign in to comment.