import React, { useState } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import { Check, Star, Award, Medal, ChevronDown, ChevronUp } from 'lucide-react'; import { useTranslation } from 'react-i18next'; import { TierKey } from '../types'; import { TIERS } from '../constants'; import clsx from 'clsx'; interface TierSelectorEnhancedProps { selectedTier: TierKey; onSelectTier: (tier: TierKey) => void; } const tierIcons = { gold: Award, silver: Medal, bronze: Star, }; const tierGradients = { gold: 'from-yellow-400 via-yellow-500 to-amber-600', silver: 'from-slate-300 via-slate-400 to-slate-500', bronze: 'from-orange-400 via-orange-500 to-amber-700', }; const TierSelectorEnhanced: React.FC = ({ selectedTier, onSelectTier, }) => { const { t } = useTranslation(); const [showComparison, setShowComparison] = useState(false); const tiers: TierKey[] = ['gold', 'silver', 'bronze']; return (
{/* Tier Cards */}
{tiers.map((tierKey, index) => { const tier = TIERS[tierKey]; const Icon = tierIcons[tierKey]; const isSelected = selectedTier === tierKey; const isRecommended = tierKey === 'silver'; return ( onSelectTier(tierKey)} className={clsx( 'relative cursor-pointer rounded-xl border-2 transition-all duration-300 overflow-hidden', isSelected ? 'border-blue-500 shadow-xl shadow-blue-500/20' : 'border-slate-200 hover:border-slate-300 shadow-lg hover:shadow-xl' )} > {/* Recommended Badge */} {isRecommended && ( {t('tierSelector.popular')} )} {/* Selected Checkmark */} {isSelected && ( )} {/* Card Content */}
{/* Icon with Gradient */}
{/* Tier Name */}

{tier.name}

{/* Price */}
€{tier.price.toLocaleString('es-ES')} {t('tierSelector.oneTime')}
{/* Description */}

{tier.description}

{/* Key Features */}
    {tier.features?.slice(0, 3).map((feature, i) => ( {feature} ))}
{/* Select Button */} {isSelected ? t('tierSelector.selected') : t('tierSelector.select')}
); })}
{/* Comparison Toggle */}
setShowComparison(!showComparison)} className="inline-flex items-center gap-2 text-blue-600 hover:text-blue-700 font-medium text-sm" > {showComparison ? ( <> {t('tierSelector.hideComparison')} ) : ( <> {t('tierSelector.viewComparison')} )}
{/* Comparison Table */} {showComparison && (

{t('tierSelector.comparison')}

{tiers.map((tierKey) => ( ))} {tiers.map((tierKey) => ( ))} {tiers.map((tierKey) => ( ))} {tiers.map((tierKey) => ( ))} {tiers.map((tierKey) => ( ))} {tiers.map((tierKey) => ( ))} {tiers.map((tierKey) => ( ))}
{t('tierSelector.feature')} {TIERS[tierKey].name}
{t('tierSelector.price')} €{TIERS[tierKey].price.toLocaleString('es-ES')}
{t('tierSelector.deliveryTime')} {tierKey === 'gold' ? t('tierSelector.days7') : tierKey === 'silver' ? t('tierSelector.days10') : t('tierSelector.days14')}
{t('tierSelector.dimensions8')}
{t('tierSelector.roadmap')}
{t('tierSelector.economicModel')} {tierKey !== 'bronze' ? ( ) : ( )}
{t('tierSelector.presentation')} {tierKey === 'gold' ? ( ) : ( )}
)}
); }; export default TierSelectorEnhanced;