2022-07-17 00:57:02 +00:00
|
|
|
import '../styles/globals.css'
|
|
|
|
import '@fortawesome/fontawesome-svg-core/styles.css'
|
2022-06-11 03:08:49 +00:00
|
|
|
import { AppProps } from 'next/app'
|
2022-06-04 03:13:19 +00:00
|
|
|
import { appWithTranslation, useTranslation } from 'next-i18next'
|
2022-07-16 18:01:19 +00:00
|
|
|
import { AxiosSWRFetcherProvider } from '../components/auth/requests'
|
2022-06-11 03:08:49 +00:00
|
|
|
import { useStatePostcard } from '../components/postcard/storage'
|
|
|
|
import { PageErrorBoundary } from '../components/generic/errors/boundaries'
|
|
|
|
import { PostcardContext } from '../components/postcard/base'
|
2022-07-17 00:57:02 +00:00
|
|
|
import { AuthContextProvider } from '../components/auth/base'
|
2022-06-11 03:08:49 +00:00
|
|
|
import { PostcardRenderer } from '../components/postcard/renderer'
|
2022-07-16 18:01:19 +00:00
|
|
|
import { config as fontAwesomeConfig } from '@fortawesome/fontawesome-svg-core'
|
2022-07-17 00:57:02 +00:00
|
|
|
import defaultPostcard from "../public/postcards/adi-goldstein-Hli3R6LKibo-unsplash.jpg"
|
2022-07-16 18:01:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
fontAwesomeConfig.autoAddCss = false
|
2022-05-27 00:46:30 +00:00
|
|
|
|
2022-05-20 11:59:24 +00:00
|
|
|
|
2022-05-25 14:20:22 +00:00
|
|
|
const App = ({ Component, pageProps }: AppProps): JSX.Element => {
|
2022-06-09 21:43:38 +00:00
|
|
|
const { t } = useTranslation()
|
2022-06-11 03:08:49 +00:00
|
|
|
const postcardState = useStatePostcard(defaultPostcard)
|
2022-05-31 15:07:25 +00:00
|
|
|
|
2022-06-11 03:08:49 +00:00
|
|
|
return (
|
|
|
|
<PageErrorBoundary text={t("genericError")}>
|
|
|
|
<AxiosSWRFetcherProvider>
|
|
|
|
<PostcardContext.Provider value={postcardState}>
|
2022-07-17 00:55:36 +00:00
|
|
|
<AuthContextProvider storageKey="auth">
|
2022-06-11 03:08:49 +00:00
|
|
|
<AxiosSWRFetcherProvider>
|
|
|
|
<PostcardRenderer />
|
|
|
|
<Component {...pageProps} />
|
|
|
|
</AxiosSWRFetcherProvider>
|
2022-07-17 00:55:36 +00:00
|
|
|
</AuthContextProvider>
|
2022-06-11 03:08:49 +00:00
|
|
|
</PostcardContext.Provider>
|
|
|
|
</AxiosSWRFetcherProvider>
|
|
|
|
</PageErrorBoundary>
|
|
|
|
)
|
2022-05-20 11:59:24 +00:00
|
|
|
}
|
|
|
|
|
2022-05-25 14:20:22 +00:00
|
|
|
export default appWithTranslation(App)
|