klg-asutk-app/components/settings/NotificationSettings.tsx
Yuriy aa052763f6 Безопасность и качество: 8 исправлений + обновления
- .env.example: полный шаблон, защита секретов
- .gitignore: явное исключение .env.* и секретов
- layout.tsx: XSS — заменён dangerouslySetInnerHTML на next/script для SW
- ESLint: no-console error (allow warn/error), ignore scripts/
- scripts/remove-console-logs.js: очистка console.log без glob
- backend/routes/modules: README с планом рефакторинга крупных файлов
- SECURITY.md: гид по секретам, XSS, CORS, auth, линту
- .husky/pre-commit: запуск npm run lint

+ прочие правки приложения и бэкенда

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-14 21:29:16 +03:00

48 lines
1.8 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use client';
import type { UserPreferences } from './types';
interface NotificationSettingsProps {
preferences: UserPreferences;
onChange: (updater: (prev: UserPreferences) => UserPreferences) => void;
}
export default function NotificationSettings({ preferences, onChange }: NotificationSettingsProps) {
const items: { key: keyof UserPreferences['notifications']; title: string; desc: string }[] = [
{ key: 'email', title: 'Email уведомления', desc: 'Получать уведомления на электронную почту' },
{ key: 'push', title: 'Push уведомления', desc: 'Получать push-уведомления в браузере' },
{ key: 'sound', title: 'Звуковые сигналы', desc: 'Воспроизводить звук для критических уведомлений' },
{ key: 'criticalOnly', title: 'Только критические', desc: 'Показывать только критические уведомления' },
];
return (
<div>
<h3 className="">
Настройки уведомлений
</h3>
<div className="flex gap-3 items-center">
{items.map(({ key, title, desc }) => (
<label key={key} className="flex gap-3 items-center">
<input
type="checkbox"
checked={preferences.notifications[key]}
onChange={(e) =>
onChange((prev) => ({
...prev,
notifications: { ...prev.notifications, [key]: e.target.checked },
}))
}
className="w-full"
/>
<div>
<div className="">{title}</div>
<div className="">{desc}</div>
</div>
</label>
))}
</div>
</div>
);
}