-
Notifications
You must be signed in to change notification settings - Fork 2
/
gatsby-browser.js
46 lines (40 loc) · 1.42 KB
/
gatsby-browser.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/**
* Implement Gatsby's Browser APIs in this file.
*
* See: https://www.gatsbyjs.org/docs/browser-apis/
*/
// You can delete this file if you're not using it
import React from "react"
import 'semantic-ui-css/semantic.min.css'
import 'balloon-css/balloon.min.css'
import 'decentraland-ui/dist/themes/base-theme.css'
import 'decentraland-ui/dist/themes/alternative/light-theme.css'
import './src/theme.css'
// import Helmet from "react-helmet"
import AuthProvider from "decentraland-gatsby/dist/context/Auth/AuthProvider"
import FeatureFlagProvider from "decentraland-gatsby/dist/context/FeatureFlag/FeatureFlagProvider"
import Layout from "decentraland-gatsby/dist/components/Layout/Layout"
import UserMenu from "decentraland-gatsby/dist/components/User/UserMenu"
import segment from "decentraland-gatsby/dist/utils/segment/segment"
export const wrapRootElement = ({ element }) => (
<AuthProvider>
<FeatureFlagProvider endpoint="https://feature-flags.decentraland.org/dao.json">
{element}
</FeatureFlagProvider>
</AuthProvider>
)
export const wrapPageElement = ({ element, props }) => {
return <Layout
{...props}
rightMenu={<UserMenu />}
>
{element}
</Layout>
}
export const onClientEntry = () => {
segment((analytics) => analytics.page())
}
export const onRouteUpdate = () => {
window.routeUpdate = window.routeUpdate === undefined ? 0 : window.routeUpdate + 1
segment((analytics) => analytics.page())
}