-
- {/* Marqueurs des paliers */}
- {spendingTiers.map((tier, index) => {
- // Calcul correct de la position pour correspondre au slider
- const position = ((index + 1) / spendingTiers.length) * 100;
+
+ {/* Fonction pour formater les montants */}
+ {(() => {
+ const formatAmount = (amount: number, isMobile: boolean) => {
+ if (!isMobile) return `${amount}€`;
+
+ // Formatage court sur mobile pour les montants longs
+ if (amount >= 1000) {
+ if (amount % 1000 === 0) {
+ return `${amount / 1000}k€`;
+ } else {
+ return `${(amount / 1000).toFixed(1)}k€`;
+ }
+ }
+ return `${amount}€`;
+ };
+
+ const isMobile = typeof window !== 'undefined' && window.innerWidth < 640;
+
return (
-
+ <>
+ {/* Marqueur 0€ */}
+
handleVoteChange(proposition.id, 0)}
+ >
+
+
+ {formatAmount(0, isMobile)}
+
+
+
+ {/* Marqueurs des paliers */}
+ {spendingTiers.map((tier, index) => {
+ // Position uniforme : espacement égal entre tous les marqueurs
+ // Le dernier palier doit être à 100%
+ const position = ((index + 1) / spendingTiers.length) * 100;
+ return (
+
handleVoteChange(proposition.id, tier)}
+ >
+
+
+ {formatAmount(tier, isMobile)}
+
+
+ );
+ })}
+ >
);
- })}
+ })()}