1
0
Fork 0
freesewing/sites/org/pages/_app.mjs
Joost De Cock e47c18177b wip(shared): Removed useApp hook in favor of contexts
This removes the useApp hook from all org pages in favor of various
context. This means there is no longer global state that gets passed
around, instead each component that requires access to something shared
(like account, or navigation) can just use the context instead.

This is a first step, as a lot of shared components stil rely on app not
to mention the dev and lab sites.
2023-04-28 21:23:06 +02:00

44 lines
1.3 KiB
JavaScript

import 'shared/styles/globals.css'
import { appWithTranslation } from 'next-i18next'
import React from 'react'
import Bugsnag from '@bugsnag/js'
import BugsnagPluginReact from '@bugsnag/plugin-react'
import { freeSewingConfig } from 'site/freesewing.config.mjs'
import { Toaster as DefaultToaster } from 'react-hot-toast'
import { ContextWrapper } from 'shared/components/wrappers/context.mjs'
Bugsnag.start({
apiKey: freeSewingConfig.bugsnag.key,
collectUserIp: false,
plugins: [new BugsnagPluginReact()],
})
const ErrorBoundary = Bugsnag.getPlugin('react').createErrorBoundary(React)
const FreeSewingOrg = ({ Component, pageProps }) => (
<ErrorBoundary>
<ContextWrapper>
<Component {...pageProps} />
<DefaultToaster
position="bottom-right"
toastOptions={{
className: 'bg-base-100 text-base-content',
success: {
className: 'bg-success text-success-content',
},
error: {
className: 'bg-error text-error-content',
},
loading: {
className: 'bg-warning text-warning-content',
},
custom: {
className: 'bg-accent text-accent-content',
},
}}
/>
</ContextWrapper>
</ErrorBoundary>
)
export default appWithTranslation(FreeSewingOrg)