mirror of
https://github.com/suitenumerique/meet.git
synced 2026-07-26 11:58:53 +00:00
wip for performance use a component instead of a hook to avoid render children
This commit is contained in:
+13
-6
@@ -1,23 +1,20 @@
|
||||
import { Button } from '@/primitives'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
import type { Participant } from 'livekit-client'
|
||||
import { useIsAdminOrOwner } from '@/features/rooms/livekit/hooks/useIsAdminOrOwner'
|
||||
import { useMuteParticipants } from '@/features/rooms/api/muteParticipants'
|
||||
import { RiMicOffLine } from '@remixicon/react'
|
||||
import { css } from '@/styled-system/css'
|
||||
import { AdminOrOwnerOnly } from '@/features/rooms/components/AdminOrOwnerOnly'
|
||||
|
||||
type MuteEveryoneButtonProps = {
|
||||
participants: Array<Participant>
|
||||
}
|
||||
|
||||
export const MuteEveryoneButton = ({
|
||||
participants,
|
||||
}: MuteEveryoneButtonProps) => {
|
||||
const MuteEveryoneButtonInner = ({ participants }: MuteEveryoneButtonProps) => {
|
||||
const { muteParticipants } = useMuteParticipants()
|
||||
const { t } = useTranslation('rooms')
|
||||
|
||||
const isAdminOrOwner = useIsAdminOrOwner()
|
||||
if (!isAdminOrOwner || !participants.length) return null
|
||||
if (!participants.length) return null
|
||||
|
||||
return (
|
||||
<Button
|
||||
@@ -36,3 +33,13 @@ export const MuteEveryoneButton = ({
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
||||
export const MuteEveryoneButton = ({
|
||||
participants,
|
||||
}: MuteEveryoneButtonProps) => {
|
||||
return (
|
||||
<AdminOrOwnerOnly>
|
||||
<MuteEveryoneButtonInner participants={participants} />
|
||||
</AdminOrOwnerOnly>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user