'use client'; import type { MotivatorCard as MotivatorCardType } from '@/lib/types'; import { MOTIVATOR_BY_TYPE } from '@/lib/types'; interface InfluenceZoneProps { cards: MotivatorCardType[]; onInfluenceChange: (cardId: string, influence: number) => void; canEdit: boolean; } export function InfluenceZone({ cards, onInfluenceChange, canEdit }: InfluenceZoneProps) { // Sort by importance (orderIndex) const sortedCards = [...cards].sort((a, b) => b.orderIndex - a.orderIndex); return (
{/* Legend */}
Influence négative
Neutre
Influence positive
{/* Cards with sliders */}
{sortedCards.map((card) => ( ))}
); } function InfluenceSlider({ card, onInfluenceChange, disabled, }: { card: MotivatorCardType; onInfluenceChange: (cardId: string, influence: number) => void; disabled: boolean; }) { const config = MOTIVATOR_BY_TYPE[card.type]; return (
{/* Card info */}
{config.icon}
{config.name}
#{card.orderIndex}
{/* Influence slider */}
-3
{/* Track background */}
{/* Slider */} onInfluenceChange(card.id, parseInt(e.target.value))} disabled={disabled} className={` relative w-full h-8 appearance-none bg-transparent cursor-pointer [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:w-6 [&::-webkit-slider-thumb]:h-6 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-white [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-foreground [&::-webkit-slider-thumb]:shadow-md [&::-webkit-slider-thumb]:cursor-grab [&::-webkit-slider-thumb]:active:cursor-grabbing [&::-moz-range-thumb]:w-6 [&::-moz-range-thumb]:h-6 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:bg-white [&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-foreground [&::-moz-range-thumb]:shadow-md [&::-moz-range-thumb]:cursor-grab disabled:cursor-not-allowed disabled:[&::-webkit-slider-thumb]:cursor-not-allowed `} /> {/* Zero marker */}
+3
{/* Current value */}
0 ? 'bg-green-500/20 text-green-600' : ''} ${card.influence < 0 ? 'bg-red-500/20 text-red-600' : ''} ${card.influence === 0 ? 'bg-muted/20 text-muted' : ''} `} > {card.influence > 0 ? `+${card.influence}` : card.influence}
); }