2025-08-04 17:45:44 +02:00
|
|
|
import type { NextPage } from "next";
|
|
|
|
|
import type { AppProps } from "next/app";
|
|
|
|
|
import Head from "next/head";
|
|
|
|
|
import { useRouter } from "next/router";
|
2025-08-28 18:27:07 +02:00
|
|
|
import type { ComponentProps, ReactElement, ReactNode } from "react";
|
2025-08-04 17:45:44 +02:00
|
|
|
import { Toaster } from "react-hot-toast";
|
|
|
|
|
import "~/styles/globals.css";
|
|
|
|
|
import { ThemeProvider as NextThemesProvider } from "next-themes";
|
|
|
|
|
import { Layout } from "~/components/Layout";
|
2025-08-28 18:27:07 +02:00
|
|
|
import { I18nProvider } from "~/providers/I18nProvider";
|
|
|
|
|
import { SessionProvider } from "~/providers/SessionProvider";
|
|
|
|
|
import { api } from "~/utils/api";
|
2025-08-04 17:45:44 +02:00
|
|
|
import { inter } from "~/utils/fonts";
|
|
|
|
|
import "react-day-picker/dist/style.css";
|
2025-08-06 09:26:35 +02:00
|
|
|
import NextNProgress from "nextjs-progressbar";
|
2025-08-28 18:27:07 +02:00
|
|
|
import { NuqsAdapter } from "nuqs/adapters/next/pages";
|
2025-08-04 17:45:44 +02:00
|
|
|
|
|
|
|
|
type ThemeProviderProps = ComponentProps<typeof NextThemesProvider>;
|
|
|
|
|
export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
|
2025-08-28 18:27:07 +02:00
|
|
|
return <NextThemesProvider {...props}>{children}</NextThemesProvider>;
|
2025-08-04 17:45:44 +02:00
|
|
|
}
|
|
|
|
|
|
2025-08-28 18:27:07 +02:00
|
|
|
// biome-ignore lint/complexity/noBannedTypes: <intended>
|
2025-08-04 17:45:44 +02:00
|
|
|
export type NextPageWithLayout<P = {}, IP = P> = NextPage<P, IP> & {
|
2025-08-28 18:27:07 +02:00
|
|
|
// biome-ignore lint/suspicious/noExplicitAny: <known good>
|
|
|
|
|
getLayout?: (page: ReactElement<any>) => ReactNode;
|
2025-08-04 17:45:44 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
type AppPropsWithLayout<P> = AppProps<P> & {
|
2025-08-28 18:27:07 +02:00
|
|
|
Component: NextPageWithLayout<P>;
|
2025-08-04 17:45:44 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const MyApp = ({
|
2025-08-28 18:27:07 +02:00
|
|
|
Component,
|
|
|
|
|
pageProps,
|
2025-08-04 17:45:44 +02:00
|
|
|
}: AppPropsWithLayout<{ prop: null }>) => {
|
2025-08-28 18:27:07 +02:00
|
|
|
const router = useRouter();
|
|
|
|
|
const { locale } = router;
|
|
|
|
|
|
|
|
|
|
// Use the layout defined at the page level, if available
|
|
|
|
|
const getLayout = Component.getLayout || ((page) => <Layout>{page}</Layout>);
|
2025-08-04 17:45:44 +02:00
|
|
|
|
2025-08-28 18:27:07 +02:00
|
|
|
return (
|
|
|
|
|
<NuqsAdapter>
|
|
|
|
|
<I18nProvider locale={locale}>
|
|
|
|
|
<SessionProvider>
|
|
|
|
|
<ThemeProvider
|
|
|
|
|
attribute="class"
|
2025-11-14 17:30:12 +01:00
|
|
|
defaultTheme="system"
|
2025-08-28 18:27:07 +02:00
|
|
|
disableTransitionOnChange
|
2025-08-29 16:18:32 +02:00
|
|
|
enableSystem
|
2025-08-28 18:27:07 +02:00
|
|
|
>
|
|
|
|
|
<Head>
|
|
|
|
|
<title>Infoalloggi.it</title>
|
|
|
|
|
<meta
|
|
|
|
|
content="width=device-width, initial-scale=1.0"
|
2025-08-29 16:18:32 +02:00
|
|
|
name="viewport"
|
2025-08-28 18:27:07 +02:00
|
|
|
/>
|
|
|
|
|
<meta
|
|
|
|
|
content={
|
|
|
|
|
locale === "it"
|
|
|
|
|
? "Trova casa ora con Infoalloggi"
|
|
|
|
|
: "Find your next home now!"
|
|
|
|
|
}
|
2025-08-29 16:18:32 +02:00
|
|
|
name="description"
|
2025-08-28 18:27:07 +02:00
|
|
|
/>
|
|
|
|
|
</Head>
|
2025-08-04 17:45:44 +02:00
|
|
|
|
2025-08-29 16:18:32 +02:00
|
|
|
<style global jsx>{`
|
2025-08-04 17:45:44 +02:00
|
|
|
:root {
|
|
|
|
|
--font-inter: ${inter.style.fontFamily};
|
|
|
|
|
}
|
|
|
|
|
`}</style>
|
|
|
|
|
|
2025-09-09 15:07:23 +02:00
|
|
|
<Toaster
|
|
|
|
|
containerClassName="mt-10"
|
|
|
|
|
position="top-right"
|
|
|
|
|
reverseOrder={false}
|
|
|
|
|
/>
|
2025-08-28 18:27:07 +02:00
|
|
|
{!router.pathname.startsWith("/annunci") && (
|
|
|
|
|
<NextNProgress options={{ showSpinner: false }} />
|
|
|
|
|
)}
|
2025-08-08 16:55:02 +02:00
|
|
|
|
2025-08-28 18:27:07 +02:00
|
|
|
{getLayout(<Component {...pageProps} />)}
|
|
|
|
|
</ThemeProvider>
|
|
|
|
|
</SessionProvider>
|
|
|
|
|
</I18nProvider>
|
|
|
|
|
</NuqsAdapter>
|
|
|
|
|
);
|
2025-08-04 17:45:44 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default api.withTRPC(MyApp);
|