Skip to content

Commit

Permalink
Standardize securing footer
Browse files Browse the repository at this point in the history
  • Loading branch information
thomashbrnrd authored and nutfdt committed Jun 3, 2024
1 parent 751bd1f commit e561dc7
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 63 deletions.
12 changes: 6 additions & 6 deletions frontend/src/components/ResultPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const img = computed(() => resultStore.img)
const typology = TYPOLOGIES[resultStore.typology]
const isDummy = computed(() => stepsStore.isDummy)
const hasGuideDummy = typology?.guideDummy !== undefined
const hasDummyOptions = typology?.dummyOptions !== undefined
const isCardDetected = computed(() => resultStore.gunLength !== null && resultStore.gunBarrelLength !== null)
const isUp = ref(false)
Expand Down Expand Up @@ -75,7 +75,7 @@ function sendFeedback (isCorrect: boolean) {
<div class="result-frame -mx-8 py-5 px-8">
<div class="result">
<h2
v-if="$route.name === 'IdentificationTypologyResult' && hasGuideDummy"
v-if="$route.name === 'IdentificationTypologyResult' && hasDummyOptions"
class="typology-title bg-white py-4"
>
Typologie de l'arme
Expand Down Expand Up @@ -144,7 +144,7 @@ function sendFeedback (isCorrect: boolean) {
>
{{ label }}
</h3>
<template v-if="confidenceLevel !== 'low' && ($route.name !== 'IdentificationTypologyResult' || !hasGuideDummy)">
<template v-if="confidenceLevel !== 'low' && ($route.name !== 'IdentificationTypologyResult' || !hasDummyOptions)">
<h3
class="fr-alert__title"
data-testid="arm-category"
Expand All @@ -157,14 +157,14 @@ function sendFeedback (isCorrect: boolean) {
</template>
</div>
<div
v-if="disclaimer && confidenceLevel !== 'low' && ($route.name !== 'IdentificationTypologyResult' || !hasGuideDummy)"
v-if="disclaimer && confidenceLevel !== 'low' && ($route.name !== 'IdentificationTypologyResult' || !hasDummyOptions)"
class="fr-alert fr-alert--warning"
>
<p v-html="disclaimer" />
</div>
<MissingCardAlert v-if="MEASURED_GUNS_TYPOLOGIES.includes(typology) && isCardDetected === false && isDummy == false" />
<div
v-if="confidenceLevel !== 'low' && ($route.name !== 'IdentificationTypologyResult' || !hasGuideDummy)"
v-if="confidenceLevel !== 'low' && ($route.name !== 'IdentificationTypologyResult' || !hasDummyOptions)"
class="fr-callout mt-3"
>
<p class="fr-callout__text">
Expand All @@ -178,7 +178,7 @@ function sendFeedback (isCorrect: boolean) {
</p>
</div>
<div
v-if="confidenceLevel !== 'low' && $route.name === 'IdentificationTypologyResult' && hasGuideDummy"
v-if="confidenceLevel !== 'low' && $route.name === 'IdentificationTypologyResult' && hasDummyOptions"
class="fr-alert fr-alert--warning"
>
<p>
Expand Down
22 changes: 9 additions & 13 deletions frontend/src/utils/firearms-utils/epaule-a-verrou.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,16 @@ export const epaule_a_verrou = {
],
},
],
guideDummy: [
dummyOptions: [
{
options: [
{
label: 'Balles',
value: 'cartouches',
img_ammo: epauleAVerrouCartridges,
},
{
label: 'Billes ou trou pour billes',
value: 'billes',
img_ammo: epauleAVerrouBalls,
},
],
label: 'Balles',
value: 'cartouches',
img_ammo: epauleAVerrouCartridges,
},
{
label: 'Billes ou trou pour billes',
value: 'billes',
img_ammo: epauleAVerrouBalls,
},
],
getDisclaimer: getEpaulLevierVerrouDisclaimer,
Expand Down
22 changes: 9 additions & 13 deletions frontend/src/utils/firearms-utils/pistolet-semi-auto-moderne.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,16 @@ export const pistolet_semi_auto_moderne = {
],
},
],
guideDummy: [
dummyOptions: [
{
options: [
{
label: 'Cartouches',
value: 'cartouches',
img_ammo: pistoletSemiAutoModerneCartridges,
},
{
label: 'Billes',
value: 'billes',
img_ammo: pistoletSemiAutoModerneBalls,
},
],
label: 'Cartouches',
value: 'cartouches',
img_ammo: pistoletSemiAutoModerneCartridges,
},
{
label: 'Billes',
value: 'billes',
img_ammo: pistoletSemiAutoModerneBalls,
},
],
getDisclaimer: (category: string) => {
Expand Down
22 changes: 9 additions & 13 deletions frontend/src/utils/firearms-utils/revolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,20 +163,16 @@ export const revolver = {
],
},
],
guideDummy: [
dummyOptions: [
{
options: [
{
label: 'Balles',
value: 'cartouches',
img_ammo: revolverCartridges,
},
{
label: 'Billes ou trou pour billes',
value: 'billes',
img_ammo: revolverBalls,
},
],
label: 'Balles',
value: 'cartouches',
img_ammo: revolverCartridges,
},
{
label: 'Billes ou trou pour billes',
value: 'billes',
img_ammo: revolverBalls,
},
],
getDisclaimer: (category: string) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,20 +101,16 @@ export const semi_auto_style_militaire_autre = {
],
},
],
guideDummy: [
dummyOptions: [
{
options: [
{
label: 'Cartouches',
value: 'cartouches',
img_ammo: semiAutoMilitaireCartridges,
},
{
label: 'Billes',
value: 'billes',
img_ammo: semiAutoMilitaireBalls,
},
],
label: 'Cartouches',
value: 'cartouches',
img_ammo: semiAutoMilitaireCartridges,
},
{
label: 'Billes',
value: 'billes',
img_ammo: semiAutoMilitaireBalls,
},
],
getDisclaimer: () => "<strong>Catégorie A</strong> si à l'origine l’arme était à <strong>répétition automatique</strong> puis a été <strong>transformée</strong> en arme <strong>semi automatique</strong>, ou si l’arme possède <strong>une crosse rétractable / pliable</strong> et qu’en configuration la plus courte elle <strong>mesure moins de 60 cm</strong>.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const currentStep = ref(1)
const isLowConfidence = confidenceLevel.value === 'low'
const steps = computed(() => {
if (TYPOLOGIES[typology]?.guideDummy || !isLowConfidence) {
if (TYPOLOGIES[typology]?.dummyOptions || !isLowConfidence) {
if (ALARM_GUNS_TYPOLOGIES.includes(resultStore.typology) && stepsStore.selectedAmmo === 'cartouches') {
return ['Typologie de l\'arme', 'Compléments', 'Typologie de munitions', 'Identification d\'une arme d\'alarme', 'Résultat final']
} else {
Expand Down Expand Up @@ -97,7 +97,7 @@ const showDiv = ref(false)
<div class="mt-5 fr-container">
<div class="result fr-col-11 fr-col-lg-6 mx-auto">
<StepsGuide
v-if="TYPOLOGIES[typology]?.guideDummy"
v-if="TYPOLOGIES[typology]?.dummyOptions"
class="!fr-container my-auto"
:steps="steps"
:current-step="currentStep"
Expand All @@ -106,7 +106,7 @@ const showDiv = ref(false)
</div>
</div>
<div
v-if="$route.path === '/guide-identification/resultat-final' || TYPOLOGIES[typology]?.guideDummy == undefined"
v-if="$route.path === '/guide-identification/resultat-final' || TYPOLOGIES[typology]?.dummyOptions == undefined"
class="footer end z-1"
>
<div class="fr-col-11 fr-col-lg-6 mx-auto">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ onMounted(() => {
})
// eslint-disable-next-line camelcase
type HasGuideDummy = typeof epaule_a_verrou | typeof pistolet_semi_auto_moderne | typeof semi_auto_style_militaire_autre | typeof revolver
type HasDummyOptions = typeof epaule_a_verrou | typeof pistolet_semi_auto_moderne | typeof semi_auto_style_militaire_autre | typeof revolver
</script>
<template>
Expand Down Expand Up @@ -123,7 +123,7 @@ type HasGuideDummy = typeof epaule_a_verrou | typeof pistolet_semi_auto_moderne
</div>
<div>
<template
v-for="(option) in (TYPOLOGIES[typology] as HasGuideDummy)?.guideDummy[0].options"
v-for="(option) in (TYPOLOGIES[typology] as HasDummyOptions)?.dummyOptions"
:key="option.value"
>
<div class="item">
Expand Down

0 comments on commit e561dc7

Please sign in to comment.