import { useState } from 'react'; import { Link } from 'react-router-dom'; import { ChevronLeft, Crown, CheckCircle2, Sparkles, Cpu } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { useTranslation } from '@/contexts/language'; import { useSasquatchPro } from '@/hooks/useSasquatchPro'; import { PRO_TIERS } from '@/lib/sasquatchPro'; import { DURATION_TIERS, PLATFORM_FEES, FEE_META, tierPriceSats, tierPerDaySats, type FeeType } from '@/hooks/usePlatformFee'; import { SasquatchProDialog } from '@/components/SasquatchProDialog'; import { useLabProfiles } from '@/hooks/useLabProfiles'; import { useCurrentUser } from '@/hooks/useCurrentUser'; import { labProfilePath } from '@/lib/labRoutes'; import { dateLocaleCode } from '@/lib/dateFnsI18n'; import { cn } from '@/lib/utils'; /** * Settings → Pro & Support. * * One honest home for every paid extra: what it does, the duration tiers and * effective per-day price, your current status, and the free alternatives. * Nothing here holds funds — each purchase is a one-off Lightning payment. */ export function ProSupportScreen({ onBack }: { onBack: () => void }) { const { t } = useTranslation(); const { isPro, expiresAt } = useSasquatchPro(); const { user } = useCurrentUser(); const { data: profiles } = useLabProfiles(100); const [proOpen, setProOpen] = useState(false); const now = Math.floor(Date.now() / 1000); const daysLeft = isPro && expiresAt ? Math.max(0, Math.ceil((expiresAt - now) / 86400)) : 0; const fmt = (secs: number) => new Date(secs * 1000).toLocaleDateString(dateLocaleCode(), { month: 'short', day: 'numeric', year: 'numeric' }); const featured = (profiles ?? []).filter((p) => p.pubkey === user?.pubkey && p.featuredUntil && p.featuredUntil > now); return (
{t('settingsUi.proSupport.prepaidBody')}
{t('settingsUi.proSupport.sasquatchTitle')}
{t('settingsUi.proSupport.sasquatchBenefit')}
{isPro ? expiresAt ? `${t('settingsUi.proSupport.activeUntil', { date: fmt(expiresAt) })} · ${t('settingsUi.proSupport.daysLeft', { count: daysLeft })}` : t('settingsUi.proSupport.active') : t('settingsUi.proSupport.notActive')}
{t(tier.labelKey)}
{tier.sats.toLocaleString()}
{t('common.sats')} · {Math.round(tier.sats / tier.days)}/{t('settingsUi.proSupport.day')}
{tier.badgeKey &&{t(tier.badgeKey)}
}{t('settingsUi.proSupport.featuredTitle')}
{t('settingsUi.proSupport.featuredBenefit')}
{FEE_META[type].emoji}{FEE_META[type].label} {FEE_META[type].benefit}
{tier.label}
{tierPriceSats(type, tier).toLocaleString()}
{tierPerDaySats(type, tier).toLocaleString()}/{t('settingsUi.proSupport.day')}
{t('settingsUi.proSupport.featuredHow')}
{t('settingsUi.proSupport.yourFeatured')}
{featured.length === 0 ? ({t('settingsUi.proSupport.noneFeatured')}
) : ({t('settingsUi.proSupport.freeTitle')}
{t('settingsUi.proSupport.freeBody')}