2020-04-06 20:27:35 +00:00
import './style.css'
2021-07-26 14:26:50 +00:00
import '@hashicorp/platform-util/nprogress/style.css'
2020-05-19 18:32:38 +00:00
2021-10-14 04:33:38 +00:00
import useFathomAnalytics from '@hashicorp/platform-analytics'
2020-04-06 20:27:35 +00:00
import Router from 'next/router'
2020-05-19 18:32:38 +00:00
import Head from 'next/head'
2021-12-20 21:42:20 +00:00
import rivetQuery from '@hashicorp/nextjs-scripts/dato/client'
2021-07-26 14:26:50 +00:00
import NProgress from '@hashicorp/platform-util/nprogress'
import { ErrorBoundary } from '@hashicorp/platform-runtime-error-monitoring'
import createConsentManager from '@hashicorp/react-consent-manager/loader'
import useAnchorLinkAnalytics from '@hashicorp/platform-util/anchor-link-analytics'
2020-05-19 18:32:38 +00:00
import HashiHead from '@hashicorp/react-head'
2020-04-28 17:53:30 +00:00
import AlertBanner from '@hashicorp/react-alert-banner'
import alertBannerData , { ALERT _BANNER _ACTIVE } from '../data/alert-banner'
2020-04-06 20:27:35 +00:00
import Error from './_error'
2021-12-20 21:42:20 +00:00
import StandardLayout from 'layouts/standard'
2020-04-06 20:27:35 +00:00
2020-05-19 18:32:38 +00:00
NProgress ( { Router } )
2021-12-20 21:42:20 +00:00
const { ConsentManager } = createConsentManager ( {
2020-05-19 18:32:38 +00:00
preset : 'oss' ,
2020-04-06 20:27:35 +00:00
} )
2021-12-20 21:42:20 +00:00
export default function App ( { Component , pageProps , layoutData } ) {
2021-10-14 04:33:38 +00:00
useFathomAnalytics ( )
2020-05-19 18:32:38 +00:00
useAnchorLinkAnalytics ( )
2021-10-14 04:33:38 +00:00
2021-12-20 21:42:20 +00:00
const Layout = Component . layout ? ? StandardLayout
2020-05-19 18:32:38 +00:00
return (
< ErrorBoundary FallbackComponent = { Error } >
< HashiHead
is = { Head }
title = "Consul by HashiCorp"
siteName = "Consul by HashiCorp"
description = "Consul is a service networking solution to automate network configurations, discover services, and enable secure connectivity across any cloud or runtime."
2021-10-26 18:29:18 +00:00
image = "https://www.consul.io/img/og-image.png"
2020-05-19 18:32:38 +00:00
icon = { [ { href : '/favicon.ico' } ] }
>
< meta
name = "og:title"
property = "og:title"
content = "Consul by HashiCorp"
/ >
< / H a s h i H e a d >
{ ALERT _BANNER _ACTIVE && (
2021-08-20 16:20:01 +00:00
< AlertBanner { ... alertBannerData } product = "consul" hideOnMobile / >
2020-05-19 18:32:38 +00:00
) }
2021-12-20 21:42:20 +00:00
< Layout { ... ( layoutData && { data : layoutData } ) } >
< div className = "content" >
< Component { ... pageProps } / >
< / d i v >
< / L a y o u t >
2020-05-19 18:32:38 +00:00
< ConsentManager / >
< / E r r o r B o u n d a r y >
)
}
2021-12-20 21:42:20 +00:00
App . getInitialProps = async ( { Component , ctx } ) => {
const layoutQuery = Component . layout
? Component . layout ? . rivetParams ? ? null
: StandardLayout . rivetParams
const layoutData = layoutQuery ? await rivetQuery ( layoutQuery ) : null
let pageProps = { }
if ( Component . getInitialProps ) {
pageProps = await Component . getInitialProps ( ctx )
}
return { pageProps , layoutData }
}