import React from 'react'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip"; import { Choice } from './types'; import { ChoiceID } from './constants/metrics'; import { ArrowTrendingUpIcon, ExclamationTriangleIcon, LockClosedIcon } from '@heroicons/react/24/outline'; import { useTranslation } from 'react-i18next'; interface ChoiceCardProps { choice: Choice; previousChoices: ChoiceID[]; onClick: () => void; disabled?: boolean; optionNumber: number; } export const ChoiceCard: React.FC = ({ choice, previousChoices, onClick, disabled = false, optionNumber }) => { const { t } = useTranslation(); const strengtheningChoices = choice.strengthenedBy?.filter(c => previousChoices.includes(c)) || []; const weakeningChoices = choice.weakenedBy?.filter(c => previousChoices.includes(c)) || []; const isStrengthened = strengtheningChoices.length > 0; const isWeakened = weakeningChoices.length > 0; const isLocked = choice.requires?.some(c => !previousChoices.includes(c)); const cardClasses = ` relative transition-all duration-300 hover:scale-[1.02] cursor-pointer mt-8 ${isStrengthened ? 'border-green-500 shadow-green-500/20 shadow-lg' : ''} ${isWeakened ? 'border-orange-500 shadow-orange-500/20' : ''} ${isLocked || disabled ? 'opacity-50 cursor-not-allowed' : ''} bg-gray-800/50 hover:bg-gray-700/50 group `; return ( !isLocked && !disabled && onClick()} >
{optionNumber}
{choice.text}
{isStrengthened && ( {t('analysis.badges.enhanced')}

{t('analysis.badges.enhancedBy')}

    {strengtheningChoices.map(c => (
  • {c}
  • ))}
)} {isWeakened && ( {t('analysis.badges.weakened')}

{t('analysis.badges.weakenedBy')}

    {weakeningChoices.map(c => (
  • {c}
  • ))}
)}
{choice.impact} {t('analysis.clickToSeeDetails')}
{isLocked && (
Requires: {choice.requires?.join(', ')}
)}
); };