From f64ec013e2b48b9be24ea4469aa66e8d9eb8b767 Mon Sep 17 00:00:00 2001 From: talksik Date: Tue, 10 May 2022 11:46:39 -0500 Subject: [PATCH] Update index.tsx really nice header of a line --- packages/desktop/src/pages/terminal/index.tsx | 87 +++++++++++-------- 1 file changed, 53 insertions(+), 34 deletions(-) diff --git a/packages/desktop/src/pages/terminal/index.tsx b/packages/desktop/src/pages/terminal/index.tsx index 8a15e25..3368e34 100644 --- a/packages/desktop/src/pages/terminal/index.tsx +++ b/packages/desktop/src/pages/terminal/index.tsx @@ -305,14 +305,19 @@ function LineDetailsTerminal({ // showing all tuned in members...they may not hear me since they might be doing something else // but feeling of presentness - const profilePictures = useMemo(() => { - const pictureSources: string[] = []; + const tunedProfiles = useMemo(() => { + const pictureSources: { name: string; pictureSrc: string }[] = []; selectedLine.tunedInMemberIds?.forEach((tunedInMemberUserId) => { // don't want to see my own picture // TODO: don't show myself!? if (tunedInMemberUserId === userDetails.user._id.toString()) { - pictureSources.push(userDetails.user?.picture); + pictureSources.push(); + + pictureSources.push({ + name: userDetails.user?.givenName, + pictureSrc: userDetails.user?.picture, + }); return; } @@ -320,7 +325,24 @@ function LineDetailsTerminal({ (userObj) => userObj._id.toString() === tunedInMemberUserId ); if (otherUserObject?.picture) - pictureSources.push(otherUserObject.picture); + pictureSources.push({ + name: otherUserObject.givenName, + pictureSrc: otherUserObject.picture, + }); + }); + + return pictureSources; + }, [selectedLine, userDetails]); + + // pics for the line icons + const profilePictures = useMemo(() => { + const pictureSources: string[] = []; + + // ?don't add in my image as that's useless contextually? + // if (userData?.user?.picture) pictureSources.push(userData.user.picture); + + selectedLine.otherUserObjects?.forEach((otherUser) => { + if (otherUser.picture) pictureSources.push(otherUser.picture); }); return pictureSources; @@ -333,41 +355,38 @@ function LineDetailsTerminal({ > {/* line details */}
{profilePictures && ( - - {profilePictures?.map((avatarSrc, index) => ( - - ))} - + )} - {`on the line`} +
+ +

+ {selectedLine.lineDetails.name || + selectedLine.otherUserObjects[0].givenName} +

- + > + + +
+ + + {`${ + selectedLine.otherMembers?.length ?? 0 + } members`} + + {`${ + selectedLine.tunedInMemberIds?.length ?? 0 + } on the line`} + +
{/* TODO: move to on hover of line row */}