Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import DosageCalculator from './pages/DosageCalculator';
import HealthMetrics from './pages/HealthMetrics';
import Footer from './components/Footer';
import NotFound from './pages/NotFound';
import CookieConsent from './components/CookieConsent';


// Navigation targets. Labels are resolved at render time via i18n keys
Expand Down Expand Up @@ -354,6 +355,7 @@ function App() {
</div>
<ScrollToTopButton />
<Footer />
<CookieConsent />
</AuthProvider>
);
}
Expand Down
48 changes: 48 additions & 0 deletions src/components/CookieConsent.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import React, { useState, useEffect } from 'react';
import { Box, Typography, Button, Slide } from '@mui/material';

export default function CookieConsent() {
const [open, setOpen] = useState(false);

useEffect(() => {
const consent = localStorage.getItem('gdpr_consent');
if (!consent) {
setOpen(true);
}
}, []);

const handleAccept = () => {
localStorage.setItem('gdpr_consent', 'true');
setOpen(false);
};

return (
<Slide direction="up" in={open} mountOnEnter unmountOnExit>
<Box
sx={{
position: 'fixed',
bottom: 0,
left: 0,
right: 0,
bgcolor: 'background.paper',
p: 3,
boxShadow: 4,
display: 'flex',
flexDirection: { xs: 'column', md: 'row' },
alignItems: 'center',
justifyContent: 'space-between',
zIndex: 1300,
borderTop: '1px solid',
borderColor: 'divider',
}}
>
<Typography variant="body1" sx={{ mb: { xs: 2, md: 0 }, mr: { md: 3 } }}>
<strong>GDPR Notice:</strong> We use cookies and similar technologies to enhance your experience, monitor our performance, and improve our services. By clicking "Accept", you agree to our use of cookies and data processing per GDPR regulations.
</Typography>
<Button variant="contained" color="primary" onClick={handleAccept} sx={{ minWidth: 150 }}>
Accept
</Button>
</Box>
</Slide>
);
}
5 changes: 4 additions & 1 deletion src/pages/Profile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,12 @@ function Profile() {
<Typography variant="body2" color="text.secondary">
{t('profile:memberSince', { date: user.loggedInAt ? new Date(user.loggedInAt).toLocaleDateString() : t('profile:notAvailable') })}
</Typography>
<Button variant="outlined" color="error" onClick={logout}>
<Button variant="outlined" color="error" onClick={logout} sx={{ mr: 2 }}>
{t('profile:logOut')}
</Button>
<Button variant="contained" color="error" onClick={() => { if(window.confirm('Are you sure you want to delete your account permanently? This action cannot be undone.')) { logout(); } }}>
Delete Account
</Button>
</Box>
</CardContent>
</Card>
Expand Down
Loading