From c3ca3fa7df3940ba4fda769e82edcaacd99fc6a0 Mon Sep 17 00:00:00 2001 From: talksik Date: Sat, 28 May 2022 18:00:02 -0500 Subject: [PATCH] cleaning and showing stuff --- packages/desktop/src/components/Terminal.tsx | 328 ++++++++++--------- 1 file changed, 179 insertions(+), 149 deletions(-) diff --git a/packages/desktop/src/components/Terminal.tsx b/packages/desktop/src/components/Terminal.tsx index d0209be..577eb8f 100644 --- a/packages/desktop/src/components/Terminal.tsx +++ b/packages/desktop/src/components/Terminal.tsx @@ -495,155 +495,7 @@ function MainPanel() { return ( {selectedConversation ? ( - <> - - - - - - {'Viet Phan'} - - - - - - - - - - - - - - yesterday - - - - - - - - {'Viet Phan'} - - - - - - - - - - - - today - - - - - - - - {'Viet Phan'} - - - - - - - - - - - - right now - - - - - - - - {'Arjun Patel'} - - - - - - - - - - - - - - - - - - + ) : ( ); } + +function ConversationDetails() { + const { user } = useAuth(); + + const { getUser, selectedConversation, selectConversation } = useTerminal(); + + const [conversationUsers, setConversationUsers] = useImmer([]); + + useEffect(() => { + (async () => { + const userPromises = selectedConversation.membersList + .filter((memberId) => memberId !== user.uid) + .map(async (memberId) => await getUser(memberId)); + + const userSettled = await Promise.all(userPromises); + + setConversationUsers(userSettled); + })(); + + return; + }, [selectedConversation.membersList, getUser, user, setConversationUsers]); + + return ( + <> + + + + {conversationUsers.map((conversationUser, index) => ( + + ))} + + + + {selectedConversation.name ?? + conversationUsers.map((conversationUser) => conversationUser.displayName).join(', ')} + + + + + + + + + + + + + + yesterday + + + + + + + + {'Viet Phan'} + + + + + + + + + + + + today + + + + + + + + {'Viet Phan'} + + + + + + + + + + + + right now + + + + + + + + {'Arjun Patel'} + + + + + + + + + + + + + + + + + + + ); +}