-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from game-node-app/dev
Dev
- Loading branch information
Showing
21 changed files
with
508 additions
and
131 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import React, { useCallback, useEffect } from "react"; | ||
import { init } from "@socialgouv/matomo-next"; | ||
import { useLocalStorage, useSessionStorage } from "@mantine/hooks"; | ||
import { notifications } from "@mantine/notifications"; | ||
import { Button, Flex, Group, Stack, Text } from "@mantine/core"; | ||
import Link from "next/link"; | ||
|
||
const MATOMO_URL = process.env.NEXT_PUBLIC_MATOMO_URL; | ||
const MATOMO_SITE_ID = process.env.NEXT_PUBLIC_MATOMO_SITE_ID; | ||
|
||
const MatomoTracker = () => { | ||
const [hasAcceptedCookies, setHasAcceptedCookies] = | ||
useLocalStorage<boolean>({ | ||
key: "cookie-consent", | ||
defaultValue: false, | ||
getInitialValueInEffect: false, | ||
}); | ||
|
||
console.log(hasAcceptedCookies); | ||
|
||
const showCookieConsentNotification = useCallback(() => { | ||
if (hasAcceptedCookies != undefined && hasAcceptedCookies) return; | ||
notifications.show({ | ||
id: "cookie-notice", | ||
title: "Notice", | ||
withCloseButton: false, | ||
autoClose: false, | ||
withBorder: true, | ||
message: ( | ||
<Stack className={"w-full items-start"}> | ||
<Text> | ||
We use cookies and similar storage methods to keep track | ||
of your session and how you are using our website. We do | ||
not use third-party cookies. | ||
</Text> | ||
<Flex className={"w-full justify-end"}> | ||
<Group> | ||
<Link href={"/privacy"} className={"w-fit"}> | ||
<Button color={"indigo"}>Learn more</Button> | ||
</Link> | ||
<Button | ||
onClick={() => { | ||
setHasAcceptedCookies(true); | ||
notifications.hide("cookie-notice"); | ||
}} | ||
> | ||
I understand | ||
</Button> | ||
</Group> | ||
</Flex> | ||
</Stack> | ||
), | ||
}); | ||
}, [hasAcceptedCookies, setHasAcceptedCookies]); | ||
useEffect(() => { | ||
if (!hasAcceptedCookies) { | ||
showCookieConsentNotification(); | ||
} else if (MATOMO_URL && MATOMO_SITE_ID) { | ||
init({ | ||
url: MATOMO_URL, | ||
siteId: MATOMO_SITE_ID, | ||
}); | ||
} | ||
}, [hasAcceptedCookies, showCookieConsentNotification]); | ||
|
||
useEffect(() => {}, []); | ||
return <></>; | ||
}; | ||
|
||
export default MatomoTracker; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,7 +128,6 @@ const SearchBarWithSelect = ({ | |
)} | ||
</Group> | ||
} | ||
mr={"0.5rem"} | ||
/> | ||
</Combobox.Target> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.