Files
stats/apps/web/src/app/(app)/layout.tsx
Carl-Gerhard Lindesvärd ccd1a1456f a lot
2024-02-04 13:23:21 +01:00

30 lines
841 B
TypeScript

import { getSession } from '@/server/auth';
import { getRecentDashboardsByUserId } from '@/server/services/dashboard.service';
import { getOrganizations } from '@/server/services/organization.service';
import Auth from '../auth';
import { LayoutSidebar } from './layout-sidebar';
interface AppLayoutProps {
children: React.ReactNode;
}
export default async function AppLayout({ children }: AppLayoutProps) {
const session = await getSession();
const organizations = await getOrganizations();
const recentDashboards = session?.user.id
? await getRecentDashboardsByUserId(session?.user.id)
: [];
if (!session) {
return <Auth />;
}
return (
<div id="dashboard">
<LayoutSidebar {...{ organizations, recentDashboards }} />
<div className="lg:pl-72 transition-all">{children}</div>
</div>
);
}