diff --git a/src/frontend/src/features/rooms/livekit/components/controls/Participants/ParticipantsToggle.tsx b/src/frontend/src/features/rooms/livekit/components/controls/Participants/ParticipantsToggle.tsx new file mode 100644 index 00000000..bb3610d0 --- /dev/null +++ b/src/frontend/src/features/rooms/livekit/components/controls/Participants/ParticipantsToggle.tsx @@ -0,0 +1,66 @@ +import { useTranslation } from 'react-i18next' +import { RiGroupLine, RiInfinityLine } from '@remixicon/react' +import { Button } from '@/primitives' +import { css } from '@/styled-system/css' +import { useParticipants } from '@livekit/components-react' +import { useState } from 'react' + +export const ParticipantsToggle = () => { + const { t } = useTranslation('rooms') + + /** + * Context could not be used due to inconsistent refresh behavior. + * The 'numParticipant' property on the room only updates when the room's metadata changes, + * resulting in a delay compared to the participant list's actual refresh rate. + */ + const participants = useParticipants() + const numParticipants = participants?.length + + const [isOpen, setIsOpen] = useState(false) + const tooltipLabel = isOpen ? 'open' : 'closed' + + return ( +
+ +
+ {numParticipants < 100 ? ( + numParticipants || 1 + ) : ( + + )} +
+
+ ) +} diff --git a/src/frontend/src/locales/de/rooms.json b/src/frontend/src/locales/de/rooms.json index 72747f21..208733a1 100644 --- a/src/frontend/src/locales/de/rooms.json +++ b/src/frontend/src/locales/de/rooms.json @@ -29,7 +29,11 @@ "shareScreen": "", "stopScreenShare": "", "chat": "", - "leave": "" + "leave": "", + "participants": { + "open": "", + "closed": "" + } }, "options": { "buttonLabel": "", diff --git a/src/frontend/src/locales/en/rooms.json b/src/frontend/src/locales/en/rooms.json index 3391b7dd..016d8644 100644 --- a/src/frontend/src/locales/en/rooms.json +++ b/src/frontend/src/locales/en/rooms.json @@ -29,7 +29,11 @@ "shareScreen": "Share screen", "stopScreenShare": "Stop screen share", "chat": "Chat", - "leave": "Leave" + "leave": "Leave", + "participants": { + "open": "Hide everyone", + "closed": "See everyone" + } }, "options": { "buttonLabel": "More Options", diff --git a/src/frontend/src/locales/fr/rooms.json b/src/frontend/src/locales/fr/rooms.json index bf30d9dc..06fee641 100644 --- a/src/frontend/src/locales/fr/rooms.json +++ b/src/frontend/src/locales/fr/rooms.json @@ -29,7 +29,11 @@ "shareScreen": "Partager l'Ă©cran", "stopScreenShare": "ArrĂȘter le partage", "chat": "Chat", - "leave": "Quitter" + "leave": "Quitter", + "participants": { + "open": "Masquer les participants", + "closed": "Afficher les participants" + } }, "options": { "buttonLabel": "Plus d'options",