From 409a496ce478366739f09b437c18161067a6dd69 Mon Sep 17 00:00:00 2001 From: talksik Date: Tue, 10 May 2022 11:00:17 -0500 Subject: [PATCH] putting avatars showing who is tuned in --- .../src/pages/terminal/details/index.tsx | 0 packages/desktop/src/pages/terminal/index.tsx | 91 +++++++++++++++---- 2 files changed, 72 insertions(+), 19 deletions(-) delete mode 100644 packages/desktop/src/pages/terminal/details/index.tsx diff --git a/packages/desktop/src/pages/terminal/details/index.tsx b/packages/desktop/src/pages/terminal/details/index.tsx deleted file mode 100644 index e69de29..0000000 diff --git a/packages/desktop/src/pages/terminal/index.tsx b/packages/desktop/src/pages/terminal/index.tsx index b0e62e0..8a15e25 100644 --- a/packages/desktop/src/pages/terminal/index.tsx +++ b/packages/desktop/src/pages/terminal/index.tsx @@ -1,12 +1,13 @@ import { $desktopMode, $selectedLineId } from "../../controller/recoil"; +import { Avatar, Skeleton, Tooltip } from "antd"; import { FiActivity, FiSettings, FiSun } from "react-icons/fi"; import { GlobalHotKeys, KeyMap } from "react-hotkeys"; -import { Skeleton, Tooltip } from "antd"; import { useCallback, useEffect, useMemo, useState } from "react"; import { useGetUserDetails, useUserLines } from "../../controller/index"; import { useRecoilState, useSetRecoilState } from "recoil"; import { FaPlus } from "react-icons/fa"; +import LineIcon from "../../components/lines/lineIcon/index"; import { LineMemberState } from "@nirvana/core/models/line.model"; import LineRow from "../../components/lines/lineRow.tsx/index"; import MasterLineData from "@nirvana/core/models/masterLineData.model"; @@ -302,35 +303,81 @@ function LineDetailsTerminal({ [userDetails, selectedLine] ); + // 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[] = []; + + 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); + return; + } + + const otherUserObject = selectedLine.otherUserObjects?.find( + (userObj) => userObj._id.toString() === tunedInMemberUserId + ); + if (otherUserObject?.picture) + pictureSources.push(otherUserObject.picture); + }); + + return pictureSources; + }, [selectedLine, userDetails]); + return (
- {/* controls */} + {/* line details */}
- {`${ - selectedLine?.tunedInMemberIds?.length ?? 0 - } on the line`} + {profilePictures && ( + + {profilePictures?.map((avatarSrc, index) => ( + + ))} + + )} + + {`on the line`} {/* TODO: move to on hover of line row */} +
-
+ + {/* line timeline + present moment*/} +
+ + - + > + + ); }