import { useSession } from "next-auth/react"; import { useRouter } from "next/router"; import type { ComponentProps } from "react"; import React, { useEffect } from "react"; import SettingsLayout from "@calcom/features/settings/layouts/SettingsLayout"; import type Shell from "@calcom/features/shell/Shell"; import { UserPermissionRole } from "@calcom/prisma/enums"; import { ErrorBoundary } from "@calcom/ui"; export default function AdminLayout({ children, ...rest }: { children: React.ReactNode } & ComponentProps) { const session = useSession(); const router = useRouter(); // Force redirect on component level useEffect(() => { if (session.data && session.data.user.role !== UserPermissionRole.ADMIN) { router.replace("/settings/my-account/profile"); } }, [session, router]); const isAppsPage = router.asPath.startsWith("/settings/admin/apps"); return (
*]:flex-1"}> {children}
); } export const getLayout = (page: React.ReactElement) => {page};