import { useRouter } from 'expo-router'; import { useCallback, useState } from 'react'; import { ScrollView, StyleSheet, Text, View } from 'react-native'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { BrandPressable } from '@/components/brand-pressable'; import { GameTile } from '@/components/game-tile'; import { Brand, BrandFont } from '@/constants/theme'; import { GAMES } from '@/data/games'; /** * Frames `20-21` (initial, nothing selected) and `24-46` (2 games selected). * The two Figma frames are the same screen with different local state, so we * model them as a single screen with a `Set` of selected ids. */ export default function SelectGamesScreen() { const router = useRouter(); const insets = useSafeAreaInsets(); const [selected, setSelected] = useState>(new Set()); const toggle = useCallback((id: string) => { setSelected((prev) => { const next = new Set(prev); if (next.has(id)) { next.delete(id); } else { next.add(id); } return next; }); }, []); return ( Which games do you play? Pick the games you play the most to personalize your experience. {GAMES.map((game) => ( toggle(game.id)} /> ))} 0 ? ` (${selected.size})` : ''}`} disabled={selected.size === 0} onPress={() => router.push('/(auth)/search-games')} /> router.push('/(auth)/search-games')} style={styles.link}> Search for a game ); } const styles = StyleSheet.create({ root: { flex: 1, backgroundColor: Brand.bg, paddingHorizontal: 24, }, header: { paddingTop: 16, paddingBottom: 16, gap: 6, }, title: { color: Brand.text, fontSize: 22, lineHeight: 28, fontFamily: BrandFont.montserratBold, }, subtitle: { color: Brand.textMuted, fontSize: 13, lineHeight: 18, fontFamily: BrandFont.poppinsRegular, }, grid: { flexDirection: 'row', flexWrap: 'wrap', justifyContent: 'space-between', paddingVertical: 8, rowGap: 16, }, footer: { paddingTop: 16, gap: 8, alignItems: 'center', }, link: { color: Brand.accent, fontSize: 13, lineHeight: 18, fontFamily: BrandFont.poppinsMedium, paddingVertical: 6, }, });