Skip to content

Commit 1511e18

Browse files
authored
Merge branch 'main' into fix/light-dark-theme-toggle
2 parents b78135b + 2b02835 commit 1511e18

13 files changed

Lines changed: 981 additions & 287 deletions

File tree

frontend/src/app/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ThemeProvider } from 'next-themes';
44
import './globals.css';
55
import { performanceMonitor } from '@/lib/performance-monitor';
66
import { GlobalShell } from '@/components/PWA/GlobalShell';
7-
import { ToastProvider } from '@/components/ui/toast';
7+
import { CommandPalette } from '@/components/ui/command-palette';
88

99
const inter = Inter({ subsets: ['latin'] });
1010

frontend/src/app/settings/notifications/page.tsx

Lines changed: 62 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
11
'use client';
22

3-
import React from 'react';
3+
import React, { useState, useEffect } from 'react';
44
import PreferencesPanel from '@/components/Notifications/PreferencesPanel';
55
import { useNotifications } from '@/hooks/useNotifications';
6-
import { useToast } from '@/hooks/useToast';
7-
import { Bell, Shield, Info } from 'lucide-react';
6+
import { Bell, Shield, Info, Keyboard } from 'lucide-react';
7+
import { getShortcuts, getEnabledKeys, setEnabledKeys, type Shortcut } from '@/lib/shortcutRegistry';
88

99
export default function NotificationSettingsPage() {
10-
// Using a hardcoded userId for demo purposes.
11-
// In a real app, this would come from an auth context.
12-
const {
13-
preferences,
14-
updatePreferences,
15-
isLoading,
16-
subscribeToPushNotifications,
17-
} = useNotifications('user-123');
18-
const toast = useToast();
10+
// Using a hardcoded userId for demo purposes.
11+
// In a real app, this would come from an auth context.
12+
const { preferences, updatePreferences, isLoading, subscribeToPushNotifications } = useNotifications('user-123');
13+
const [shortcutsEnabled, setShortcutsEnabled] = useState(getEnabledKeys());
14+
const [shortcuts] = useState<Shortcut[]>(getShortcuts());
1915

2016
const handleUpdatePreferences = async (
2117
prefs: Parameters<typeof updatePreferences>[0]
@@ -46,15 +42,60 @@ export default function NotificationSettingsPage() {
4642
</p>
4743
</div>
4844

49-
<div className="grid grid-cols-1 md:grid-cols-3 gap-8">
50-
{/* Main Content */}
51-
<div className="md:col-span-2 space-y-8">
52-
<section className="bg-white rounded-xl shadow-sm border border-gray-200 overflow-hidden">
53-
<PreferencesPanel
54-
preferences={preferences}
55-
onUpdatePreferences={handleUpdatePreferences}
56-
/>
57-
</section>
45+
{/* Device Settings */}
46+
<section className="bg-white rounded-xl shadow-sm border border-gray-200 p-6">
47+
<div className="flex items-center gap-3 mb-4">
48+
<Shield size={22} className="text-blue-600" />
49+
<h2 className="text-xl font-semibold text-gray-900">Push Notifications</h2>
50+
</div>
51+
<p className="text-gray-600 mb-6">
52+
Enable push notifications to stay updated even when you're not on the site.
53+
</p>
54+
<button
55+
onClick={handlePushSubscription}
56+
className="px-6 py-2.5 bg-blue-600 text-white font-medium rounded-lg hover:bg-blue-700 transition-colors flex items-center gap-2"
57+
>
58+
<Bell size={18} />
59+
Enable Browser Push
60+
</button>
61+
</section>
62+
63+
{/* Keyboard Shortcuts */}
64+
<section className="bg-white rounded-xl shadow-sm border border-gray-200 p-6">
65+
<div className="flex items-center gap-3 mb-4">
66+
<Keyboard size={22} className="text-blue-600" />
67+
<h2 className="text-xl font-semibold text-gray-900">Keyboard Shortcuts</h2>
68+
</div>
69+
<div className="flex items-center justify-between mb-6">
70+
<div>
71+
<p className="text-gray-600">Enable keyboard shortcuts</p>
72+
<p className="text-sm text-gray-400">
73+
Press <kbd className="px-1 py-0.5 bg-gray-100 rounded text-xs font-mono">Ctrl+K</kbd> to open the command palette
74+
</p>
75+
</div>
76+
<button
77+
onClick={() => {
78+
const next = !shortcutsEnabled;
79+
setShortcutsEnabled(next);
80+
setEnabledKeys(next);
81+
}}
82+
className={`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${shortcutsEnabled ? 'bg-blue-600' : 'bg-gray-300'}`}
83+
>
84+
<span className={`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${shortcutsEnabled ? 'translate-x-6' : 'translate-x-1'}`} />
85+
</button>
86+
</div>
87+
<div className="space-y-2">
88+
{shortcuts.map((s) => (
89+
<div key={s.keys} className="flex items-center justify-between py-1.5">
90+
<span className="text-sm text-gray-700">{s.description}</span>
91+
<kbd className="text-xs font-mono text-gray-500 bg-gray-100 px-2 py-0.5 rounded">
92+
{s.keys}
93+
</kbd>
94+
</div>
95+
))}
96+
</div>
97+
</section>
98+
</div>
5899

59100
{/* Device Settings */}
60101
<section className="bg-white rounded-xl shadow-sm border border-gray-200 p-6">

0 commit comments

Comments
 (0)