import React from 'react'; import { View, Text } from 'react-native'; import { useTheme } from '../theme/ThemeProvider'; import { useTranslation } from 'react-i18next'; import SubscriptionButton from './SubscriptionButton'; import ManaIcon from './ManaIcon'; import colors from '~/tailwind.config.js'; export interface PackageProps { id: string; name: string; manaAmount: number; price: number; priceString: string; currencyCode: string; isTeamPackage?: boolean; isEnterprisePackage?: boolean; popular?: boolean; } interface PackageCardProps { package: PackageProps; onSelect: (packageId: string) => void; } export const PackageCard: React.FC = ({ package: pkg, onSelect }) => { const { isDark, themeVariant, tw } = useTheme(); const { t } = useTranslation(); const formatPrice = (pkg: PackageProps) => { // Use priceString from RevenueCat if available, otherwise format the price return pkg.priceString || `${pkg.price.toFixed(2).replace('.', ',')}€`; }; // Theme-aware colors using the same system as MemoPreview and SettingsToggle const themeColors = (colors as any).theme?.extend?.colors; const textColor = isDark ? '#FFFFFF' : '#000000'; const secondaryTextColor = isDark ? 'rgba(255,255,255,0.7)' : 'rgba(0,0,0,0.7)'; const bgColor = isDark ? themeColors?.dark?.[themeVariant]?.contentBackground || '#1E1E1E' : themeColors?.[themeVariant]?.contentBackground || '#FFFFFF'; const borderColor = isDark ? themeColors?.dark?.[themeVariant]?.border || '#424242' : themeColors?.[themeVariant]?.border || '#e6e6e6'; const accentColor = '#4287f5'; // Konsistente Mana-Farbe für alle Abonnement-Komponenten const cardBgColor = isDark ? 'rgba(255,255,255,0.03)' : 'rgba(0,0,0,0.02)'; // Package-specific colors and background sizes (blue variants) const getPackageStyles = () => { switch (pkg.id) { case 'Mana_Potion_Small_v1': return { bg: '#E3F2FD', icon: '#2196F3', bgSize: '45%' }; // Light blue 50 / Blue 500 case 'Mana_Potion_Medium_v1': return { bg: '#BBDEFB', icon: '#1976D2', bgSize: '60%' }; // Light blue 100 / Blue 700 case 'Mana_Potion_Large_v1': return { bg: '#90CAF9', icon: '#1565C0', bgSize: '75%' }; // Light blue 200 / Blue 800 case 'Mana_Potion_Giant_v2': return { bg: '#64B5F6', icon: '#0D47A1', bgSize: '90%' }; // Light blue 300 / Blue 900 default: return { bg: '#E1F5FE', icon: '#0288D1', bgSize: '50%' }; } }; const packageStyles = getPackageStyles(); return ( {pkg.popular && ( {t('subscription.popular', 'Popular')} )} {/* Package Name - full width */} {pkg.name} {/* Three column layout */} {/* Mana Icon with background */} {/* Inner container that grows */} {/* Mana Amount */} {pkg.manaAmount} {t('subscription.mana', 'Mana')} {/* Price */} {formatPrice(pkg)} {t('subscription.one_time', 'Einmalig')} onSelect(pkg.id)} iconName="arrow-forward-outline" leftIconName="cart-outline" variant={pkg.popular ? 'accent' : 'primary'} /> ); }; export default PackageCard;