From 63db9983bca498e5d6ce3e29a305423a6d1c63a4 Mon Sep 17 00:00:00 2001 From: Yannick Le Duc Date: Mon, 25 Aug 2025 16:44:29 +0200 Subject: [PATCH] fine tune la page de vote --- .../[id]/vote/[participantId]/page.tsx | 63 ++++++++++--------- src/app/globals.css | 2 + 2 files changed, 37 insertions(+), 28 deletions(-) diff --git a/src/app/campaigns/[id]/vote/[participantId]/page.tsx b/src/app/campaigns/[id]/vote/[participantId]/page.tsx index c7903ae..55d6cf3 100644 --- a/src/app/campaigns/[id]/vote/[participantId]/page.tsx +++ b/src/app/campaigns/[id]/vote/[participantId]/page.tsx @@ -1,7 +1,7 @@ 'use client'; import { useState, useEffect } from 'react'; -import { useParams } from 'next/navigation'; +import { useParams, useRouter } from 'next/navigation'; import Link from 'next/link'; import { Campaign, Proposition, Participant, Vote, PropositionWithVote } from '@/types'; import { campaignService, participantService, propositionService, voteService } from '@/lib/services'; @@ -11,6 +11,7 @@ export const dynamic = 'force-dynamic'; export default function PublicVotePage() { const params = useParams(); + const router = useRouter(); const campaignId = params.id as string; const participantId = params.participantId as string; @@ -210,12 +211,12 @@ export default function PublicVotePage() {

Votre vote a été enregistré avec succès. Vous pouvez revenir modifier vos choix tant que la campagne est en cours.

- window.location.reload()} className="mt-4 inline-flex items-center px-4 py-2 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-indigo-700" > - Retour à l'accueil - + Retour à mon vote + @@ -232,18 +233,9 @@ export default function PublicVotePage() {
- - - - - Retour -

Vote - {campaign?.title}

-

+

{participant?.first_name} {participant?.last_name}

@@ -337,26 +329,41 @@ export default function PublicVotePage() { /> {/* Marqueurs des paliers */} -
-
+
+ {/* Marqueur 0€ */} +
0€
- {spendingTiers.map((tier, index) => ( -
-
- {tier}€ -
- ))} + + {/* Marqueurs des paliers */} + {spendingTiers.map((tier, index) => { + const position = ((index + 1) / spendingTiers.length) * 100; + return ( +
+
+ {tier}€ +
+ ); + })}
{/* Valeur sélectionnée */} -
- - Vote sélectionné : {localVotes[proposition.id] || 0}€ - -
+ {(localVotes[proposition.id] && localVotes[proposition.id] > 0) && ( +
+ + Vote sélectionné : {localVotes[proposition.id]}€ + +
+ )}
diff --git a/src/app/globals.css b/src/app/globals.css index 37e4e12..66a4683 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -74,6 +74,7 @@ border: 2px solid #ffffff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); transition: all 0.2s ease; + margin-top: -8px; /* Centre le thumb verticalement sur la track */ } .slider::-webkit-slider-thumb:hover { @@ -100,6 +101,7 @@ border: 2px solid #ffffff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15); transition: all 0.2s ease; + margin-top: -8px; /* Centre le thumb verticalement sur la track */ } .slider::-moz-range-thumb:hover {