From f0c46f2fbe20ca49efdbc8029c7548c650c23698 Mon Sep 17 00:00:00 2001 From: AngelV3rgs Date: Sun, 3 Sep 2023 22:31:41 +0800 Subject: [PATCH] added conversation/groupchat page --- App.tsx | 2 + .../DrawerSettings/CustomDrawerContent.tsx | 9 +- .../ConversationPage/ConversationPage.tsx | 179 ++++++++++++++++++ src/routes/Login/Login.tsx | 4 +- src/styles.tsx | 10 + 5 files changed, 201 insertions(+), 3 deletions(-) create mode 100644 src/routes/ConversationPage/ConversationPage.tsx diff --git a/App.tsx b/App.tsx index bf69a4b..715051f 100644 --- a/App.tsx +++ b/App.tsx @@ -21,6 +21,7 @@ import { QueryClientProvider, QueryClient } from "@tanstack/react-query"; import { StatusBar } from "expo-status-bar"; import UserInfoPage from "./src/routes/UserInfoPage/UserInfoPage"; import SubjectsPage from "./src/routes/SubjectsPage/SubjectsPage"; +import ConversationPage from "./src/routes/ConversationPage/ConversationPage"; const Drawer = createDrawerNavigator(); @@ -73,6 +74,7 @@ export default function App() { + diff --git a/src/components/DrawerSettings/CustomDrawerContent.tsx b/src/components/DrawerSettings/CustomDrawerContent.tsx index 738e656..0c46297 100644 --- a/src/components/DrawerSettings/CustomDrawerContent.tsx +++ b/src/components/DrawerSettings/CustomDrawerContent.tsx @@ -124,7 +124,14 @@ export default function CustomDrawerContent(props: {}) { Register - + { + navigation.navigate("Conversation"); + }} + > + + Conversation + {/* Debug buttons for accessing revalidation and activation page ([{ + username: "You", + message: "Hello World naa ko diri canteen gutom sh*t.", + userId: Math.floor(Math.random() * 1000), + type: "o", + color: Math.floor(Math.random() * 16777215).toString(16) + }, { + username: "User 2", + message: "Hahahah shor oy.", + userId: Math.floor(Math.random() * 1000), + type: "i", + color: Math.floor(Math.random() * 16777215).toString(16) + }, { + username: "User 3", + message: "AHAHAHHA BOBO!", + userId: Math.floor(Math.random() * 1000), + type: "i", + color: Math.floor(Math.random() * 16777215).toString(16) + }, + { + username: "Vale", + message: "tanga valir! bobo!", + userId: Math.floor(Math.random() * 1000), + type: "i", + color: Math.floor(Math.random() * 16777215).toString(16) + }, + { + username: "You", + message: "Hoyy bobo!!!", + userId: Math.floor(Math.random() * 1000), + type: "o", + color: Math.floor(Math.random() * 16777215).toString(16) + }, { + username: "Valir", + message: "Gago! 1v1 nalng?", + userId: Math.floor(Math.random() * 1000), + type: "o", + color: Math.floor(Math.random() * 16777215).toString(16) + }, { + username: "User 2", + message: "Hello World", + userId: Math.floor(Math.random() * 1000), + type: "i", + color: Math.floor(Math.random() * 16777215).toString(16) + }, { + username: "User 3", + message: "Hello World", + userId: Math.floor(Math.random() * 1000), + type: "i", + color: Math.floor(Math.random() * 16777215).toString(16) + }, + { + username: "User 1", + message: "Hello World", + userId: Math.floor(Math.random() * 1000), + type: "o", + color: Math.floor(Math.random() * 16777215).toString(16) + }, + { + username: "User 1", + message: "Hello World", + userId: Math.floor(Math.random() * 1000), + type: "o", + color: Math.floor(Math.random() * 16777215).toString(16) + }, + { + username: "User 1", + message: "Hello World", + userId: Math.floor(Math.random() * 1000), + type: "o", + color: Math.floor(Math.random() * 16777215).toString(16) + }, + { + username: "User 1", + message: "Hello World", + userId: Math.floor(Math.random() * 1000), + type: "o", + color: Math.floor(Math.random() * 16777215).toString(16) + } + ]); + + return ( + + + + + Group#57605 + + 3 students + + + + + + + { + conversation.map((item: ConversationType) => ( + + + + { + item.type == 'i' ? : null + } + {item.username} + { + item.type == 'o' ? : null + } + + + {item.message} + + + )) + } + + + + + ); +} diff --git a/src/routes/Login/Login.tsx b/src/routes/Login/Login.tsx index 34a3d6f..1a5cf31 100644 --- a/src/routes/Login/Login.tsx +++ b/src/routes/Login/Login.tsx @@ -94,8 +94,8 @@ export default function Login() { } console.log(JSON.stringify(user_info)); } else { - console.log("heh", ParseLoginError(JSON.stringify(result[1]))); - setError(ParseLoginError(JSON.stringify(result[1]))); + console.log("heh", ParseLoginError(JSON.stringify(result[1]))); + setError(ParseLoginError(JSON.stringify(result[1]))); } }); }} diff --git a/src/styles.tsx b/src/styles.tsx index 826adcf..c1a1613 100644 --- a/src/styles.tsx +++ b/src/styles.tsx @@ -200,5 +200,15 @@ const styles = StyleSheet.create({ padding: 0, border: 0, }, + chatbox: { + paddingHorizontal: 8, + height: 50, + marginVertical: 10, + borderWidth: 1, + color: colors.text_default, + backgroundColor: colors.primary_2, + borderRadius: 20, + borderColor: colors.primary_3, + } }); export default styles;