diff --git a/frontend/src/screens/ConversationsScreen.tsx b/frontend/src/screens/ConversationsScreen.tsx index 5283411..6fd015c 100644 --- a/frontend/src/screens/ConversationsScreen.tsx +++ b/frontend/src/screens/ConversationsScreen.tsx @@ -1,29 +1,20 @@ -<<<<<<< HEAD -import React from 'react'; -import { View, StyleSheet, FlatList, TouchableOpacity, Dimensions } from 'react-native'; -import { List, Avatar, Text, FAB, Badge, Surface } from 'react-native-paper'; -======= import React, { useState } from 'react'; -import { View, StyleSheet, FlatList, TouchableOpacity } from 'react-native'; +import { View, StyleSheet, FlatList, TouchableOpacity, Dimensions } from 'react-native'; import { List, Avatar, Text, FAB, Divider, Badge, Searchbar, IconButton, useTheme } from 'react-native-paper'; ->>>>>>> a3ad9832ae1663e2a76b50c417d43bcb23a0e03a import { useQuery } from '@apollo/client'; import { GET_CONVERSATIONS } from '../graphql/queries'; import { Conversation } from '../types'; import { format, isToday, isYesterday } from 'date-fns'; import { ru } from 'date-fns/locale'; -<<<<<<< HEAD import { LinearGradient } from 'expo-linear-gradient'; import Animated, { FadeInDown, FadeInRight, Layout, } from 'react-native-reanimated'; +import { useAuth } from '../contexts/AuthContext'; const { width } = Dimensions.get('window'); -======= -import { useAuth } from '../contexts/AuthContext'; ->>>>>>> a3ad9832ae1663e2a76b50c417d43bcb23a0e03a export const ConversationsScreen = ({ navigation }: any) => { const [searchQuery, setSearchQuery] = useState(''); @@ -34,7 +25,6 @@ export const ConversationsScreen = ({ navigation }: any) => { pollInterval: 5000, }); -<<<<<<< HEAD const formatMessageTime = (date: string) => { const messageDate = new Date(date); if (isToday(messageDate)) { @@ -46,9 +36,6 @@ export const ConversationsScreen = ({ navigation }: any) => { } }; - const renderConversation = ({ item, index }: { item: Conversation; index: number }) => { - const otherParticipant = item.participants.find(p => p.id !== data?.me?.id); -======= // Фильтрация чатов по поисковому запросу const filteredConversations = data?.conversations?.filter((conv: Conversation) => { if (!searchQuery) return true; @@ -60,9 +47,8 @@ export const ConversationsScreen = ({ navigation }: any) => { conv.lastMessage?.content.toLowerCase().includes(searchQuery.toLowerCase()); }) || []; - const renderConversation = ({ item }: { item: Conversation }) => { + const renderConversation = ({ item, index }: { item: Conversation; index: number }) => { const otherParticipant = item.participants.find(p => p.id !== user?.id); ->>>>>>> a3ad9832ae1663e2a76b50c417d43bcb23a0e03a const displayName = item.isGroup ? item.name : otherParticipant?.username; const lastMessageTime = item.lastMessage ? formatMessageTime(item.lastMessage.createdAt) @@ -80,7 +66,7 @@ export const ConversationsScreen = ({ navigation }: any) => { onPress={() => navigation.navigate('Chat', { conversationId: item.id, title: displayName })} activeOpacity={0.7} > - + { {otherParticipant?.isOnline && ( )} -<<<<<<< HEAD {displayName || 'Без имени'} - + {lastMessageTime} @@ -120,26 +100,17 @@ export const ConversationsScreen = ({ navigation }: any) => { {item.lastMessage?.content || 'Нет сообщений'} - {/* Здесь можно добавить счетчик непрочитанных */} + {unreadCount > 0 && ( + {unreadCount} + )} -======= - )} - right={() => ( - - - {lastMessageTime} - - {unreadCount > 0 && ( - {unreadCount} - )} ->>>>>>> a3ad9832ae1663e2a76b50c417d43bcb23a0e03a - + ); @@ -147,40 +118,38 @@ export const ConversationsScreen = ({ navigation }: any) => { if (loading && !data) { return ( - + - Загрузка чатов... + Загрузка чатов... ); } if (error) { return ( - + - Ошибка загрузки чатов - refetch()} style={styles.retryButton}> - Попробовать снова + Ошибка загрузки чатов + refetch()} style={[styles.retryButton, { backgroundColor: theme.colors.surfaceVariant }]}> + Попробовать снова ); } return ( -<<<<<<< HEAD - + -======= - + {/* Поисковая строка */} { /> ->>>>>>> a3ad9832ae1663e2a76b50c417d43bcb23a0e03a { refreshing={loading} contentContainerStyle={styles.listContent} showsVerticalScrollIndicator={false} - ItemSeparatorComponent={() => } + ItemSeparatorComponent={() => } ListEmptyComponent={ - + 💬 - + Нет активных чатов - + Начните новый чат, нажав на кнопку внизу } /> -<<<<<<< HEAD + navigation.navigate('NewChat')} - theme={{ - colors: { - primaryContainer: '#ffffff', - onPrimaryContainer: '#000000', - } - }} + style={[styles.fab, { backgroundColor: theme.colors.primary }]} + onPress={() => navigation.navigate('Contacts')} + color={theme.colors.onPrimary} /> -======= - navigation.navigate('Contacts')} - /> ->>>>>>> a3ad9832ae1663e2a76b50c417d43bcb23a0e03a ); }; @@ -253,40 +209,29 @@ export const ConversationsScreen = ({ navigation }: any) => { const styles = StyleSheet.create({ container: { flex: 1, - backgroundColor: '#0a0a0a', }, -<<<<<<< HEAD loadingContainer: { -======= + flex: 1, + justifyContent: 'center', + alignItems: 'center', + }, searchContainer: { padding: 16, paddingBottom: 8, - backgroundColor: '#ffffff', elevation: 2, }, searchbar: { elevation: 0, - backgroundColor: '#f5f5f5', - }, - centerContainer: { ->>>>>>> a3ad9832ae1663e2a76b50c417d43bcb23a0e03a - flex: 1, - justifyContent: 'center', - alignItems: 'center', - backgroundColor: '#0a0a0a', }, loadingText: { - color: '#666666', fontSize: 16, }, errorContainer: { flex: 1, justifyContent: 'center', alignItems: 'center', - backgroundColor: '#0a0a0a', }, errorText: { - color: '#ff6b6b', fontSize: 16, marginBottom: 20, }, @@ -294,10 +239,8 @@ const styles = StyleSheet.create({ paddingHorizontal: 24, paddingVertical: 12, borderRadius: 24, - backgroundColor: 'rgba(255, 255, 255, 0.1)', }, retryText: { - color: '#ffffff', fontSize: 14, fontWeight: '600', }, @@ -309,14 +252,12 @@ const styles = StyleSheet.create({ flexDirection: 'row', paddingVertical: 16, paddingHorizontal: 16, - backgroundColor: 'transparent', marginHorizontal: 12, marginVertical: 4, borderRadius: 16, borderWidth: 1, borderColor: 'rgba(255, 255, 255, 0.05)', }, -<<<<<<< HEAD avatarContainer: { position: 'relative', marginRight: 12, @@ -331,20 +272,8 @@ const styles = StyleSheet.create({ backgroundColor: '#2d2d2d', }, avatarLabel: { - color: '#ffffff', fontSize: 20, fontWeight: '600', -======= - time: { - color: '#666', - fontSize: 12, - marginBottom: 4, - }, - unreadBadge: { - backgroundColor: '#2196F3', - color: '#ffffff', - fontSize: 12, ->>>>>>> a3ad9832ae1663e2a76b50c417d43bcb23a0e03a }, onlineBadge: { position: 'absolute', @@ -365,13 +294,11 @@ const styles = StyleSheet.create({ marginBottom: 4, }, conversationTitle: { - color: '#ffffff', fontWeight: '600', flex: 1, marginRight: 12, }, time: { - color: '#666666', fontSize: 12, }, messageRow: { @@ -380,12 +307,15 @@ const styles = StyleSheet.create({ alignItems: 'center', }, lastMessage: { - color: '#999999', flex: 1, }, + unreadBadge: { + backgroundColor: '#2196F3', + color: '#ffffff', + fontSize: 12, + }, separator: { height: 1, - backgroundColor: 'rgba(255, 255, 255, 0.05)', marginHorizontal: 28, marginVertical: 4, }, @@ -394,10 +324,9 @@ const styles = StyleSheet.create({ margin: 16, right: 0, bottom: 0, - backgroundColor: '#ffffff', borderRadius: 16, // iOS тени - shadowColor: '#ffffff', + shadowColor: '#000', shadowOffset: { width: 0, height: 4, @@ -421,7 +350,6 @@ const styles = StyleSheet.create({ justifyContent: 'center', alignItems: 'center', marginBottom: 24, - backgroundColor: 'rgba(255, 255, 255, 0.03)', borderWidth: 1, borderColor: 'rgba(255, 255, 255, 0.05)', }, @@ -437,13 +365,11 @@ const styles = StyleSheet.create({ emptyText: { textAlign: 'center', marginBottom: 12, - color: '#ffffff', fontWeight: '300', letterSpacing: 0.5, }, emptySubtext: { textAlign: 'center', - color: '#666666', maxWidth: 250, }, }); \ No newline at end of file