mirror of
https://github.com/suitenumerique/meet.git
synced 2026-07-26 11:58:53 +00:00
♻️(frontend) wrap MuteEveryoneButton with AdminOrOwnerOnly
Avoids mounting the button's hooks and rendering its logic for users who are not admin or owner, which previously happened on every re-render of the parent.
This commit is contained in:
committed by
aleb_the_flash
parent
d43b335546
commit
945d779b45
@@ -22,6 +22,7 @@ and this project adheres to
|
|||||||
- ✨(meet) use compatible with summary v2 #1362
|
- ✨(meet) use compatible with summary v2 #1362
|
||||||
- ♻️(backend) refactor analytics backend from Protocol to abstract class
|
- ♻️(backend) refactor analytics backend from Protocol to abstract class
|
||||||
- 🔥(summary) remove call to summary enabled feature flag
|
- 🔥(summary) remove call to summary enabled feature flag
|
||||||
|
- ♻️(frontend) wrap MuteEveryoneButton with AdminOrOwnerOnly
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
|||||||
+13
-6
@@ -1,23 +1,20 @@
|
|||||||
import { Button } from '@/primitives'
|
import { Button } from '@/primitives'
|
||||||
import { useTranslation } from 'react-i18next'
|
import { useTranslation } from 'react-i18next'
|
||||||
import type { Participant } from 'livekit-client'
|
import type { Participant } from 'livekit-client'
|
||||||
import { useIsAdminOrOwner } from '@/features/rooms/livekit/hooks/useIsAdminOrOwner'
|
|
||||||
import { useMuteParticipants } from '@/features/rooms/api/muteParticipants'
|
import { useMuteParticipants } from '@/features/rooms/api/muteParticipants'
|
||||||
import { RiMicOffLine } from '@remixicon/react'
|
import { RiMicOffLine } from '@remixicon/react'
|
||||||
import { css } from '@/styled-system/css'
|
import { css } from '@/styled-system/css'
|
||||||
|
import { AdminOrOwnerOnly } from '@/features/rooms/components/AdminOrOwnerOnly'
|
||||||
|
|
||||||
type MuteEveryoneButtonProps = {
|
type MuteEveryoneButtonProps = {
|
||||||
participants: Array<Participant>
|
participants: Array<Participant>
|
||||||
}
|
}
|
||||||
|
|
||||||
export const MuteEveryoneButton = ({
|
const MuteEveryoneButtonInner = ({ participants }: MuteEveryoneButtonProps) => {
|
||||||
participants,
|
|
||||||
}: MuteEveryoneButtonProps) => {
|
|
||||||
const { muteParticipants } = useMuteParticipants()
|
const { muteParticipants } = useMuteParticipants()
|
||||||
const { t } = useTranslation('rooms')
|
const { t } = useTranslation('rooms')
|
||||||
|
|
||||||
const isAdminOrOwner = useIsAdminOrOwner()
|
if (!participants.length) return null
|
||||||
if (!isAdminOrOwner || !participants.length) return null
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button
|
<Button
|
||||||
@@ -36,3 +33,13 @@ export const MuteEveryoneButton = ({
|
|||||||
</Button>
|
</Button>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const MuteEveryoneButton = ({
|
||||||
|
participants,
|
||||||
|
}: MuteEveryoneButtonProps) => {
|
||||||
|
return (
|
||||||
|
<AdminOrOwnerOnly>
|
||||||
|
<MuteEveryoneButtonInner participants={participants} />
|
||||||
|
</AdminOrOwnerOnly>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user