-
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 #77 from JimTheCat/CU-8692r5m3u_Add-cookie-notific…
…ation-and-logic-for-cookies_Patryk-Kosiski feature: Create cookie notification
- Loading branch information
Showing
4 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
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,43 @@ | ||
import {useEffect, useState} from 'react'; | ||
import {Button, Group, Modal, Text, UnstyledButton} from '@mantine/core'; | ||
|
||
export const CookiesPopup = () => { | ||
const [opened, setOpened] = useState<boolean>(false); | ||
|
||
useEffect(() => { | ||
const hasAcceptedCookies = localStorage.getItem('cookiesAccepted'); | ||
if (!hasAcceptedCookies && !window.location.pathname.includes('/privacy')) { | ||
setOpened(true); | ||
} | ||
}, []); | ||
|
||
const handleAccept = () => { | ||
localStorage.setItem('cookiesAccepted', 'true'); // Save to local storage | ||
setOpened(false); | ||
}; | ||
|
||
return ( | ||
<Modal | ||
opened={opened} | ||
onClose={() => setOpened(false)} | ||
title="Używamy ciasteczek 🍪" | ||
centered | ||
closeOnEscape={false} | ||
closeOnClickOutside={false} | ||
withCloseButton={false} | ||
size="md" | ||
> | ||
<Text> | ||
Nasza strona korzysta z ciasteczek w celu zapewnienia najlepszej jakości usług. Kontynuując | ||
przeglądanie, akceptujesz naszą <UnstyledButton c={'blue'} onClick={() => window.open("/privacy", '_blank')}>politykę | ||
prywatności</UnstyledButton>. | ||
</Text> | ||
|
||
<Group justify="flex-end" mt="md"> | ||
<Button onClick={handleAccept} color="blue"> | ||
Akceptuję | ||
</Button> | ||
</Group> | ||
</Modal> | ||
); | ||
} |
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 @@ | ||
export * from './CookiesPopup.tsx'; |
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