import { useEffect } from "react"; import { View, Text, StyleSheet, TouchableOpacity, ScrollView, Platform } from "react-native"; import Animated, { FadeInDown, FadeInRight } from "react-native-reanimated"; import { LinearGradient } from "expo-linear-gradient"; import { useAuthStore, useMatchStore, usePacksStore } from "../../src/store"; import { Ionicons } from "@expo/vector-icons"; import { router } from "expo-router"; import { GradientBackground, GlassCard, GlassButton } from "../../src/components/ui"; import { colors, gradients, spacing, radius, typography, shadows } from "../../src/theme"; export default function HomeScreen() { const { user, partner } = useAuthStore(); const { matches, newMatchesCount, fetchMatches } = useMatchStore(); const { packs, fetchPacks } = usePacksStore(); useEffect(() => { fetchMatches(); fetchPacks(); }, []); const recentMatches = matches.slice(0, 3); return ( {/* Header */} Hey, {user?.name || "there"} {partner && ( Paired with {partner.name || partner.email || 'your partner'} )} router.push("/(app)/profile")} activeOpacity={0.7} > {user?.name?.[0]?.toUpperCase() || "U"} {/* Quick Stats */} {matches.length} Matches {packs.length} Packs 0 && styles.statIconHighlight]}> 0 ? colors.text : colors.primary} /> {newMatchesCount} New {/* Start Playing CTA */} router.push("/(app)/swipe")} activeOpacity={0.9} > Ready to explore? Swipe through questions and discover what you both enjoy {/* Recent Matches */} {recentMatches.length > 0 && ( Recent Matches router.push("/(app)/matches")}> See all {recentMatches.map((match, index) => ( router.push(`/chat/${match.id}`)} activeOpacity={0.7} > {(match as any).question?.text || "A new match!"} {match.is_new && } ))} )} {/* Bottom spacing for tab bar */} ); } const styles = StyleSheet.create({ container: { flex: 1, }, contentContainer: { paddingBottom: Platform.OS === 'ios' ? 100 : 80, }, header: { paddingTop: 60, paddingHorizontal: spacing.lg, paddingBottom: spacing.lg, flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', }, greeting: { ...typography.title1, color: colors.text, }, partnerText: { ...typography.subhead, color: colors.textSecondary, marginTop: spacing.xs, }, profileButton: { width: 44, height: 44, borderRadius: 22, backgroundColor: colors.primary, justifyContent: 'center', alignItems: 'center', ...shadows.md, }, profileButtonText: { ...typography.headline, color: colors.text, }, statsContainer: { flexDirection: "row", paddingHorizontal: spacing.lg, gap: spacing.sm, }, statCard: { flex: 1, alignItems: "center", paddingVertical: spacing.md, }, statIconContainer: { width: 40, height: 40, borderRadius: 20, backgroundColor: colors.primaryLight, justifyContent: "center", alignItems: "center", marginBottom: spacing.sm, }, statIconHighlight: { backgroundColor: colors.primary, }, statNumber: { ...typography.title2, color: colors.text, }, statLabel: { ...typography.caption1, color: colors.textSecondary, marginTop: spacing.xs, }, ctaCard: { margin: spacing.lg, borderRadius: radius.xl, padding: spacing.lg, flexDirection: "row", alignItems: "center", ...shadows.lg, }, ctaContent: { flex: 1, }, ctaTitle: { ...typography.title3, color: colors.text, }, ctaSubtitle: { ...typography.subhead, color: "rgba(255,255,255,0.8)", marginTop: spacing.xs, }, ctaIconContainer: { width: 44, height: 44, borderRadius: 22, backgroundColor: "rgba(255,255,255,0.2)", justifyContent: "center", alignItems: "center", marginLeft: spacing.md, }, section: { paddingHorizontal: spacing.lg, marginTop: spacing.sm, }, sectionHeader: { flexDirection: "row", justifyContent: "space-between", alignItems: "center", marginBottom: spacing.md, }, sectionTitle: { ...typography.headline, color: colors.text, }, seeAll: { ...typography.subhead, color: colors.primary, }, matchItem: { flexDirection: "row", alignItems: "center", marginBottom: spacing.sm, }, matchIcon: { width: 36, height: 36, borderRadius: 18, backgroundColor: colors.primaryLight, justifyContent: "center", alignItems: "center", marginRight: spacing.md, }, matchText: { flex: 1, ...typography.body, color: colors.text, }, newBadge: { width: 8, height: 8, borderRadius: 4, backgroundColor: colors.primary, }, bottomSpacer: { height: spacing.lg, }, });