mirror of
https://github.com/suitenumerique/meet.git
synced 2026-07-26 11:58:53 +00:00
⚡️(frontend) add component to render children only for Admin or User
Introduce a component that renders its children only if the logged-in user is considered Admin or User. This helps avoid mounting the hooks and logic of components that previously early-returned when the user was not admin or owner, but were still re-rendering whenever their internal logic updated.
This commit is contained in:
committed by
aleb_the_flash
parent
07a1425fee
commit
33ac849d3b
@@ -0,0 +1,11 @@
|
||||
import { useIsAdminOrOwner } from '@/features/rooms/livekit/hooks/useIsAdminOrOwner'
|
||||
|
||||
export const AdminOrOwnerOnly = ({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode
|
||||
}) => {
|
||||
const isAdminOrOwner = useIsAdminOrOwner()
|
||||
if (!isAdminOrOwner) return null
|
||||
return children
|
||||
}
|
||||
Reference in New Issue
Block a user