From 79362162d248712c1010e6413b44c6ce6204f592 Mon Sep 17 00:00:00 2001 From: Mo Tarbin Date: Mon, 23 Jun 2025 01:55:32 -0400 Subject: [PATCH] refactor CookiePermissionSnackbar to use Snackbar directly and remove notification provider --- .../Landing/CookiePermissionSnackbar.jsx | 43 +++++++++---------- 1 file changed, 20 insertions(+), 23 deletions(-) diff --git a/src/views/Landing/CookiePermissionSnackbar.jsx b/src/views/Landing/CookiePermissionSnackbar.jsx index f72b922..7fe3724 100644 --- a/src/views/Landing/CookiePermissionSnackbar.jsx +++ b/src/views/Landing/CookiePermissionSnackbar.jsx @@ -1,42 +1,39 @@ -import { Button } from '@mui/joy' +import { Button, Snackbar } from '@mui/joy' import Cookies from 'js-cookie' -import { useEffect } from 'react' -import { useNotification } from '../../service/NotificationProvider' +import { useEffect, useState } from 'react' const CookiePermissionSnackbar = () => { - const { showNotification } = useNotification() - useEffect(() => { const cookiePermission = Cookies.get('cookies_permission') if (cookiePermission !== 'true') { - showNotification({ - type: 'custom', - component: , - snackbarProps: { - autoHideDuration: null, - }, - anchorOrigin: { vertical: 'bottom', horizontal: 'center' }, - }) + setOpen(true) } - }, [showNotification]) + }, []) - return null -} - -const CookieAcceptComponent = ({ onClose }) => { - const handleAccept = () => { + const [open, setOpen] = useState(false) + const handleClose = () => { Cookies.set('cookies_permission', 'true') - onClose?.() + setOpen(false) } return ( -
+ { + if (reason === 'clickaway') { + return + } + // Cookies.set('cookies_permission', 'true') + handleClose() + }} + > We use cookies to ensure you get the best experience on our website. - -
+ ) }