don't hate me, old git is fuck up
This commit is contained in:
32
src/pages/_app.tsx
Normal file
32
src/pages/_app.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { relays } from '@stores/relays';
|
||||
|
||||
import { useStore } from '@nanostores/react';
|
||||
import type { NextPage } from 'next';
|
||||
import type { AppProps } from 'next/app';
|
||||
import { NostrProvider } from 'nostr-react';
|
||||
import type { ReactElement, ReactNode } from 'react';
|
||||
|
||||
import '../App.css';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
export type NextPageWithLayout<P = {}, IP = P> = NextPage<P, IP> & {
|
||||
getLayout?: (page: ReactElement) => ReactNode;
|
||||
};
|
||||
|
||||
type AppPropsWithLayout = AppProps & {
|
||||
Component: NextPageWithLayout;
|
||||
};
|
||||
|
||||
export default function MyApp({ Component, pageProps }: AppPropsWithLayout) {
|
||||
// Use the layout defined at the page level, if available
|
||||
const getLayout = Component.getLayout ?? ((page) => page);
|
||||
// Get relays
|
||||
const $relays = useStore(relays);
|
||||
|
||||
return (
|
||||
<NostrProvider relayUrls={$relays} debug={false}>
|
||||
{getLayout(<Component {...pageProps} />)}
|
||||
</NostrProvider>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user