diff --git a/src/ConferenceCallManagerHooks.js b/src/ConferenceCallManagerHooks.js index f2e4f287..db93e51f 100644 --- a/src/ConferenceCallManagerHooks.js +++ b/src/ConferenceCallManagerHooks.js @@ -285,15 +285,26 @@ export function useGroupCallRooms(client) { const groupCalls = client.groupCallEventHandler.groupCalls.values(); const rooms = Array.from(groupCalls).map((groupCall) => groupCall.room); const sortedRooms = sortRooms(client, rooms); - setRooms(sortedRooms); + const items = sortedRooms.map((room) => { + const groupCall = client.getGroupCallForRoom(room.roomId); + + return { + room, + groupCall, + participants: [...groupCall.participants], + }; + }); + setRooms(items); } updateRooms(); client.on("GroupCall.incoming", updateRooms); + client.on("GroupCall.participants", updateRooms); return () => { client.removeListener("GroupCall.incoming", updateRooms); + client.removeListener("GroupCall.participants", updateRooms); }; }, []); diff --git a/src/Facepile.jsx b/src/Facepile.jsx new file mode 100644 index 00000000..f2c7d765 --- /dev/null +++ b/src/Facepile.jsx @@ -0,0 +1,24 @@ +import React from "react"; +import styles from "./Facepile.module.css"; +import ColorHash from "color-hash"; + +const colorHash = new ColorHash({ lightness: 0.3 }); + +export function Facepile({ participants }) { + console.log(participants); + return ( +
member.name).join(", ")} + > + {participants.map((member) => ( +
+ {member.name.slice(0, 1).toUpperCase()} +
+ ))} +
+ ); +} diff --git a/src/Facepile.module.css b/src/Facepile.module.css new file mode 100644 index 00000000..94b29a4c --- /dev/null +++ b/src/Facepile.module.css @@ -0,0 +1,25 @@ +.facepile { + margin: 0 16px; +} + +.facepile .avatar { + position: relative; + width: 20px; + height: 20px; + border-radius: 20px; +} + +.facepile .avatar > * { + position: absolute; + left: 0; + color: #fff; + text-align: center; + pointer-events: none; + font-weight: 600; +} + +.facepile .avatar span { + font-size: 14px; + width: 20px; + line-height: 20px; +} diff --git a/src/Home.jsx b/src/Home.jsx index be506c0d..63c45749 100644 --- a/src/Home.jsx +++ b/src/Home.jsx @@ -29,6 +29,7 @@ import { GroupCallIntent, GroupCallType, } from "matrix-js-sdk/src/browser-index"; +import { Facepile } from "./Facepile"; const colorHash = new ColorHash({ lightness: 0.3 }); @@ -171,7 +172,7 @@ export function Home({ client, onLogout }) {

Recent Rooms

- {rooms.map((room) => ( + {rooms.map(({ room, participants }) => ( {room.name.slice(0, 1)}
{room.name}
+ ))}