mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-29 14:06:36 +08:00
ae3b792e16
- add util.Go with panic recovery for background goroutines - add util.EscapeLike and explicit ESCAPE clause for SQL LIKE queries - add DummyCheckPassword and subtle.ConstantTimeCompare against timing attacks - enforce session ID rotation upon login/oauth callback to prevent session fixation - add sliding window login failure rate limiting and oauth state rate limiting - fix redis client capture race in pubsub listeners and wait on stop channel - adjust global --primary to oklch(51.1% 0.262 276.966) for WCAG AA contrast - fix semantic heading levels and missing aria-labels across UI components - document security, concurrency, and a11y standards in AGENTS.md
79 lines
2.3 KiB
TypeScript
79 lines
2.3 KiB
TypeScript
'use client';
|
|
|
|
import Link from 'next/link';
|
|
import { useTranslations } from 'next-intl';
|
|
import { Bell } from 'lucide-react';
|
|
import { Switch } from '@/components/ui/switch';
|
|
import { Label } from '@/components/ui/label';
|
|
import { useNotificationSettings } from '@/contexts/notification-settings-context';
|
|
import {
|
|
Breadcrumb,
|
|
BreadcrumbItem,
|
|
BreadcrumbLink,
|
|
BreadcrumbList,
|
|
BreadcrumbPage,
|
|
BreadcrumbSeparator,
|
|
} from '@/components/ui/breadcrumb';
|
|
|
|
export function NotificationsMain() {
|
|
const { showBell, setShowBell } = useNotificationSettings();
|
|
const t = useTranslations('settings');
|
|
const tn = useTranslations('settings.notifications');
|
|
|
|
return (
|
|
<div className='py-6 space-y-6'>
|
|
<div className='font-semibold'>
|
|
<h1 className='sr-only'>{tn('breadcrumb')}</h1>
|
|
<Breadcrumb>
|
|
<BreadcrumbList>
|
|
<BreadcrumbItem>
|
|
<BreadcrumbLink asChild>
|
|
<Link href='/settings' className='text-base text-primary'>
|
|
{t('title')}
|
|
</Link>
|
|
</BreadcrumbLink>
|
|
</BreadcrumbItem>
|
|
<BreadcrumbSeparator />
|
|
<BreadcrumbItem>
|
|
<BreadcrumbPage className='text-base font-semibold'>
|
|
{tn('breadcrumb')}
|
|
</BreadcrumbPage>
|
|
</BreadcrumbItem>
|
|
</BreadcrumbList>
|
|
</Breadcrumb>
|
|
</div>
|
|
|
|
<div className='space-y-6'>
|
|
<div>
|
|
<h2 className='font-medium text-sm text-foreground'>
|
|
{tn('display')}
|
|
</h2>
|
|
<p className='text-xs text-muted-foreground'>{tn('displayDesc')}</p>
|
|
</div>
|
|
|
|
<div className='flex items-center justify-between rounded-lg border p-4'>
|
|
<div className='flex items-center gap-3'>
|
|
<Bell className='size-5 text-primary' />
|
|
<div className='space-y-0.5'>
|
|
<Label
|
|
htmlFor='show-bell'
|
|
className='text-sm font-medium cursor-pointer'
|
|
>
|
|
{tn('showBell')}
|
|
</Label>
|
|
<p className='text-xs text-muted-foreground'>
|
|
{tn('showBellDesc')}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
<Switch
|
|
id='show-bell'
|
|
checked={showBell}
|
|
onCheckedChange={setShowBell}
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|