betagouv / pad.numerique.gouv.fr

Pad numérique de l'état
https://pad.numerique.gouv.fr/
GNU Affero General Public License v3.0
6 stars 1 forks source link

Add a tutorial on newly introduce Spell Checker #60

Closed lebaudantoine closed 1 month ago

lebaudantoine commented 2 months ago

To-do:

Brainsto:

lebaudantoine commented 2 months ago

As of tonight, the current styling of the tutorial:

https://github.com/user-attachments/assets/2b2728a1-85fc-43b1-b5d8-fcd5266b5aac

manuhabitela commented 2 months ago

On my firefox it renders like this on the staging platform: :grimacing:

edit: fixed that with an example implementation below

image

manuhabitela commented 2 months ago

Dont know if I understand correctly but when testing locally as a user, I had to explicitly enable the feature by clicking the check icon in the bottom so that the tutorial shows up. Is it what we really want?

I guess we could just check for the presence of the spellcheck feature flag enabled, and add a "fake" status icon just for the tutorial if the spellcheck icon is not checked by default?

manuhabitela commented 2 months ago

Here is my take on it:

// javascript
-  introJs().setOptions({
+  const intro = introJs().setOptions({
    dontShowAgain: true, // Override styles to hide the checkbox
    nextLabel: 'Suivant',
    prevLabel: 'Précédent',
    doneLabel: 'Terminé',
    highlightClass: 'custom-introjs-helperLayer',
    showBullets: false,
+   disableInteraction: true,
+   exitOnOverlayClick: false,
    steps: [
      {
        title: 'Nouveauté',
       intro: "La correction orthographique est disponible en version bêta. Vous pouvez l'activer ou la  désactiver en cochant cette case.",
        element: spellCheckToggle
      },
      {
        title: 'Feedbacks',
       intro: "Ce statut vous informera de l'état de votre document. Une fois le tutoriel terminé, cliquez  dessus à tout moment pour partager vos feedbacks.",
        element: spellCheckStatus
      }
    ]
-  }).start()
+  })
+  intro.onexit(() => {
+    document.querySelector('body').classList.remove('introjs-tour')
+    intro.setDontShowAgain(true)
+  })
+  intro.start()

// css
+ body.introjs-tour {
+     overflow: hidden;
+ }

This doesn't solve my previous comment though and I also didn't include my wording suggestions, I'll let you do what you wish.