Add cookies popup (#690)

This commit is contained in:
Brandon Hopkins
2026-04-08 10:25:38 -07:00
committed by GitHub
parent a8b7150ec4
commit 55393f6396
4 changed files with 188 additions and 5 deletions

View File

@@ -15,6 +15,8 @@ import {dom} from "@fortawesome/fontawesome-svg-core";
import {AnnouncementBannerProvider} from "@/components/announcement-banner/AnnouncementBannerProvider";
import {ImageZoom} from "@/components/ImageZoom";
import {MatomoTagManager} from "@/components/Matomo";
import {CookieConsentProvider, useCookieConsent} from "@/components/cookie-consent/CookieConsentProvider";
import {CookieConsent} from "@/components/cookie-consent/CookieConsent";
function onRouteChange() {
useMobileNavigationStore.getState().close()
@@ -23,12 +25,14 @@ function onRouteChange() {
Router.events.on('routeChangeStart', onRouteChange)
Router.events.on('hashChangeStart', onRouteChange)
export default function App({ Component, pageProps }) {
function AppInner({ Component, pageProps }) {
let router = useRouter()
let tableOfContents = collectHeadings(pageProps.sections)
let tableOfContents = collectHeadings(pageProps.sections)
const { isAccepted } = useCookieConsent()
return (
<>
<MatomoTagManager />
<MatomoTagManager consentGiven={isAccepted} />
<Head>
<style>{dom.css()}</style>
{router.route.startsWith('/ipa') ?
@@ -45,10 +49,19 @@ export default function App({ Component, pageProps }) {
</AnnouncementBannerProvider>
<ToastContainer />
<ImageZoom />
<CookieConsent />
</>
)
}
export default function App(props) {
return (
<CookieConsentProvider>
<AppInner {...props} />
</CookieConsentProvider>
)
}
function collectHeadings(sections, slugify = slugifyWithCounter()) {
let output = []