2023-01-14 19:31:05 +00:00
|
|
|
import type {AppProps} from 'next/app'
|
2023-04-12 20:27:25 +00:00
|
|
|
import {useRouter} from 'next/router'
|
|
|
|
import NProgress from 'nprogress'
|
2023-04-11 21:46:47 +00:00
|
|
|
import {createBrowserSupabaseClient} from '@supabase/auth-helpers-nextjs'
|
|
|
|
import {SessionContextProvider, Session} from '@supabase/auth-helpers-react'
|
2023-04-12 20:27:25 +00:00
|
|
|
import {useEffect, useState} from 'react'
|
2023-05-28 20:15:39 +00:00
|
|
|
import {Header} from '@/components/common/Header'
|
|
|
|
import {Footer} from '@/components/common/Footer'
|
2023-01-14 19:31:05 +00:00
|
|
|
|
2023-04-12 20:27:25 +00:00
|
|
|
import '../styles/nprogress.css'
|
2023-01-19 21:53:37 +00:00
|
|
|
import '../styles/tailwind.css'
|
2023-01-14 19:31:05 +00:00
|
|
|
import 'focus-visible'
|
|
|
|
|
2023-04-11 21:46:47 +00:00
|
|
|
export default function App({Component, pageProps}: AppProps<{ initialSession: Session }>) {
|
|
|
|
const [supabaseClient] = useState(() => createBrowserSupabaseClient())
|
2023-04-12 20:27:25 +00:00
|
|
|
const router = useRouter()
|
|
|
|
NProgress.configure({showSpinner: false})
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
const handleRouteStart = () => NProgress.start()
|
|
|
|
const handleRouteDone = () => NProgress.done()
|
|
|
|
|
|
|
|
router.events.on("routeChangeStart", handleRouteStart)
|
|
|
|
router.events.on("routeChangeComplete", handleRouteDone)
|
|
|
|
router.events.on("routeChangeError", handleRouteDone)
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
router.events.off("routeChangeStart", handleRouteStart)
|
|
|
|
router.events.off("routeChangeComplete", handleRouteDone)
|
|
|
|
router.events.off("routeChangeError", handleRouteDone)
|
|
|
|
}
|
|
|
|
})
|
2023-04-11 21:46:47 +00:00
|
|
|
|
2023-01-14 19:31:05 +00:00
|
|
|
return (
|
2023-04-11 21:46:47 +00:00
|
|
|
<SessionContextProvider supabaseClient={supabaseClient} initialSession={pageProps.initialSession}>
|
2023-01-14 19:31:05 +00:00
|
|
|
<div className="fixed inset-0 flex justify-center sm:px-8">
|
|
|
|
<div className="flex w-full max-w-7xl lg:px-8">
|
2023-01-23 19:51:54 +00:00
|
|
|
<div className="w-full bg-white dark:bg-black-950 dark:ring-zinc-300/20"/>
|
2023-01-14 19:31:05 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className="relative">
|
|
|
|
<Header/>
|
|
|
|
<main>
|
2023-02-17 22:26:49 +00:00
|
|
|
<Component {...pageProps} />
|
2023-01-14 19:31:05 +00:00
|
|
|
</main>
|
|
|
|
<Footer/>
|
|
|
|
</div>
|
2023-04-11 21:46:47 +00:00
|
|
|
</SessionContextProvider>
|
2023-01-14 19:31:05 +00:00
|
|
|
)
|
|
|
|
}
|