-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug: Dashboard4 New API key screen not ported (#526)
* Bug: Dashboard4 New API key screen not ported Fixes #525 * Removed unused variables --------- Co-authored-by: Rajat Saxena <[email protected]>
- Loading branch information
1 parent
e5a9ded
commit 3928312
Showing
7 changed files
with
109 additions
and
28 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
apps/web/app/dashboard4/(sidebar)/settings/apikeys/new/layout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { APIKEY_NEW_HEADER } from "@ui-config/strings"; | ||
import type { Metadata, ResolvingMetadata } from "next"; | ||
import { ReactNode } from "react"; | ||
|
||
export async function generateMetadata( | ||
_: any, | ||
parent: ResolvingMetadata, | ||
): Promise<Metadata> { | ||
return { | ||
title: `${APIKEY_NEW_HEADER} | ${(await parent)?.title?.absolute}`, | ||
}; | ||
} | ||
|
||
export default function Layout({ children }: { children: ReactNode }) { | ||
return children; | ||
} |
32 changes: 32 additions & 0 deletions
32
apps/web/app/dashboard4/(sidebar)/settings/apikeys/new/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"use client"; | ||
|
||
import { useContext } from "react"; | ||
import LoadingScreen from "@components/admin/loading-screen"; | ||
import { checkPermission } from "@courselit/utils"; | ||
import { AddressContext, ProfileContext } from "@components/contexts"; | ||
import { UIConstants } from "@courselit/common-models"; | ||
import DashboardContent from "@components/admin/dashboard-content"; | ||
import { SITE_SETTINGS_PAGE_HEADING } from "@ui-config/strings"; | ||
import dynamic from "next/dynamic"; | ||
const { permissions } = UIConstants; | ||
|
||
const ApikeyNew = dynamic( | ||
() => import("@/components/admin/settings/apikey/new"), | ||
); | ||
|
||
const breadcrumbs = [{ label: SITE_SETTINGS_PAGE_HEADING, href: "#" }]; | ||
|
||
export default function Page() { | ||
const address = useContext(AddressContext); | ||
const profile = useContext(ProfileContext); | ||
|
||
if (!checkPermission(profile.permissions!, [permissions.manageSettings])) { | ||
return <LoadingScreen />; | ||
} | ||
|
||
return ( | ||
<DashboardContent breadcrumbs={breadcrumbs}> | ||
<ApikeyNew prefix="/dashboard4" address={address} /> | ||
</DashboardContent> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters