-
Notifications
You must be signed in to change notification settings - Fork 224
Expand file tree
/
Copy pathpage.tsx
More file actions
41 lines (35 loc) · 1.33 KB
/
page.tsx
File metadata and controls
41 lines (35 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"use client";
import DashboardContent from "@components/admin/dashboard-content";
import LoadingScreen from "@components/admin/loading-screen";
import Settings from "@components/admin/settings";
import { ProfileContext, SiteInfoContext } from "@components/contexts";
import { Profile, UIConstants } from "@courselit/common-models";
import { checkPermission } from "@courselit/utils";
import { SITE_SETTINGS_PAGE_HEADING } from "@ui-config/strings";
import { useSearchParams } from "next/navigation";
import { useContext } from "react";
const { permissions } = UIConstants;
const breadcrumbs = [{ label: SITE_SETTINGS_PAGE_HEADING, href: "#" }];
export default function Page() {
const siteinfo = useContext(SiteInfoContext);
const { profile } = useContext(ProfileContext);
const searchParams = useSearchParams();
const tab = searchParams?.get("tab") || "Branding";
if (
!profile ||
!checkPermission(profile.permissions!, [permissions.manageSettings])
) {
return <LoadingScreen />;
}
return (
<DashboardContent breadcrumbs={breadcrumbs}>
<Settings
key={tab}
siteinfo={siteinfo}
profile={profile as Profile}
selectedTab={tab as any}
loading={false}
/>
</DashboardContent>
);
}