Skip to content

feat: système de goals multiples avec animations et auto-save - #30

Merged
rockynox merged 20 commits into
developfrom
goal-list-2
Jun 17, 2026
Merged

feat: système de goals multiples avec animations et auto-save#30
rockynox merged 20 commits into
developfrom
goal-list-2

Conversation

@rockynox

@rockynox rockynox commented Jun 17, 2026

Copy link
Copy Markdown
Member

Résumé

Cette branche implémente un système de goals (objectifs de collecte) multiples pour les streams et events, remplaçant l'ancien goal unique sur le widget donation. Les goals sont affichés sur le widget card avec des animations et gérés depuis l'interface d'administration. Elle introduit également la gestion de multi-admins sur un event.

Fonctionnalités implémentées

Backend

  • Nouveau modèle Goal + migration 17-add-goals-table.sql — table goals avec stream_id, event_id, amount, label, order
  • GoalRepository — CRUD complet : findByStreamId, findByEventId, createGoal, updateGoal, deleteGoal, reorderGoals
  • AdminController — nouvelles routes POST pour ajouter/supprimer des goals avec auto-save
  • WidgetController — injection des goals dans le contexte du widget card
  • Migration 16-drop-donation-widget-goal.sql — suppression de l'ancien champ goal du widget donation
  • EventRepository / StreamRepository — suppression des références à l'ancien champ goal

Multi-admins sur un event

  • Migration 18-event-multi-admin.sql — ajout d'une colonne is_owner sur user_right ; les admins existants sont migrés en is_owner = 1
  • UserRepository — nouvelles méthodes : selectEventAdmins, isEventOwner, deleteEventRight, insertRight (avec flag is_owner)
  • AdminController — gestion des admins depuis la page d'édition d'un event : ajout par email (add_admin), suppression (remove_admin), réservé à l'owner de l'event ou à un admin global
  • Page d'édition event — liste des admins existants avec bouton de suppression, formulaire d'invitation par email

Frontend — Widget card

  • Barre de progression des goals — affichage dynamique du goal courant, marqueurs de paliers
  • Animation fireworks déclenchée à l'atteinte d'un goal (canvas full-screen)
  • Animation sur la barre de don — barre s'anime jusqu'à 100 % puis passe au goal suivant
  • Banner "Goal atteint" — centré sur la card, durée 6s, message selon position (dernier vs intermédiaire)
  • Gestion du dernier goal atteint — pas de faux reset, message "Objectif final atteint !"

Frontend — Interface admin

  • Liste de goals dans les pages d'édition stream/event — ajout/suppression avec montant et libellé
  • Auto-save : chaque ajout/suppression est sauvegardé immédiatement via fetch POST
  • Encart d'information expliquant le système de goals

UX / Structure

  • Réorganisation de l'accordéon widgets — widget Card placé en premier, toutes les sections repliées par défaut
  • Fix templates stream/event edit — contenu du formulaire Card widget restauré après la réorganisation

Documentation

  • docs/goals-system.md — documentation complète : architecture, routes API, comportement frontend, guide d'utilisation

Migrations à appliquer

migrations/16-drop-donation-widget-goal.sql
migrations/17-add-goals-table.sql
migrations/18-event-multi-admin.sql

Test plan

  • Créer un stream/event, ajouter plusieurs goals → vérifier la sauvegarde automatique
  • Ouvrir le widget card → barre affiche le goal courant et les marqueurs de paliers
  • Simuler un don atteignant un goal intermédiaire → fireworks + banner + passage au goal suivant
  • Simuler un don atteignant le dernier goal → banner "Objectif final atteint !", pas de reset
  • Vérifier que l'ancien champ goal du widget donation n'est plus présent
  • Vérifier l'accordéon : Card widget en premier, sections repliées par défaut
  • En tant qu'owner d'un event, ajouter un admin par email → vérifier qu'il apparaît dans la liste
  • Supprimer un admin → vérifier qu'il n'a plus accès à l'event
  • Vérifier qu'un admin non-owner ne peut pas gérer les autres admins

rockynox and others added 20 commits June 16, 2026 13:49
…references

- Restore initGoalsManager() in admin.js with chips UI and window.previewGoal sync
- Remove stream_goal/event_goal input lookups from preview functions (replaced by window.previewGoal)
- Fix event/edit.html.twig: replace event.goal references with eventGoals[0] ?? 1000

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Fetch endpoints now return active goal in JSON response
- JS detects goal change between polls, triggers fireworks + banner
- CSS: particle burst animation, goal-reached banner, goal text flash
- Goal text updates live to show the next objective

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Bar fills to 100% when a goal is crossed, then shimmer/glow plays (2.4s)
- Bar then resets to the new percentage relative to the next goal
- Goal text updates live to show the next objective
- Both stream and event donation bar endpoints now return active goal

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Backend: all 4 fetch endpoints now return allGoalsReached flag
- Donation bar: stays at 100% when last goal is crossed (no reset)
- Card: banner shows "Tous les objectifs atteints !" instead of "Prochain objectif"
- Detection: justCrossedGoal catches both goal change AND last goal threshold crossing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…vent edit templates

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…dion reorder

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace full card section with a compact toggle slider in the page header
- Show simulation section (amount, reset, simulate form) only when mode is active
- Show reload reminder only when mode is active

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Checkboxes don't submit their value when unchecked, so toggling off
never reached the backend. The hidden input ensures toggle_test_mode=1
is always sent on form submit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- In triggerGoalAnimation: call updateDonationBar in the isLastGoal branch
  so the current-amount counter updates after the shimmer animation ends
- In stream.js / event.js: initialize CountUp with currentAmount/100 (euros)
  instead of raw centimes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@rockynox
rockynox merged commit a3a963d into develop Jun 17, 2026
2 checks passed
@rockynox
rockynox deleted the goal-list-2 branch June 17, 2026 07:30
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.

1 participant