Spaces:
Running
Running
Commit ·
874b177
1
Parent(s): 96f06ee
fix
Browse files- src/components/Sidebar.jsx +37 -14
- src/context/AchievementNotificationContext.jsx +13 -0
- src/pages/ProfilePage.jsx +103 -38
- src/pages/SettingsPage.jsx +35 -4
src/components/Sidebar.jsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
-
import React from 'react';
|
|
|
|
| 2 |
import { motion } from 'framer-motion';
|
| 3 |
import { useNavigate, useLocation } from 'react-router-dom';
|
| 4 |
import { useAuth } from '../context/AuthContext';
|
|
@@ -39,8 +40,28 @@ const SidebarItem = ({ icon: Icon, label, active, onClick, badge }) => (
|
|
| 39 |
const Sidebar = () => {
|
| 40 |
const navigate = useNavigate();
|
| 41 |
const location = useLocation();
|
| 42 |
-
const { logout } = useAuth();
|
| 43 |
const { t } = useTranslation();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
const handleLogout = () => {
|
| 46 |
logout();
|
|
@@ -75,24 +96,26 @@ const Sidebar = () => {
|
|
| 75 |
label={t(`sidebar.${item.labelKey}`)}
|
| 76 |
active={location.pathname === item.path}
|
| 77 |
onClick={() => navigate(item.path)}
|
| 78 |
-
badge={item.labelKey === 'projects' ?
|
| 79 |
/>
|
| 80 |
))}
|
| 81 |
</nav>
|
| 82 |
|
| 83 |
<div className="flex flex-col gap-4">
|
| 84 |
-
|
| 85 |
-
<div className="flex
|
| 86 |
-
<
|
| 87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
</div>
|
| 89 |
-
|
| 90 |
-
onClick={() => navigate('/subscription')}
|
| 91 |
-
className="w-full py-2 bg-primary text-on-primary text-sm font-bold rounded-lg hover:bg-secondary hover:text-primary transition-all"
|
| 92 |
-
>
|
| 93 |
-
{t('sidebar.upgrade_now')}
|
| 94 |
-
</button>
|
| 95 |
-
</div>
|
| 96 |
|
| 97 |
<button
|
| 98 |
onClick={handleLogout}
|
|
|
|
| 1 |
+
import React, { useState, useEffect } from 'react';
|
| 2 |
+
import axios from 'axios';
|
| 3 |
import { motion } from 'framer-motion';
|
| 4 |
import { useNavigate, useLocation } from 'react-router-dom';
|
| 5 |
import { useAuth } from '../context/AuthContext';
|
|
|
|
| 40 |
const Sidebar = () => {
|
| 41 |
const navigate = useNavigate();
|
| 42 |
const location = useLocation();
|
| 43 |
+
const { logout, user } = useAuth();
|
| 44 |
const { t } = useTranslation();
|
| 45 |
+
const [projectCount, setProjectCount] = useState(0);
|
| 46 |
+
|
| 47 |
+
useEffect(() => {
|
| 48 |
+
if (!user) return;
|
| 49 |
+
const fetchProjectCount = async () => {
|
| 50 |
+
try {
|
| 51 |
+
const API_URL = import.meta.env.VITE_API_URL;
|
| 52 |
+
const res = await axios.get(`${API_URL}/graphs/user/${user.id}`);
|
| 53 |
+
if (Array.isArray(res.data)) {
|
| 54 |
+
setProjectCount(res.data.length);
|
| 55 |
+
}
|
| 56 |
+
} catch (err) {
|
| 57 |
+
console.error('[Sidebar] Failed to fetch project count:', err);
|
| 58 |
+
}
|
| 59 |
+
};
|
| 60 |
+
|
| 61 |
+
fetchProjectCount();
|
| 62 |
+
const interval = setInterval(fetchProjectCount, 10000);
|
| 63 |
+
return () => clearInterval(interval);
|
| 64 |
+
}, [user]);
|
| 65 |
|
| 66 |
const handleLogout = () => {
|
| 67 |
logout();
|
|
|
|
| 96 |
label={t(`sidebar.${item.labelKey}`)}
|
| 97 |
active={location.pathname === item.path}
|
| 98 |
onClick={() => navigate(item.path)}
|
| 99 |
+
badge={item.labelKey === 'projects' ? projectCount.toString() : null}
|
| 100 |
/>
|
| 101 |
))}
|
| 102 |
</nav>
|
| 103 |
|
| 104 |
<div className="flex flex-col gap-4">
|
| 105 |
+
{false && (
|
| 106 |
+
<div className="p-4 bg-secondary/5 rough-border border-dashed border-secondary/30 flex flex-col gap-4">
|
| 107 |
+
<div className="flex items-center justify-between">
|
| 108 |
+
<span className="font-accent-note text-2xl text-secondary">{t('sidebar.free_plan')}</span>
|
| 109 |
+
<span className="text-xs font-bold text-primary">3/5 Slots</span>
|
| 110 |
+
</div>
|
| 111 |
+
<button
|
| 112 |
+
onClick={() => navigate('/subscription')}
|
| 113 |
+
className="w-full py-2 bg-primary text-on-primary text-sm font-bold rounded-lg hover:bg-secondary hover:text-primary transition-all"
|
| 114 |
+
>
|
| 115 |
+
{t('sidebar.upgrade_now')}
|
| 116 |
+
</button>
|
| 117 |
</div>
|
| 118 |
+
)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
|
| 120 |
<button
|
| 121 |
onClick={handleLogout}
|
src/context/AchievementNotificationContext.jsx
CHANGED
|
@@ -137,6 +137,19 @@ export const AchievementNotificationProvider = ({ children }) => {
|
|
| 137 |
const triggerNotification = (achievement) => {
|
| 138 |
playUnlockSound();
|
| 139 |
setActiveNotification(achievement);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
// Auto-clear after 6 seconds
|
| 141 |
setTimeout(() => {
|
| 142 |
setActiveNotification(null);
|
|
|
|
| 137 |
const triggerNotification = (achievement) => {
|
| 138 |
playUnlockSound();
|
| 139 |
setActiveNotification(achievement);
|
| 140 |
+
|
| 141 |
+
const desktopNotifEnabled = localStorage.getItem('desktop_notifications') === 'true';
|
| 142 |
+
if (desktopNotifEnabled && 'Notification' in window && Notification.permission === 'granted') {
|
| 143 |
+
try {
|
| 144 |
+
new Notification(`🏆 Achievement Unlocked: ${achievement.title}`, {
|
| 145 |
+
body: achievement.desc,
|
| 146 |
+
icon: '/favicon.ico'
|
| 147 |
+
});
|
| 148 |
+
} catch (e) {
|
| 149 |
+
console.warn('[Notifications] Failed to display native desktop notification:', e);
|
| 150 |
+
}
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
// Auto-clear after 6 seconds
|
| 154 |
setTimeout(() => {
|
| 155 |
setActiveNotification(null);
|
src/pages/ProfilePage.jsx
CHANGED
|
@@ -88,6 +88,53 @@ const ProfilePage = () => {
|
|
| 88 |
const [uploading, setUploading] = React.useState(false);
|
| 89 |
const [isAllAchievementsOpen, setIsAllAchievementsOpen] = React.useState(false);
|
| 90 |
const [activeFilter, setActiveFilter] = React.useState('all');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
|
| 92 |
React.useEffect(() => {
|
| 93 |
if (!user) {
|
|
@@ -246,20 +293,22 @@ const ProfilePage = () => {
|
|
| 246 |
</div>
|
| 247 |
|
| 248 |
<div className="flex gap-4">
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
|
|
|
|
|
|
| 263 |
<button
|
| 264 |
onClick={() => navigate('/settings')}
|
| 265 |
className="bg-surface-container-lowest p-4 rough-border rough-shadow-hover hover:text-primary transition-all text-primary"
|
|
@@ -330,46 +379,62 @@ const ProfilePage = () => {
|
|
| 330 |
<label className="text-xs font-bold uppercase tracking-widest text-on-surface-variant flex items-center gap-2">
|
| 331 |
<Mail size={14} /> {t('auth.email')}
|
| 332 |
</label>
|
| 333 |
-
<input
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 334 |
</div>
|
| 335 |
<div className="flex flex-col gap-2">
|
| 336 |
<label className="text-xs font-bold uppercase tracking-widest text-on-surface-variant flex items-center gap-2">
|
| 337 |
<Lock size={14} /> {t('auth.password')}
|
| 338 |
</label>
|
| 339 |
-
<input
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 340 |
</div>
|
| 341 |
-
<button
|
|
|
|
|
|
|
|
|
|
| 342 |
{t('profile.save_changes', 'Save Changes')}
|
| 343 |
</button>
|
| 344 |
</div>
|
| 345 |
</div>
|
| 346 |
|
| 347 |
-
|
| 348 |
-
<
|
| 349 |
-
|
| 350 |
-
<div className="flex
|
| 351 |
-
<div>
|
| 352 |
-
<div
|
| 353 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 354 |
</div>
|
| 355 |
-
<div className="
|
| 356 |
-
<div
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 357 |
</div>
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
<div>
|
| 361 |
-
<div className="font-bold">{t('profile.focus_mode', 'Focus Mode')}</div>
|
| 362 |
-
<div className="text-xs text-on-surface-variant">{t('profile.focus_mode_desc', 'Hide statistics during deep work sessions')}</div>
|
| 363 |
-
</div>
|
| 364 |
-
<div className="w-14 h-8 bg-surface-variant rough-border p-1 flex justify-start items-center grayscale">
|
| 365 |
-
<div className="w-6 h-6 bg-on-surface-variant rounded-sm" />
|
| 366 |
</div>
|
| 367 |
</div>
|
| 368 |
-
<div className="mt-auto font-accent-note text-2xl text-secondary text-center transform -rotate-1">
|
| 369 |
-
"{t('profile.privacy_quote', "Your data is stored locally first. You're in control.")}"
|
| 370 |
-
</div>
|
| 371 |
</div>
|
| 372 |
-
|
| 373 |
</div>
|
| 374 |
|
| 375 |
</div>
|
|
|
|
| 88 |
const [uploading, setUploading] = React.useState(false);
|
| 89 |
const [isAllAchievementsOpen, setIsAllAchievementsOpen] = React.useState(false);
|
| 90 |
const [activeFilter, setActiveFilter] = React.useState('all');
|
| 91 |
+
const [password, setPassword] = React.useState('');
|
| 92 |
+
|
| 93 |
+
const handleSaveChanges = async () => {
|
| 94 |
+
if (!user) return;
|
| 95 |
+
try {
|
| 96 |
+
const payload = {};
|
| 97 |
+
if (password && password.trim() !== '') {
|
| 98 |
+
payload.password = password;
|
| 99 |
+
} else {
|
| 100 |
+
triggerNotification({
|
| 101 |
+
id: 'account-update-info-' + Date.now(),
|
| 102 |
+
title: t('profile.no_changes', 'No Changes'),
|
| 103 |
+
desc: t('profile.no_changes_desc', 'No changes were made to your account details.'),
|
| 104 |
+
icon: 'ShieldCheck',
|
| 105 |
+
color: 'bg-blue-500/20',
|
| 106 |
+
unlocked: true
|
| 107 |
+
});
|
| 108 |
+
return;
|
| 109 |
+
}
|
| 110 |
+
|
| 111 |
+
const API_URL = import.meta.env.VITE_API_URL;
|
| 112 |
+
const res = await axios.put(`${API_URL}/users/${user.id}`, payload);
|
| 113 |
+
|
| 114 |
+
if (res.data) {
|
| 115 |
+
updateUser(res.data);
|
| 116 |
+
setPassword('');
|
| 117 |
+
triggerNotification({
|
| 118 |
+
id: 'account-update-success-' + Date.now(),
|
| 119 |
+
title: t('profile.changes_saved', 'Changes Saved!'),
|
| 120 |
+
desc: t('profile.changes_saved_desc', 'Your account details have been successfully updated.'),
|
| 121 |
+
icon: 'ShieldCheck',
|
| 122 |
+
color: 'bg-green-500/20',
|
| 123 |
+
unlocked: true
|
| 124 |
+
});
|
| 125 |
+
}
|
| 126 |
+
} catch (err) {
|
| 127 |
+
console.error('[ProfilePage] Failed to save changes:', err);
|
| 128 |
+
triggerNotification({
|
| 129 |
+
id: 'account-update-error-' + Date.now(),
|
| 130 |
+
title: t('profile.update_failed', 'Update Failed'),
|
| 131 |
+
desc: err.response?.data?.message || err.message,
|
| 132 |
+
icon: 'X',
|
| 133 |
+
color: 'bg-red-500/20',
|
| 134 |
+
unlocked: true
|
| 135 |
+
});
|
| 136 |
+
}
|
| 137 |
+
};
|
| 138 |
|
| 139 |
React.useEffect(() => {
|
| 140 |
if (!user) {
|
|
|
|
| 293 |
</div>
|
| 294 |
|
| 295 |
<div className="flex gap-4">
|
| 296 |
+
{false && (
|
| 297 |
+
<button
|
| 298 |
+
onClick={() => triggerNotification({
|
| 299 |
+
id: 'test-achievement-' + Date.now(),
|
| 300 |
+
title: 'Sketch Master',
|
| 301 |
+
desc: 'Create 100 task nodes overall.',
|
| 302 |
+
icon: 'Zap',
|
| 303 |
+
color: 'bg-yellow-500/20',
|
| 304 |
+
unlocked: true
|
| 305 |
+
})}
|
| 306 |
+
className="bg-surface-container-lowest p-4 rough-border rough-shadow-hover hover:text-primary transition-all text-secondary"
|
| 307 |
+
title="Test Achievement Unlock Animation"
|
| 308 |
+
>
|
| 309 |
+
<Trophy size={28} />
|
| 310 |
+
</button>
|
| 311 |
+
)}
|
| 312 |
<button
|
| 313 |
onClick={() => navigate('/settings')}
|
| 314 |
className="bg-surface-container-lowest p-4 rough-border rough-shadow-hover hover:text-primary transition-all text-primary"
|
|
|
|
| 379 |
<label className="text-xs font-bold uppercase tracking-widest text-on-surface-variant flex items-center gap-2">
|
| 380 |
<Mail size={14} /> {t('auth.email')}
|
| 381 |
</label>
|
| 382 |
+
<input
|
| 383 |
+
type="email"
|
| 384 |
+
defaultValue={user?.email}
|
| 385 |
+
disabled
|
| 386 |
+
className="w-full p-3 bg-surface-container-low border-2 border-primary/10 rounded-lg outline-none transition-all cursor-not-allowed opacity-60"
|
| 387 |
+
/>
|
| 388 |
</div>
|
| 389 |
<div className="flex flex-col gap-2">
|
| 390 |
<label className="text-xs font-bold uppercase tracking-widest text-on-surface-variant flex items-center gap-2">
|
| 391 |
<Lock size={14} /> {t('auth.password')}
|
| 392 |
</label>
|
| 393 |
+
<input
|
| 394 |
+
type="password"
|
| 395 |
+
value={password}
|
| 396 |
+
onChange={(e) => setPassword(e.target.value)}
|
| 397 |
+
placeholder="••••••••"
|
| 398 |
+
className="w-full p-3 bg-surface-container-low border-2 border-primary/10 rounded-lg focus:border-primary outline-none transition-all"
|
| 399 |
+
/>
|
| 400 |
</div>
|
| 401 |
+
<button
|
| 402 |
+
onClick={handleSaveChanges}
|
| 403 |
+
className="bg-primary text-on-primary py-3 px-6 font-bold rough-border rough-shadow-hover transition-all mt-2"
|
| 404 |
+
>
|
| 405 |
{t('profile.save_changes', 'Save Changes')}
|
| 406 |
</button>
|
| 407 |
</div>
|
| 408 |
</div>
|
| 409 |
|
| 410 |
+
{false && (
|
| 411 |
+
<div className="flex flex-col gap-6">
|
| 412 |
+
<h3 className="text-4xl font-display-lg text-primary">{t('profile.privacy_display', 'Privacy & Display')}</h3>
|
| 413 |
+
<div className="bg-surface-container-lowest p-8 rough-border flex flex-col gap-8">
|
| 414 |
+
<div className="flex items-center justify-between">
|
| 415 |
+
<div>
|
| 416 |
+
<div className="font-bold">{t('profile.public_profile', 'Public Profile')}</div>
|
| 417 |
+
<div className="text-xs text-on-surface-variant">{t('profile.public_profile_desc', 'Allow others to see your achievements')}</div>
|
| 418 |
+
</div>
|
| 419 |
+
<div className="w-14 h-8 bg-secondary rough-border p-1 flex justify-end items-center">
|
| 420 |
+
<div className="w-6 h-6 bg-primary rounded-sm" />
|
| 421 |
+
</div>
|
| 422 |
</div>
|
| 423 |
+
<div className="flex items-center justify-between opacity-50">
|
| 424 |
+
<div>
|
| 425 |
+
<div className="font-bold">{t('profile.focus_mode', 'Focus Mode')}</div>
|
| 426 |
+
<div className="text-xs text-on-surface-variant">{t('profile.focus_mode_desc', 'Hide statistics during deep work sessions')}</div>
|
| 427 |
+
</div>
|
| 428 |
+
<div className="w-14 h-8 bg-surface-variant rough-border p-1 flex justify-start items-center grayscale">
|
| 429 |
+
<div className="w-6 h-6 bg-on-surface-variant rounded-sm" />
|
| 430 |
+
</div>
|
| 431 |
</div>
|
| 432 |
+
<div className="mt-auto font-accent-note text-2xl text-secondary text-center transform -rotate-1">
|
| 433 |
+
"{t('profile.privacy_quote', "Your data is stored locally first. You're in control.")}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 434 |
</div>
|
| 435 |
</div>
|
|
|
|
|
|
|
|
|
|
| 436 |
</div>
|
| 437 |
+
)}
|
| 438 |
</div>
|
| 439 |
|
| 440 |
</div>
|
src/pages/SettingsPage.jsx
CHANGED
|
@@ -40,7 +40,7 @@ const SettingsPage = () => {
|
|
| 40 |
const { t, i18n } = useTranslation();
|
| 41 |
const [activeTab, setActiveTab] = useState('General');
|
| 42 |
const [settings, setSettings] = useState({
|
| 43 |
-
notifications: true,
|
| 44 |
aiGuidance: true,
|
| 45 |
snapToGrid: false,
|
| 46 |
publicProfile: true,
|
|
@@ -48,12 +48,43 @@ const SettingsPage = () => {
|
|
| 48 |
|
| 49 |
const tabs = [
|
| 50 |
{ id: 'General', labelKey: 'general', icon: Monitor },
|
| 51 |
-
{ id: 'Canvas', labelKey: 'canvas', icon: Database },
|
| 52 |
-
{ id: 'Privacy', labelKey: 'security', icon: Lock },
|
| 53 |
];
|
| 54 |
|
| 55 |
const toggleSetting = (key) => setSettings(prev => ({ ...prev, [key]: !prev[key] }));
|
| 56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
return (
|
| 58 |
<div className="flex min-h-screen bg-background">
|
| 59 |
<Sidebar />
|
|
@@ -137,7 +168,7 @@ const SettingsPage = () => {
|
|
| 137 |
label={t('settings.notifications_title', 'Desktop Notifications')}
|
| 138 |
desc={t('settings.notifications_desc', 'Receive alerts for task deadlines and habit reminders.')}
|
| 139 |
active={settings.notifications}
|
| 140 |
-
onToggle={
|
| 141 |
/>
|
| 142 |
|
| 143 |
<div className="flex items-center justify-between py-6 border-b border-primary/5">
|
|
|
|
| 40 |
const { t, i18n } = useTranslation();
|
| 41 |
const [activeTab, setActiveTab] = useState('General');
|
| 42 |
const [settings, setSettings] = useState({
|
| 43 |
+
notifications: localStorage.getItem('desktop_notifications') === 'true',
|
| 44 |
aiGuidance: true,
|
| 45 |
snapToGrid: false,
|
| 46 |
publicProfile: true,
|
|
|
|
| 48 |
|
| 49 |
const tabs = [
|
| 50 |
{ id: 'General', labelKey: 'general', icon: Monitor },
|
| 51 |
+
// { id: 'Canvas', labelKey: 'canvas', icon: Database },
|
| 52 |
+
// { id: 'Privacy', labelKey: 'security', icon: Lock },
|
| 53 |
];
|
| 54 |
|
| 55 |
const toggleSetting = (key) => setSettings(prev => ({ ...prev, [key]: !prev[key] }));
|
| 56 |
|
| 57 |
+
const toggleNotifications = async () => {
|
| 58 |
+
const nextVal = !settings.notifications;
|
| 59 |
+
|
| 60 |
+
if (nextVal) {
|
| 61 |
+
if ('Notification' in window) {
|
| 62 |
+
const permission = await Notification.requestPermission();
|
| 63 |
+
if (permission === 'granted') {
|
| 64 |
+
localStorage.setItem('desktop_notifications', 'true');
|
| 65 |
+
setSettings(prev => ({ ...prev, notifications: true }));
|
| 66 |
+
try {
|
| 67 |
+
new Notification(t('notifications.enabled_title', 'Desktop Notifications Enabled'), {
|
| 68 |
+
body: t('notifications.enabled_body', 'You will now receive alerts for task deadlines and habits!'),
|
| 69 |
+
icon: '/favicon.ico'
|
| 70 |
+
});
|
| 71 |
+
} catch (e) {
|
| 72 |
+
console.warn('[Notifications] Failed to display test notification:', e);
|
| 73 |
+
}
|
| 74 |
+
} else {
|
| 75 |
+
localStorage.setItem('desktop_notifications', 'false');
|
| 76 |
+
setSettings(prev => ({ ...prev, notifications: false }));
|
| 77 |
+
alert(t('notifications.permission_denied', 'Notification permission denied. Please enable them in your browser settings.'));
|
| 78 |
+
}
|
| 79 |
+
} else {
|
| 80 |
+
alert(t('notifications.unsupported', 'Desktop Notifications are not supported in this browser.'));
|
| 81 |
+
}
|
| 82 |
+
} else {
|
| 83 |
+
localStorage.setItem('desktop_notifications', 'false');
|
| 84 |
+
setSettings(prev => ({ ...prev, notifications: false }));
|
| 85 |
+
}
|
| 86 |
+
};
|
| 87 |
+
|
| 88 |
return (
|
| 89 |
<div className="flex min-h-screen bg-background">
|
| 90 |
<Sidebar />
|
|
|
|
| 168 |
label={t('settings.notifications_title', 'Desktop Notifications')}
|
| 169 |
desc={t('settings.notifications_desc', 'Receive alerts for task deadlines and habit reminders.')}
|
| 170 |
active={settings.notifications}
|
| 171 |
+
onToggle={toggleNotifications}
|
| 172 |
/>
|
| 173 |
|
| 174 |
<div className="flex items-center justify-between py-6 border-b border-primary/5">
|