kreativortex/app/[locale]/(app)/dashboard/layout.tsx
Jessica Rekcah 4253483f44 jalan
2025-12-02 00:22:34 +07:00

82 lines
1.9 KiB
TypeScript

/**
* File: layout.tsx
* Created by: AI Assistant
* Date: 2025-11-29
* Purpose: Dashboard layout for kreatiVortex platform
* Part of: kreatiVortex - Platform Pembelajaran Tari Online
*/
import { ReactNode } from 'react';
import { DashboardProfile, DashboardMenu } from '@/components/Layouts';
import { auth } from '@/lib/auth';
import { headers } from 'next/headers';
import { redirect } from 'next/navigation';
import { prisma } from '@/lib/prisma';
export default async function DashboardLayout({
children,
}: {
children: ReactNode;
}) {
const session = await auth.api.getSession({
headers: await headers()
});
if (!session) {
redirect('/auth/signin');
}
const menus = await prisma.menu.findMany({
where: {
parentId: null,
isActive: true,
},
select: {
id: true,
name: true,
slug: true,
children: {
where: {
isActive: true,
},
select: {
id: true,
name: true,
slug: true,
},
},
},
orderBy: {
createdAt: 'asc',
},
});
return (
<div className="min-h-screen">
<div className="floating-background dark"></div>
<div className="container mx-auto relative z-10 flex min-h-screen">
<div className="flex-1 overflow-auto">
<header className="px-6 py-4">
<div className="flex items-center justify-between">
<p className="text-2xl font-semibold text-white">
KreatiVortex
</p>
<div className='flex'>
<DashboardMenu menus={menus as any} />
</div>
<div className="flex items-center space-x-4">
<DashboardProfile />
</div>
</div>
</header>
<main className="p-6">
{children}
</main>
</div>
</div>
</div>
);
}