From d4ba042bbcc3fec30f4992ec2916723347bb2acd Mon Sep 17 00:00:00 2001 From: Emre Date: Thu, 30 Mar 2023 19:47:35 +0200 Subject: [PATCH] Realized view conversation page :white_check_mark: --- src/FLAD/components/Friend.tsx | 58 +++++++++++++++++---- src/FLAD/navigation/AuthNavigation.tsx | 3 +- src/FLAD/navigation/MessagingNavigation.tsx | 4 +- src/FLAD/redux/thunk/authThunk.tsx | 1 + src/FLAD/screens/Conversation.tsx | 46 ++++++++++++++-- src/FLAD/screens/Favorite.tsx | 2 +- 6 files changed, 96 insertions(+), 18 deletions(-) diff --git a/src/FLAD/components/Friend.tsx b/src/FLAD/components/Friend.tsx index 15b91e1..80e1d65 100644 --- a/src/FLAD/components/Friend.tsx +++ b/src/FLAD/components/Friend.tsx @@ -1,23 +1,25 @@ import React from 'react'; import { StyleSheet, Text, View, Image } from 'react-native'; +import { color } from 'react-native-reanimated'; import { useSelector } from 'react-redux'; import { GraphicalCharterDark } from '../assets/GraphicalCharterDark'; import { GraphicalCharterLight } from '../assets/GraphicalCharterLight'; import normalize from './Normalize'; -type UserProps = { +type FriendProps = { image: string; name: string; lastMessage: string; } - -export default function Friend() { +export default function Friend(friend: FriendProps) { // @ts-ignore const isDark = useSelector(state => state.userReducer.dark); const style = isDark ? GraphicalCharterDark : GraphicalCharterLight; + const source = typeof friend.image === 'string' ? { uri: friend.image } : friend.image; + const styles = StyleSheet.create({ container: { flexDirection: 'row', @@ -26,21 +28,57 @@ export default function Friend() { }, image: { marginLeft: 15, - marginRight: 7, - width: 50, - height: 50 + marginRight: 12, + width: 55, + height: 55, + borderRadius: 180 }, name: { - fontWeight: 'bold', + fontWeight: "500", color: style.Text, - fontSize: normalize(22) + fontSize: normalize(16) + }, + lastMessageContainer: { + flex: 1, + flexDirection: 'row', + alignItems: 'center', + justifyContent: 'flex-start', + maxWidth: '90%' + }, + lastMessage: { + fontSize: normalize(18), + color: '#989898', + flexShrink: 1 + }, + time: { + fontSize: normalize(18), + color: '#989898' + }, + profilContainer: { + marginTop: 5, + flex: 1, + marginLeft: 5, + alignItems: 'flex-start', + justifyContent: 'center', + }, + button: { + width: normalize(13), + height: normalize(13), + marginRight: 42 } }) return ( - - Emre KARTAL + + + {friend.name} + + {friend.lastMessage} + · 1sem + + + ) } diff --git a/src/FLAD/navigation/AuthNavigation.tsx b/src/FLAD/navigation/AuthNavigation.tsx index 0e2c840..e8c2e32 100644 --- a/src/FLAD/navigation/AuthNavigation.tsx +++ b/src/FLAD/navigation/AuthNavigation.tsx @@ -38,8 +38,9 @@ export default function AuthNavigation() { const currentValue = await AsyncStorage.getItem('dark'); if (currentValue !== null) { const newValue = JSON.stringify(JSON.parse(currentValue)); + //@ts-ignore dispatch(ChangeMode(JSON.parse(newValue))) - } + } } catch (error) { console.log(`Une erreur s'est produite lors de la mise à jour de la valeur booléenne pour la clé 'dark': `, error); } diff --git a/src/FLAD/navigation/MessagingNavigation.tsx b/src/FLAD/navigation/MessagingNavigation.tsx index e8b15f9..b8375a0 100644 --- a/src/FLAD/navigation/MessagingNavigation.tsx +++ b/src/FLAD/navigation/MessagingNavigation.tsx @@ -6,9 +6,9 @@ export default function SpotNavigation() { const Stack = createStackNavigator(); return ( - + diff --git a/src/FLAD/redux/thunk/authThunk.tsx b/src/FLAD/redux/thunk/authThunk.tsx index 13432d8..4780249 100644 --- a/src/FLAD/redux/thunk/authThunk.tsx +++ b/src/FLAD/redux/thunk/authThunk.tsx @@ -124,6 +124,7 @@ export const ChangeMode = (value: boolean) => { export const ChangeImageUserCurrent = (value: ImagePicker) => { //@ts-ignore return async dispatch => { + //@ts-ignore dispatch(userChangeImage(value)); } } \ No newline at end of file diff --git a/src/FLAD/screens/Conversation.tsx b/src/FLAD/screens/Conversation.tsx index 245a95e..fcb5b83 100644 --- a/src/FLAD/screens/Conversation.tsx +++ b/src/FLAD/screens/Conversation.tsx @@ -1,26 +1,64 @@ -import { SafeAreaView, StyleSheet } from "react-native"; +import { SafeAreaView, StyleSheet, Text, View, FlatList, TouchableOpacity } from "react-native"; import { useSelector } from "react-redux"; import { GraphicalCharterDark } from '../assets/GraphicalCharterDark'; import { GraphicalCharterLight } from '../assets/GraphicalCharterLight'; +import Friend from "../components/Friend"; +import normalize from '../components/Normalize'; export default function ConversationList() { // @ts-ignore const isDark = useSelector(state => state.userReducer.dark); + const friends = [ + { id: 1, name: "Lucas", lastMessage: "J'en ai marre de provot", source: require('../assets/images/jul.png') }, + { id: 2, name: "Louison", lastMessage: "Tu vien piscine ?", source: require('../assets/images/jul.png') }, + { id: 3, name: "Dave", lastMessage: "Ok c noté !", source: require('../assets/images/pnl.png') }, + { id: 4, name: "Valentin", lastMessage: "Haha react native c incroyable !!!", source: require('../assets/images/jul.png') }, + ]; + const style = isDark ? GraphicalCharterDark : GraphicalCharterLight; const styles = StyleSheet.create({ mainSafeArea: { flex: 1, backgroundColor: style.body, + }, + titleContainer: { + marginTop: 30, + marginLeft: 20, + }, + title: { + fontSize: normalize(28), + fontWeight: 'bold', + color: style.Text, + }, + description: { + marginTop: 10, + fontSize: normalize(20), + color: '#787878', + marginBottom: 20 } - ) + }) return ( - - + + Messages + Retrouvez ici tous vos amis! + + item.id.toString()} + renderItem={({ item }) => ( + navigation.navigate('Message')}> + + + )} + /> ) } \ No newline at end of file diff --git a/src/FLAD/screens/Favorite.tsx b/src/FLAD/screens/Favorite.tsx index 1c24b7a..a553cf9 100644 --- a/src/FLAD/screens/Favorite.tsx +++ b/src/FLAD/screens/Favorite.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { Image, StyleSheet, Text, View, FlatList, ScrollView, TouchableOpacity, TouchableHighlight, SafeAreaView } from 'react-native'; +import { Image, StyleSheet, Text, View, FlatList, TouchableOpacity, TouchableHighlight, SafeAreaView } from 'react-native'; import CardMusic from '../components/CardMusic'; import normalize from '../components/Normalize'; import Music from '../Model/Music'