Skip to content

Commit

Permalink
Add more ContactExpert buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
thomashbrnrd committed Jan 31, 2024
1 parent 95711aa commit 01e0a9a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
3 changes: 3 additions & 0 deletions frontend/src/components/ResultPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { ref, computed, watchEffect } from 'vue'
import axios from 'axios'
import SnackbarAlert from '@/components/SnackbarAlert.vue'
import { resultTree } from '@/utils/firearms-utils/index'
import { isUserUsingCrosscall } from '@/utils/isUserUsingCrosscall'
import { useSnackbarStore } from '@/stores/snackbar'
import { useStepsStore } from '@/stores/steps'
import { useResultStore } from '@/stores/result'
Expand Down Expand Up @@ -122,6 +123,7 @@ function sendFeedback (isCorrect: boolean) {
<p class="text-sm font-normal m-4 text-left text-current">
Nous n'avons pas suffisamment d'éléments pour fournir une réponse fiable. Nous vous conseillons de faire appel à un expert.
</p>
<ContactExpert v-if="isUserUsingCrosscall()" />
</div>
<div v-else>
<div class="fr-tile__body">
Expand All @@ -141,6 +143,7 @@ function sendFeedback (isCorrect: boolean) {
<p class="warning-text">
Nous vous conseillons de faire appel à un expert pour confirmer cette réponse.
</p>
<ContactExpert v-if="isUserUsingCrosscall()" />
</div>
<div v-if="isDummy === false && (route.name !== 'IdentificationTypologyResult'|| isDummyTypology !== true)">
<p
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/utils/isUserUsingCrosscall.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export function isUserUsingCrosscall () {
const userAgent = window.navigator.userAgent
const keyWords = ['Mobile', 'Mozilla', 'Crosscall']

const isUsingCrosscall = keyWords.every(keyWord => {
return userAgent.includes(keyWord)
})
return isUsingCrosscall
}
12 changes: 2 additions & 10 deletions frontend/src/views/GuideSecuringFirearm/SecuringAchievement.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,12 @@ import { computed } from 'vue'
import { useResultStore } from '@/stores/result'
import { resultTree } from '@/utils/firearms-utils/index'
import { isUserUsingCrosscall } from '@/utils/isUserUsingCrosscall'
import { DsfrButton } from '@gouvminint/vue-dsfr'
const resultStore = useResultStore()
const typology = computed(() => resultStore.typology)
const userAgent = window.navigator.userAgent
const keyWords = ['Mobile', 'Mozilla', 'Crosscall']
const foundAllKeyWords = keyWords.every(keyWord => {
return userAgent.includes(keyWord)
})
</script>

<template>
Expand All @@ -40,9 +34,7 @@ const foundAllKeyWords = keyWords.every(keyWord => {
class="img-deco"
>
</div>
<div v-if="foundAllKeyWords">
<ContactExpert />
</div>
<ContactExpert v-if="isUserUsingCrosscall()" />
</div>
<div v-else>
<h2 class="mt-5 text-center">
Expand Down

0 comments on commit 01e0a9a

Please sign in to comment.