Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ✨ fix revolver with hidden door display #462

Merged
merged 1 commit into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions frontend/cypress/e2e/typology-revolver-securing.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,8 @@ describe('Typology Revolver Securing', () => {
cy.contains('Le barillet ne bascule pas').first().click()
cy.getByDataTestid('button-next').should('not.have.attr', 'disabled')
cy.getByDataTestid('button-next').click()
cy.get('.fr-accordions-group > li').first().click()
cy.getByDataTestid('button-step-mes').click({ multiple: true }, { force: true })
cy.getByDataTestid('button-next').should('not.have.attr', 'disabled')
cy.contains('h2', 'Mettre en sécurité mon arme')
cy.contains('li', 'Contrôler que chaque chambre')
cy.getByDataTestid('button-next').click()
cy.url().should('contain', '/fin-mise-en-securite')
cy.getByDataTestid('go-to-identification').click()
Expand Down
63 changes: 5 additions & 58 deletions frontend/src/utils/firearms-utils/revolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@ import revolver2EwBrisureImg from '@/assets/guide-mise-en-securite/photos/revolv
import revolver2EwBrisureVideo from '@/assets/guide-mise-en-securite/videos/revolver/revolver_ew_brisure.mp4'
import revolver2PortiereImg from '@/assets/guide-mise-en-securite/photos/revolver/revolver_2_portiere.jpg'
import revolver3PortiereImg from '@/assets/guide-mise-en-securite/photos/revolver/revolver_3_1873_FR.jpg'
// import revolver2PortiereP1Video from '@/assets/guide-mise-en-securite/videos/revolver/revolver_1873_portiere_montage_p1.mp4'
// import revolver2PortiereP2Video from '@/assets/guide-mise-en-securite/videos/revolver/revolver_1873_portiere_montage_p2.mp4'
// import revolver2PortiereP3Video from '@/assets/guide-mise-en-securite/videos/revolver/revolver_1873_portiere_montage_p3.mp4'
import revolver2PortiereP4Video from '@/assets/guide-mise-en-securite/videos/revolver/revolver_1873_portiere_montage_p4.mp4'
import revolver2PortiereP5Video from '@/assets/guide-mise-en-securite/videos/revolver/revolver_1873_portiere_montage_p5.mp4'
import revolver2PortiereP6Video from '@/assets/guide-mise-en-securite/videos/revolver/revolver_1873_portiere_montage_p6.mp4'
import revolver2PortiereP7Video from '@/assets/guide-mise-en-securite/videos/revolver/revolver_1873_portiere_montage_p7.mp4'
import revolver2PortiereVideo from '@/assets/guide-mise-en-securite/videos/revolver/revolver_1873_portiere_FR.mp4'
import revolver2SwBrisureImg from '@/assets/guide-mise-en-securite/photos/revolver/revolver_2_sw_brisure.jpg'
import revolver2SwBrisureVideo from '@/assets/guide-mise-en-securite/videos/revolver/revolver_sw_brisure.mp4'
Expand Down Expand Up @@ -129,70 +122,24 @@ export const revolver = {
// options_step_3_video_pre_text: 'Texte à afficher avant la vidéo',
options_step_3_video_post_text: 'Sélectionner le comportement de votre barillet : le barillet <span class="font-bold"> ne bascule pas</span>, ou le barillet <span class="font-bold">bascule.</span>',
options_step_3_video_title: 'Titre de la vidéo',
// options_step_3_video_caption: 'Veuillez suivre la vidéo afin de réaliser les instructions ci-dessus',
options_step_3_video: revolver2PortiereVideo,
options_step_3: {
revolver_1873_fr: {
label: 'Le barillet ne bascule pas',
value: 'revolver_1873_fr',
text_steps: {
// 1: {
// title: 'Etape 1',
// time: '4 sec',
// content: 'Observer l’arme en l’orientant dans une <span class="font-bold">direction sans risque</span>, en manipulant avec précaution',
// video: revolver2PortiereP1Video,
// },
// 2: {
// title: 'Etape 2',
// time: '10 sec',
// content: 'Tirer le haut du levier de verrouillage de barillet vers l’arrière',
// video: revolver2PortiereP2Video,
// },
// 3: {
// title: 'Etape 3',
// time: '6 sec',
// content: 'Tirer légèrement le chien/marteau vers l’arrière jusqu’à entendre un premier clic',
// video: revolver2PortiereP3Video,
// },
1: {
title: 'Etape 1',
time: '9 sec',
content: 'Faire tourner le barillet jusqu’à trouver une munition',
video: revolver2PortiereP4Video,
},
2: {
title: 'Etape 2',
time: '7 sec',
content: 'Déverrouiller la tringle d’éjection en tournant son extrémité d’un quart de tour',
video: revolver2PortiereP5Video,
},
3: {
title: 'Etape 3',
time: '18 sec',
content: 'Actionner la tringle d’extraction vers l’arrière pour chaque chambre du barillet contenant une munition',
video: revolver2PortiereP6Video,
},
4: {
title: 'Etape 4',
time: '4 sec',
content: 'Contrôler que chaque chambre est bien vide en faisant tourner le barillet',
video: revolver2PortiereP7Video,
},
// '': {
// title: 'Video intégrale',
// time: '56 sec',
// content: 'Veuillez suivre les indications dans l’ordre afin de mettre en sécurité votre arme',
// video: revolver2PortiereVideo,
// },
1: '<span class="font-bold">Faire tourner le barillet</span> jusqu’à trouver une munition',
2: '<span class="font-bold">Déverrouiller la tringle d’éjection</span> en tournant son extrémité d’un quart de tour',
3: '<span class="font-bold">Actionner la tringle d’extraction vers l’arrière</span> pour chaque chambre du barillet contenant une munition',
4: 'Contrôler que chaque chambre est bien vide en faisant tourner le barillet',
},
img: revolver3PortiereImg,
video: revolver2PortiereVideo,
},
revolver_verrou_1892: {
label: 'Le barillet bascule',
value: 'revolver_verrou_1892',
text_steps: {
// 1: 'Observer l’arme en l’orientant dans une <span class="font-bold">direction sans risque</span>, en manipulant avec précaution',
// 2: 'Tirer le haut du levier de verrouillage de barillet vers l’arrière',
1: '<span class="font-bold">Basculer le barillet</span> sur le côté',
2: 'Pencher l’arme légèrement vers l’arrière',
3: '<span class="font-bold">Vider les munitions</span> éventuelles du barillet en appuyant sur la tige d’extraction située à l’avant du barillet',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ const router = useRouter()
const resultStore = useResultStore()
const stepsStore = useStepsStore()

const expandedId = ref<string>()

const typology = computed(() => resultStore.typology)

const selectedOptionStep = computed(() => {
Expand All @@ -27,10 +25,6 @@ const selectedOptionStep = computed(() => {
return stepsStore.currentOptionStep['1']
})

const openNextAccordion = (currentIndex: number) => {
const nextAccordion = document.querySelector<HTMLElement>(`[aria-controls='accordion-${currentIndex + 1}-video']`) || document.querySelector<HTMLElement>('[aria-controls=\'accordion--video\']')
nextAccordion?.click()
}
</script>

<template>
Expand All @@ -43,57 +37,7 @@ const openNextAccordion = (currentIndex: number) => {
Manipulations
</h3>
<div v-if="typology === 'revolver'">
<div v-if="selectedOptionStep === 'revolver_1873_fr'">
<div>
<p class="my-4">
Veuillez suivre les indications dans l'ordre afin de mettre en sécurité votre arme
</p>
<DsfrAccordionsGroup>
<li
v-for="(step, key) in TYPOLOGIES[typology]?.options_step_3[selectedOptionStep].text_steps"
:key="key"
>
<DsfrAccordion
:id="`accordion-${key}-video`"
:expanded-id="expandedId"
@expand="expandedId = $event"
>
<template #title>
Etape {{ key }} / {{ Object.values(TYPOLOGIES[typology]?.options_step_3[selectedOptionStep].text_steps).length }} <em class="text-gray-400"> - {{ step.time }}</em>
</template>
<video
autoplay
controls
playsinline
loop
muted
:src="step.video"
/>
<p
class="manipulations -mt-2 p-6"
v-html="step.content"
/>
<div class="flex justify-end my-4">
<DsfrButton
v-if="Number(key) < Object.values(TYPOLOGIES[typology]?.options_step_3[selectedOptionStep].text_steps).length"
data-testid="button-step-mes"
@click="openNextAccordion(+key)
"
>
Etape {{ +key + 1 }}
<VIcon
name="ri-arrow-right-s-line"
/>
</DsfrButton>
</div>
<AskingExpert />
</DsfrAccordion>
</li>
</DsfrAccordionsGroup>
<FooterMES />
</div>
</div>
<div v-else-if="selectedOptionStep === 'revolver_verrou_1892'">
<div v-if="selectedOptionStep === 'revolver_verrou_1892' || selectedOptionStep === 'revolver_1873_fr'">
<div
class="fr-col-sm-6 fr-col-lg-12 mx-auto"
>
Expand All @@ -102,15 +46,15 @@ const openNextAccordion = (currentIndex: number) => {
controls
playsinline
muted
:src="TYPOLOGIES[typology]?.options_step_3['revolver_verrou_1892']?.video"
:src="TYPOLOGIES[typology]?.options_step_3[selectedOptionStep]?.video"
/>
<span class="absolute -bottom-1.5rem right-0 text-sm">Environ 30 sec</span>
</div>
</div>
<p class="manipulations -mx-8 p-8">
<ul class="list-none text-sm">
<li
v-for="option in TYPOLOGIES[typology]?.options_step_3['revolver_verrou_1892']?.text_steps"
v-for="option in TYPOLOGIES[typology]?.options_step_3[selectedOptionStep]?.text_steps"
:key="option"
class="list-decimal"
v-html="option"
Expand Down
Loading