mirror of
https://github.com/documenso/documenso.git
synced 2025-11-14 08:42:12 +10:00
fix: update layout and wording
This commit is contained in:
@ -1,23 +1,19 @@
|
||||
import { redirect } from 'next/navigation';
|
||||
import React from 'react';
|
||||
|
||||
import { getRequiredServerComponentSession } from '@documenso/lib/next-auth/get-server-session';
|
||||
import { isAdmin } from '@documenso/lib/next-auth/guards/is-admin';
|
||||
import { AdminNav } from './nav';
|
||||
|
||||
export type AdminLayoutProps = {
|
||||
export type AdminSectionLayoutProps = {
|
||||
children: React.ReactNode;
|
||||
};
|
||||
|
||||
export default async function AdminLayout({ children }: AdminLayoutProps) {
|
||||
const user = await getRequiredServerComponentSession();
|
||||
const isUserAdmin = isAdmin(user);
|
||||
export default function AdminSectionLayout({ children }: AdminSectionLayoutProps) {
|
||||
return (
|
||||
<div className="mx-auto mt-16 w-full max-w-screen-xl px-4 md:px-8">
|
||||
<div className="grid grid-cols-12 gap-x-8 md:mt-8">
|
||||
<AdminNav className="col-span-12 md:col-span-3 md:flex" />
|
||||
|
||||
if (!user) {
|
||||
redirect('/signin');
|
||||
}
|
||||
|
||||
if (!isUserAdmin) {
|
||||
redirect('/dashboard');
|
||||
}
|
||||
|
||||
return <main className="mt-8 pb-8 md:mt-12 md:pb-12">{children}</main>;
|
||||
<div className="col-span-12 mt-12 md:col-span-9 md:mt-0">{children}</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user