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(tally): integrate tally poll #2715

Open
wants to merge 3 commits into
base: staging
Choose a base branch
from

Conversation

Michaelvilleneuve
Copy link
Collaborator

Cette PR enlève les relicats de code Maze pour ajouter Tally à la place et l'activer lors d'un click sur "Terminer et revenir à l'accueil" ainsi que "Terminer" après envoi des invitations.

J'ai ajouté un système de délai afin d'éviter un affichage immédiat et afin d'éviter que la mise à jour turbo écrase le contenu ajouté par Tally.

Tally ne gère pas lui même la logique d'affichage ou non une fois que le formulaire a été vu, j'ai donc rajouté de la logique pour conditionner cela.

À noter : J'ai fait un petit fix sur submit_selected_ids_controller pour éviter une erreur JS

Screenshot 2025-03-13 at 17 23 10

Fix #2699

@@ -7,7 +7,9 @@ export default class extends Controller {
if (this.hasSubmitTarget) {
this.toggleSubmit()
}
this.#updateSelectedCountText()
if (this.hasSelectedUsersCounterTarget) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'ai une erreur au moment de passer aprés la création des usagers, au moment de passer aux invitations quand je clic sur le CTA.
Capture d’écran 2025-03-26 à 10 01 01

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah bah justement ce changement était pour éviter cette erreur 🤔, mais l'erreur ne vient pas de cette branche

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ce controller passe à la trappe dans #2574 mais j'ai l'impression que c'est pas lié à la fonctionnalité ici de toute façon

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non effectivement 👍

Copy link
Collaborator

@aminedhobb aminedhobb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merci @Michaelvilleneuve 👍 , je pense qu'il y aura quelques petits changements à faire suite aux derniers changements sur les csp et dans #2574

@@ -7,7 +7,9 @@ export default class extends Controller {
if (this.hasSubmitTarget) {
this.toggleSubmit()
}
this.#updateSelectedCountText()
if (this.hasSelectedUsersCounterTarget) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ce controller passe à la trappe dans #2574 mais j'ai l'impression que c'est pas lié à la fonctionnalité ici de toute façon

@@ -54,7 +54,7 @@
</div>
<div>
<% if @all_invitations_attempted %>
<%= link_to "Terminer", @user_list_upload.structure_users_path, class: "btn btn-primary d-block mx-auto", data: { turbo_frame: "_top" } %>
<%= link_to "Terminer", @user_list_upload.structure_users_path, class: "btn btn-primary d-block mx-auto", data: { turbo_frame: "_top", controller: "tally", "tally-form-id": "nWjZGj", "tally-delay-in-ms": 1000, action: "click->tally#showPopup" } %>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il vaudrait pas mieux mettre l'id dans une variable d'env ? Ça permettrait de l'activer qu'en prod d'ailleurs

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alors je l'ai pas mis dans une variable d'env car c'est vraiment lié à ce formulaire en particulier pas à Tally au global, et je me disais qu'on pourrait potentiellement en avoir 3-4 en même temps, rendant un peu pénible l'usage d'une variable d'env.
Mais dans les faits on en aura surement qu'un ou 2 donc why not

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pour le coup je pense que ce n'est pas une bonne idée de le laisser en dur, ne serait-ce que pour ne pouvoir l'afficher dans tous les env. On veut pas l'avoir en staging et en demo non ?

Comment on lines +13 to +19
if (!document.querySelector("script#tally-script")) {
const script = document.createElement("script");
script.src = "https://tally.so/widgets/embed.js";
script.id = "tally-script"
script.onload = resolve
document.head.appendChild(script);
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

je sais pas si ça va passer avec les nouveaux csp, mais on peut pas le loader sur la page avant au pire ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je trouve ça plutôt bien de justement le loader au besoin depuis là. Mais je pense qu'on doit pouvoir juste faire une exception non ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Si y a pas de souci niveau csp ça me va de le laisser là

}, this.element.dataset.tallyDelayInMs || 0)
}

set #hasAlreadyAnswered(value) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Il me semblait qu'on avait dit qu'on évitait les getter/setter dans le js. On peut peut-être juste renommer cette méthode (par ex setHasAlreadyAnswered)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah bon ? Pourquoi ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On s'était dit ça pour le model User.js, j'ai retrouvé l'historique :

Après je n'ai pas d'avis tranché je disais surtout ça par homogénéisation, ça ne me dérange pas de laisser comme ça

@aminedhobb aminedhobb self-requested a review April 1, 2025 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Upload] - Mettre en place une pop-in "feedbacks" Tally
3 participants