stacker.news/pages/_app.js

51 lines
1.5 KiB
JavaScript
Raw Normal View History

2021-04-14 00:57:32 +00:00
import '../styles/globals.scss'
2021-10-26 20:49:37 +00:00
import { ApolloProvider, gql } from '@apollo/client'
2021-04-12 18:05:09 +00:00
import { Provider } from 'next-auth/client'
2021-05-20 21:32:59 +00:00
import { FundErrorModal, FundErrorProvider } from '../components/fund-error'
2021-11-09 17:38:58 +00:00
import { MeProvider } from '../components/me'
2021-07-15 20:49:13 +00:00
import PlausibleProvider from 'next-plausible'
import { LightningProvider } from '../components/lightning'
2021-09-10 18:55:36 +00:00
import { ItemActModal, ItemActProvider } from '../components/item-act'
2021-09-30 15:46:58 +00:00
import getApolloClient from '../lib/apollo'
2021-03-22 20:36:10 +00:00
2021-09-30 15:46:58 +00:00
function MyApp ({ Component, pageProps: { session, ...props } }) {
2021-10-26 20:49:37 +00:00
const client = getApolloClient()
2021-11-09 22:43:56 +00:00
2021-10-26 20:49:37 +00: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-04-12 18:05:09 +00:00
return (
2021-07-15 20:49:13 +00:00
<PlausibleProvider domain='stacker.news' trackOutboundLinks>
2021-11-04 23:07:41 +00:00
<Provider session={session}>
<ApolloProvider client={client}>
<MeProvider>
2021-11-09 22:43:56 +00:00
<LightningProvider>
<FundErrorProvider>
<FundErrorModal />
<ItemActProvider>
<ItemActModal />
<Component {...props} />
</ItemActProvider>
</FundErrorProvider>
</LightningProvider>
2021-11-04 23:07:41 +00:00
</MeProvider>
</ApolloProvider>
</Provider>
2021-07-15 20:49:13 +00:00
</PlausibleProvider>
2021-04-12 18:05:09 +00:00
)
2021-03-22 20:36:10 +00:00
}
export default MyApp