Persist versioned models and validated network metadata in IndexedDB. Show scene download progress and recoverable errors with the existing frosted material. Connect existing skeletons to pending navigation and route boundaries while preserving the map. Previously only dynamic imports showed fallbacks, and rejected model promises prevented retries. Verified: 32 focused unit tests; 4 navigation and scene browser checks; 7 cache browser checks including invalid-metadata recovery; isolated production build and type checks.
68 lines
1.6 KiB
TypeScript
68 lines
1.6 KiB
TypeScript
import type { Metadata } from "next";
|
|
import { cookies } from "next/headers";
|
|
import type { ReactNode } from "react";
|
|
|
|
import authOptions from "@app/api/auth/[...nextauth]/options";
|
|
import { Header } from "@components/header";
|
|
import { Title } from "@components/title";
|
|
import { AppSider } from "@components/sider/AppSider";
|
|
import {
|
|
NavigationFeedbackProvider,
|
|
PageNavigationContent,
|
|
} from "@components/loading/NavigationFeedback";
|
|
import { ThemedLayout } from "@refinedev/mui";
|
|
import { getServerSession } from "next-auth/next";
|
|
import { redirect } from "next/navigation";
|
|
|
|
import "../globals.css";
|
|
|
|
import { META_DATA } from "@config/config";
|
|
|
|
export const metadata: Metadata = META_DATA;
|
|
|
|
export default async function MainLayout({
|
|
children,
|
|
}: Readonly<{
|
|
children: ReactNode;
|
|
}>) {
|
|
const cookieStore = await cookies();
|
|
const theme = cookieStore.get("theme");
|
|
const defaultMode = theme?.value === "dark" ? "dark" : "light";
|
|
|
|
const data = await getData();
|
|
|
|
if (!data.session?.user) {
|
|
return redirect("/login");
|
|
}
|
|
|
|
return (
|
|
<NavigationFeedbackProvider>
|
|
<ThemedLayout
|
|
Header={Header}
|
|
Title={Title}
|
|
Sider={AppSider}
|
|
childrenBoxProps={{
|
|
sx: {
|
|
flex: 1,
|
|
minHeight: 0,
|
|
overflow: "hidden",
|
|
p: 0,
|
|
},
|
|
}}
|
|
containerBoxProps={{
|
|
sx: { height: "100vh", overflow: "hidden" },
|
|
}}
|
|
>
|
|
<PageNavigationContent>{children}</PageNavigationContent>
|
|
</ThemedLayout>
|
|
</NavigationFeedbackProvider>
|
|
);
|
|
}
|
|
|
|
async function getData() {
|
|
const session = await getServerSession(authOptions);
|
|
return {
|
|
session,
|
|
};
|
|
}
|