/** * Friends Screen * Cross-game friends list with status */ import React, { useState } from 'react'; import { View, Text, StyleSheet, FlatList, TouchableOpacity, SafeAreaView, SectionList, } from 'react-native'; import { theme } from '../theme'; interface Friend { id: string; username: string; status: 'online' | 'offline' | 'idle' | 'dnd'; game?: string; avatar: string; } export default function FriendsScreen({ navigation }: any) { const [friends] = useState([ { id: '1', username: 'john.aethex', status: 'online', game: 'Valorant', avatar: 'J' }, { id: '2', username: 'sarah.aethex', status: 'online', game: 'Fortnite', avatar: 'S' }, { id: '3', username: 'mike.aethex', status: 'idle', avatar: 'M' }, { id: '4', username: 'alex.aethex', status: 'offline', avatar: 'A' }, ]); const onlineFriends = friends.filter(f => f.status === 'online'); const offlineFriends = friends.filter(f => f.status !== 'online'); const sections = [ { title: `ONLINE (${onlineFriends.length})`, data: onlineFriends }, { title: `OFFLINE (${offlineFriends.length})`, data: offlineFriends }, ]; const getStatusColor = (status: Friend['status']) => { switch (status) { case 'online': return theme.colors.online; case 'idle': return theme.colors.idle; case 'dnd': return theme.colors.dnd; default: return theme.colors.offline; } }; const renderFriend = ({ item }: { item: Friend }) => ( {item.avatar} {item.username} {item.game && ( 🎮 Playing {item.game} )} {!item.game && item.status === 'offline' && ( Last seen 2h ago )} 💬 {item.status === 'online' && ( 📞 )} ); return ( Friends ➕ ( {section.title} )} keyExtractor={(item) => item.id} contentContainerStyle={styles.listContent} stickySectionHeadersEnabled={false} /> ); } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: theme.colors.background, }, header: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', paddingHorizontal: theme.spacing.md, paddingVertical: theme.spacing.md, }, headerTitle: { fontSize: theme.typography.fontSize.xxl, fontWeight: theme.typography.fontWeight.bold, color: theme.colors.text, }, addButton: { width: theme.layout.touchTarget, height: theme.layout.touchTarget, justifyContent: 'center', alignItems: 'center', }, addIcon: { fontSize: 24, }, listContent: { paddingHorizontal: theme.spacing.md, }, sectionHeader: { paddingVertical: theme.spacing.md, }, sectionTitle: { fontSize: theme.typography.fontSize.sm, fontWeight: theme.typography.fontWeight.semibold, color: theme.colors.textTertiary, letterSpacing: 0.5, }, friendCard: { flexDirection: 'row', alignItems: 'center', backgroundColor: theme.colors.card, borderRadius: theme.borderRadius.lg, padding: theme.spacing.md, marginBottom: theme.spacing.md, borderWidth: 1, borderColor: 'rgba(255, 255, 255, 0.05)', }, avatarContainer: { position: 'relative', marginRight: theme.spacing.md, }, avatar: { width: 48, height: 48, borderRadius: theme.borderRadius.full, backgroundColor: theme.colors.primary, justifyContent: 'center', alignItems: 'center', }, avatarText: { fontSize: 20, fontWeight: theme.typography.fontWeight.bold, color: '#000', }, statusDot: { position: 'absolute', bottom: 0, right: 0, width: 14, height: 14, borderRadius: 7, borderWidth: 2, borderColor: theme.colors.card, }, friendInfo: { flex: 1, }, username: { fontSize: theme.typography.fontSize.base, fontWeight: theme.typography.fontWeight.semibold, color: theme.colors.text, marginBottom: 4, }, gameRow: { flexDirection: 'row', alignItems: 'center', }, gameIcon: { fontSize: 14, marginRight: 4, }, gameText: { fontSize: theme.typography.fontSize.sm, color: theme.colors.textSecondary, }, lastSeen: { fontSize: theme.typography.fontSize.sm, color: theme.colors.textTertiary, }, actions: { flexDirection: 'row', }, actionButton: { width: 40, height: 40, justifyContent: 'center', alignItems: 'center', marginLeft: theme.spacing.sm, }, actionIcon: { fontSize: 20, }, });