* feat: add highlight props * feat: add isTemplate prop * feat: add invalid credintial prop * feat: add children prop * feat: render app list card * fix: add horizontal gap * fix: installed app layout style * fix: admin layout * feat: add isGlobal to returned data * feat: fix admin tab. * use common components list and AppListCard * show isDefault Badge * hide switch for global apps * fix: show switch * fix: remove isglobal * fix: layout * refactor: remove unused component and import * feat: use app list card component * fix: query param * fix: prevent unnecessary props passed to the component * feat: add disabled style * feat: add disconnect integration modal * feat: new changes. * render disconnect integration model only once. * add dropdown for actions * feat: changes in admin apps. * use dropdown for selecting action buttons. * use modal for editing keys. * Remove boolean comparison --------- Co-authored-by: Alan <alannnc@gmail.com>
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import { useSession } from "next-auth/react";
|
|
import { useRouter } from "next/router";
|
|
import React, { ComponentProps, useEffect } from "react";
|
|
|
|
import SettingsLayout from "@calcom/features/settings/layouts/SettingsLayout";
|
|
import Shell from "@calcom/features/shell/Shell";
|
|
import { ErrorBoundary } from "@calcom/ui";
|
|
|
|
import { UserPermissionRole } from ".prisma/client";
|
|
|
|
export default function AdminLayout({
|
|
children,
|
|
|
|
...rest
|
|
}: { children: React.ReactNode } & ComponentProps<typeof Shell>) {
|
|
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 (
|
|
<SettingsLayout {...rest}>
|
|
<div className="mx-auto flex max-w-4xl flex-row divide-y divide-gray-200">
|
|
<div className={isAppsPage ? "min-w-0" : "flex flex-1 [&>*]:flex-1"}>
|
|
<ErrorBoundary>{children}</ErrorBoundary>
|
|
</div>
|
|
</div>
|
|
</SettingsLayout>
|
|
);
|
|
}
|
|
|
|
export const getLayout = (page: React.ReactElement) => <AdminLayout>{page}</AdminLayout>;
|