67 lines
1.9 KiB
JavaScript
Raw Normal View History

2021-04-13 19:57:32 -05:00
import '../styles/globals.scss'
2021-10-26 15:49:37 -05:00
import { ApolloProvider, gql } from '@apollo/client'
2021-04-12 13:05:09 -05:00
import { Provider } from 'next-auth/client'
2021-05-20 16:32:59 -05:00
import { FundErrorModal, FundErrorProvider } from '../components/fund-error'
2021-11-09 11:38:58 -06:00
import { MeProvider } from '../components/me'
2021-07-15 15:49:13 -05:00
import PlausibleProvider from 'next-plausible'
import { LightningProvider } from '../components/lightning'
2021-09-10 13:55:36 -05:00
import { ItemActModal, ItemActProvider } from '../components/item-act'
2021-09-30 10:46:58 -05:00
import getApolloClient from '../lib/apollo'
2021-11-13 07:28:08 -06:00
import NextNProgress from 'nextjs-progressbar'
2021-11-28 11:29:17 -06:00
import { PriceProvider } from '../components/price'
2021-03-22 15:36:10 -05:00
2021-09-30 10:46:58 -05:00
function MyApp ({ Component, pageProps: { session, ...props } }) {
2021-10-26 15:49:37 -05:00
const client = getApolloClient()
2021-11-09 16:43:56 -06:00
2021-10-26 15:49:37 -05:00
/*
If we are on the client, we populate the apollo cache with the
ssr data
*/
if (typeof window !== 'undefined') {
const { apollo, data } = props
if (apollo) {
client.writeQuery({
query: gql`${apollo.query}`,
data: data,
variables: apollo.variables
})
}
}
2021-11-28 11:29:17 -06:00
const { me, price } = props
2021-04-12 13:05:09 -05:00
return (
2021-11-13 07:28:08 -06:00
<>
<NextNProgress
color='var(--primary)'
startPosition={0.3}
stopDelayMs={200}
height={2}
showOnShallow
options={{ showSpinner: false }}
/>
<PlausibleProvider domain='stacker.news' trackOutboundLinks>
<Provider session={session}>
<ApolloProvider client={client}>
2021-11-28 11:29:17 -06:00
<MeProvider me={me}>
<PriceProvider price={price}>
<LightningProvider>
<FundErrorProvider>
<FundErrorModal />
<ItemActProvider>
<ItemActModal />
<Component {...props} />
</ItemActProvider>
</FundErrorProvider>
</LightningProvider>
</PriceProvider>
2021-11-13 07:28:08 -06:00
</MeProvider>
</ApolloProvider>
</Provider>
</PlausibleProvider>
</>
2021-04-12 13:05:09 -05:00
)
2021-03-22 15:36:10 -05:00
}
export default MyApp