import React from 'react'; import { ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native'; import { SafeAreaView } from 'react-native-safe-area-context'; import { Ionicons } from '@expo/vector-icons'; import { useRouter } from 'expo-router'; import { useSafeAnalytics } from '../../services/analytics'; import { ThemeBackdrop } from '../../components/ThemeBackdrop'; import { useColors } from '../../constants/Colors'; import { useApp } from '../../context/AppContext'; import { OnboardingProgressService } from '../../services/onboardingProgressService'; import { AppearanceMode, ColorPalette, Language } from '../../types'; const PALETTE_SWATCHES: Record = { forest: ['#5fa779', '#3d7f57'], ocean: ['#5a90be', '#3d6f99'], sunset: ['#c98965', '#a36442'], mono: ['#7b8796', '#5b6574'], }; export default function CustomizeOnboardingScreen() { const router = useRouter(); const posthog = useSafeAnalytics(); const { session, isDarkMode, appearanceMode, colorPalette, language, setAppearanceMode, setColorPalette, changeLanguage, t, } = useApp(); const colors = useColors(isDarkMode, colorPalette); const finishCustomization = () => { if (session?.userId) { OnboardingProgressService.completeStep(session.userId, 'customize'); } posthog.capture('onboarding_customization_completed', { appearance_mode: appearanceMode, color_palette: colorPalette, language, }); router.back(); }; const skipCustomization = () => { posthog.capture('onboarding_customization_skipped'); router.back(); }; return ( {t.onboardingChecklistIntro} {t.customizeOnboardingTitle} {t.customizeOnboardingSubtitle} {t.customizeOnboardingPreview} {t.onboardingTagline} {appearanceMode} {colorPalette} {language.toUpperCase()} {t.appearanceMode} {(['system', 'light', 'dark'] as AppearanceMode[]).map((mode) => { const isActive = appearanceMode === mode; const label = mode === 'system' ? t.themeSystem : mode === 'light' ? t.themeLight : t.themeDark; return ( setAppearanceMode(mode)} > {label} ); })} {t.colorPalette} {(['forest', 'ocean', 'sunset', 'mono'] as ColorPalette[]).map((palette) => { const isActive = colorPalette === palette; const swatch = PALETTE_SWATCHES[palette]; const label = palette === 'forest' ? t.paletteForest : palette === 'ocean' ? t.paletteOcean : palette === 'sunset' ? t.paletteSunset : t.paletteMono; return ( setColorPalette(palette)} > {label} ); })} {t.language} {(['en', 'de', 'es'] as Language[]).map((lang) => { const isActive = language === lang; const label = lang === 'en' ? 'English' : lang === 'de' ? 'Deutsch' : 'EspaƱol'; return ( changeLanguage(lang)} > {label} ); })} {t.customizeOnboardingSkip} {t.customizeOnboardingContinue} ); } const styles = StyleSheet.create({ container: { flex: 1, }, safeArea: { flex: 1, }, header: { flexDirection: 'row', alignItems: 'flex-start', gap: 14, paddingHorizontal: 20, paddingTop: 12, }, iconBtn: { width: 40, height: 40, borderRadius: 20, borderWidth: 1, alignItems: 'center', justifyContent: 'center', }, headerCopy: { flex: 1, gap: 6, paddingTop: 2, }, eyebrow: { fontSize: 12, fontWeight: '700', letterSpacing: 0.4, textTransform: 'uppercase', }, title: { fontSize: 28, fontWeight: '800', lineHeight: 32, }, subtitle: { fontSize: 14, lineHeight: 20, }, content: { padding: 20, gap: 16, }, previewCard: { borderWidth: 1, borderRadius: 24, padding: 18, gap: 10, }, previewLabel: { fontSize: 11, fontWeight: '700', letterSpacing: 0.5, textTransform: 'uppercase', }, previewTitle: { fontSize: 20, fontWeight: '700', }, previewMeta: { flexDirection: 'row', flexWrap: 'wrap', gap: 8, }, previewChip: { borderRadius: 999, paddingHorizontal: 10, paddingVertical: 6, }, previewChipText: { fontSize: 12, fontWeight: '700', }, card: { padding: 18, borderRadius: 20, borderWidth: 1, gap: 14, }, sectionTitle: { fontSize: 15, fontWeight: '700', }, segmentedControl: { flexDirection: 'row', backgroundColor: '#00000010', borderRadius: 14, padding: 4, }, segmentBtn: { flex: 1, paddingVertical: 12, borderRadius: 10, alignItems: 'center', }, segmentText: { fontSize: 14, fontWeight: '600', }, swatchContainer: { flexDirection: 'row', justifyContent: 'space-between', gap: 10, }, swatchWrap: { flex: 1, alignItems: 'center', paddingVertical: 8, borderRadius: 16, borderWidth: 2, borderColor: 'transparent', gap: 8, }, swatch: { width: 52, height: 52, borderRadius: 26, }, swatchLabel: { fontSize: 12, fontWeight: '600', }, languageRow: { flexDirection: 'row', flexWrap: 'wrap', gap: 12, }, languageBtn: { paddingHorizontal: 16, paddingVertical: 12, borderRadius: 14, backgroundColor: '#00000010', }, footer: { flexDirection: 'row', gap: 12, paddingHorizontal: 20, paddingBottom: 20, }, secondaryBtn: { flex: 1, height: 52, borderRadius: 16, borderWidth: 1.5, alignItems: 'center', justifyContent: 'center', }, secondaryBtnText: { fontSize: 15, fontWeight: '600', }, primaryBtn: { flex: 1.3, height: 52, borderRadius: 16, alignItems: 'center', justifyContent: 'center', }, primaryBtnText: { fontSize: 15, fontWeight: '700', }, });