mirror of
https://github.com/lukevella/rallly.git
synced 2025-05-28 16:26:24 +02:00
⚡️ Use nextjs layout feature
This commit is contained in:
parent
02ef9000a7
commit
c2c000f770
9 changed files with 168 additions and 154 deletions
|
@ -16,7 +16,9 @@ import Maintenance from "@/components/maintenance";
|
|||
|
||||
import { useCrispChat } from "../components/crisp-chat";
|
||||
import ModalProvider from "../components/modal/modal-provider";
|
||||
import { NextPageWithLayout } from "../types";
|
||||
import { absoluteUrl } from "../utils/absolute-url";
|
||||
import { UserSession } from "../utils/auth";
|
||||
import { trpcNext } from "../utils/trpc";
|
||||
|
||||
const inter = Inter({
|
||||
|
@ -29,7 +31,15 @@ const noto = Noto_Sans_Mono({
|
|||
display: "swap",
|
||||
});
|
||||
|
||||
const MyApp: NextPage<AppProps> = ({ Component, pageProps }) => {
|
||||
type PageProps = {
|
||||
user: UserSession;
|
||||
};
|
||||
|
||||
type AppPropsWithLayout = AppProps<PageProps> & {
|
||||
Component: NextPageWithLayout<PageProps>;
|
||||
};
|
||||
|
||||
const MyApp: NextPage<AppPropsWithLayout> = ({ Component, pageProps }) => {
|
||||
useCrispChat();
|
||||
|
||||
React.useEffect(() => {
|
||||
|
@ -43,6 +53,8 @@ const MyApp: NextPage<AppProps> = ({ Component, pageProps }) => {
|
|||
return <Maintenance />;
|
||||
}
|
||||
|
||||
const getLayout = Component.getLayout ?? ((page) => page);
|
||||
|
||||
return (
|
||||
<>
|
||||
<DefaultSeo
|
||||
|
@ -77,9 +89,7 @@ const MyApp: NextPage<AppProps> = ({ Component, pageProps }) => {
|
|||
--font-noto: ${noto.style.fontFamily};
|
||||
}
|
||||
`}</style>
|
||||
<ModalProvider>
|
||||
<Component {...pageProps} />
|
||||
</ModalProvider>
|
||||
<ModalProvider>{getLayout(<Component {...pageProps} />)}</ModalProvider>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue