MCPcopy Create free account
hub / github.com/code100x/daily-code / AdminLayout

Function AdminLayout

apps/web/app/admin/layout.tsx:7–37  ·  view source on GitHub ↗
({ children }: { children: ReactNode })

Source from the content-addressed store, hash-verified

5import { ReactNode } from "react";
6
7export default async function AdminLayout({ children }: { children: ReactNode }) {
8 const session = await getServerSession(authOptions);
9
10 if (!session?.user?.admin) {
11 return (
12 <div className="flex min-h-screen w-full items-center justify-center gap-4 p-4">
13 <div className="flex flex-col items-center justify-center space-y-4 text-center">
14 <div className="flex flex-col items-center space-y-2">
15 <LockClosedIcon className="h-14 w-14" />
16 <div className="space-y-2">
17 <h1 className="text-3xl font-bold">Access Denied</h1>
18 <p className="text-sm text-gray-500 md:text-base dark:text-gray-400">
19 You do not have permission to access this page.
20 </p>
21 </div>
22 </div>
23 <div className="flex flex-col gap-2 min-[400px]:flex-row">
24 <Link
25 className="inline-flex h-10 items-center justify-center rounded-md border border-gray-200 bg-white px-8 text-sm font-medium shadow-sm transition-colors hover:bg-gray-100 hover:text-gray-900 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-gray-950 disabled:pointer-events-none disabled:opacity-50 dark:border-gray-800 dark:bg-gray-950 dark:hover:bg-gray-800 dark:hover:text-gray-50 dark:focus-visible:ring-gray-300"
26 href="/"
27 >
28 Return to the homepage
29 </Link>
30 </div>
31 </div>
32 </div>
33 );
34 } else {
35 return <>{children}</>;
36 }
37}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected