From ada5ddc675e90b877855949e0249f1e3480490f1 Mon Sep 17 00:00:00 2001 From: barnabasmolnar Date: Tue, 8 Aug 2023 01:13:01 +0200 Subject: [PATCH] [WIP] Dropdown => Popover for userlist. Seems to make more sense with the fixed header and footer elements. --- src/actions/actionNavigate.tsx | 24 ++++----- src/components/UserList.scss | 39 ++++++++++++++ src/components/UserList.tsx | 98 ++++++++++++++++++++-------------- 3 files changed, 109 insertions(+), 52 deletions(-) diff --git a/src/actions/actionNavigate.tsx b/src/actions/actionNavigate.tsx index a7bf8087f..8434876ad 100644 --- a/src/actions/actionNavigate.tsx +++ b/src/actions/actionNavigate.tsx @@ -1,6 +1,5 @@ import { getClientColor } from "../clients"; import { Avatar } from "../components/Avatar"; -import DropdownMenu from "../components/dropdownMenu/DropdownMenu"; import { centerScrollOn } from "../scene/scroll"; import { Collaborator } from "../types"; import { register } from "./register"; @@ -58,20 +57,19 @@ export const actionGoToCollaborator = register({ const background = getClientColor(clientId); return withName ? ( - updateData({ ...collaborator, clientId })} - icon={ - {}} - name={collaborator.username || ""} - src={collaborator.avatarUrl} - isBeingFollowed={appState.userToFollow?.clientId === clientId} - /> - } +
updateData({ ...collaborator, clientId })} > + {}} + name={collaborator.username || ""} + src={collaborator.avatarUrl} + isBeingFollowed={appState.userToFollow?.clientId === clientId} + /> {collaborator.username} - +
) : ( ; const FIRST_N_AVATARS = 3; @@ -116,18 +132,16 @@ export const UserList = ({ }) => { const actionManager = useExcalidrawActionManager(); - const [open, setOpen] = React.useState(false); + // const uniqueCollaboratorsMap = new Map(); + // collaborators.forEach((collaborator, socketId) => { + // uniqueCollaboratorsMap.set( + // // filter on user id, else fall back on unique socketId + // collaborator.id || socketId, + // collaborator, + // ); + // }); - const uniqueCollaboratorsMap = new Map(); - collaborators.forEach((collaborator, socketId) => { - uniqueCollaboratorsMap.set( - // filter on user id, else fall back on unique socketId - collaborator.id || socketId, - collaborator, - ); - }); - - // const uniqueCollaboratorsMap = sampleCollaborators; + const uniqueCollaboratorsMap = sampleCollaborators; const uniqueCollaboratorsArray = Array.from(uniqueCollaboratorsMap).filter( ([_, collaborator]) => Object.keys(collaborator).length !== 0, ); @@ -167,33 +181,39 @@ export const UserList = ({ {first3avatarsJSX} {uniqueCollaboratorsArray.length > FIRST_N_AVATARS && ( -
- - { - setOpen(!open); - }} - > - +{uniqueCollaboratorsArray.length - FIRST_N_AVATARS} - - { - setOpen(false); - }} - > - {uniqueCollaboratorsArray.map(([clientId, collaborator]) => - renderCollaborator({ - actionManager, - collaborator, - clientId, - withName: true, - }), - )} - - -
+ + + +{uniqueCollaboratorsArray.length - FIRST_N_AVATARS} + + + + {/* TODO follow-participant */} +
TODO search
+
+ {uniqueCollaboratorsArray.map(([clientId, collaborator]) => + renderCollaborator({ + actionManager, + collaborator, + clientId, + withName: true, + }), + )} +
+ {/* TODO follow-participant */} +
+
TODO hint
+
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. + Quibusdam, ipsum! +
+
+
+
+
)} );