️(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:
lebaudantoine
2026-05-25 22:59:09 +02:00
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
}