import { useState } from 'react'; import { Linking, Text, TouchableOpacity, View } from 'react-native'; import { useTranslation } from 'react-i18next'; import { Ionicons } from '@expo/vector-icons'; import { useColors } from '../../../lib/theme'; import { OnboardingShell } from '../OnboardingShell'; import { LyraBubble } from '../LyraBubble'; import { CTABar } from '../CTABar'; type Tier = 'pro' | 'legend'; type Billing = 'monthly' | 'yearly'; const HARDSHIP_EMAIL = 'support@rebreak.org'; export function PlanSlide({ onChosen, current, total, }: { onChosen: (tier: Tier, billing: Billing) => void; current: number; total: number; }) { const { t } = useTranslation(); const colors = useColors(); const [tier, setTier] = useState('pro'); const [billing, setBilling] = useState('yearly'); function openHardshipMail() { const subject = encodeURIComponent('Härtefall — rebreak'); Linking.openURL(`mailto:${HARDSHIP_EMAIL}?subject=${subject}`).catch(() => {}); } return ( onChosen(tier, billing)} /> } > setTier('pro')} colors={colors} badge={t('onboarding.plan.tier_pro_badge')} title="Pro" price={ billing === 'yearly' ? t('onboarding.plan.tier_pro_price_yearly') : t('onboarding.plan.tier_pro_price_monthly') } anchorPrice={billing === 'yearly' ? t('onboarding.plan.tier_pro_anchor_yearly') : null} totalPrice={billing === 'yearly' ? t('onboarding.plan.tier_pro_total_yearly') : null} subline={ billing === 'yearly' ? t('onboarding.plan.tier_pro_subline_yearly') : t('onboarding.plan.tier_pro_subline_monthly') } features={[ t('onboarding.plan.feat_blocklist'), t('onboarding.plan.feat_lyra'), t('onboarding.plan.feat_mail'), t('onboarding.plan.feat_community'), ]} /> setTier('legend')} colors={colors} badge={null} title="Legend" price={ billing === 'yearly' ? t('onboarding.plan.tier_legend_price_yearly') : t('onboarding.plan.tier_legend_price_monthly') } anchorPrice={billing === 'yearly' ? t('onboarding.plan.tier_legend_anchor_yearly') : null} totalPrice={billing === 'yearly' ? t('onboarding.plan.tier_legend_total_yearly') : null} subline={ billing === 'yearly' ? t('onboarding.plan.tier_legend_subline_yearly') : t('onboarding.plan.tier_legend_subline_monthly') } features={[ t('onboarding.plan.feat_legend_all_pro'), t('onboarding.plan.feat_legend_multi_device'), t('onboarding.plan.feat_legend_voice'), ]} /> {t('onboarding.plan.disclaimer')} {/* Härtefall-Mailto — manuell, kein Auto-Sozial-Rabatt (Strategist-Verdict) */} {t('onboarding.plan.hardship_link')} ); } // ─── Billing-Toggle ────────────────────────────────────────────────────────── function BillingToggle({ billing, setBilling, t, colors, }: { billing: Billing; setBilling: (b: Billing) => void; t: ReturnType['t']; colors: import('../../../lib/theme').ColorScheme; }) { return ( setBilling('monthly')} label={t('onboarding.plan.billing_monthly')} colors={colors} /> setBilling('yearly')} label={t('onboarding.plan.billing_yearly')} savingsBadge={t('onboarding.plan.billing_savings')} colors={colors} /> ); } function ToggleButton({ active, onPress, label, savingsBadge, colors, }: { active: boolean; onPress: () => void; label: string; savingsBadge?: string; colors: import('../../../lib/theme').ColorScheme; }) { return ( {label} {savingsBadge ? ( {savingsBadge} ) : null} ); } // ─── Plan-Card ─────────────────────────────────────────────────────────────── function PlanCard({ selected, onSelect, colors, badge, title, price, anchorPrice, totalPrice, subline, features, }: { selected: boolean; onSelect: () => void; colors: import('../../../lib/theme').ColorScheme; badge: string | null; title: string; /** Hauptpreis (z.B. "3,99 € / Monat" oder "3,33 € / Monat"). */ price: string; /** Durchgestrichener Original-Annual-Preis (z.B. "47,88 €"). Nur bei Yearly. */ anchorPrice: string | null; /** Total-Annual-Preis als Zusatzzeile (z.B. "39,90 € / Jahr"). Nur bei Yearly. */ totalPrice: string | null; subline: string; features: string[]; }) { return ( {title} {badge ? ( {badge.toUpperCase()} ) : null} {selected ? : null} {price} {anchorPrice ? ( {anchorPrice} ) : null} {totalPrice ? ( {totalPrice} ) : null} {subline} {features.map((f) => ( {f} ))} ); }