import React from 'react' import { CheckCheck, Trash2 } from 'lucide-react' import { useTranslation } from '../i18n' import PageShell from '../components/Layout/PageShell' import EmptyState from '../components/shared/EmptyState' import { Spinner } from '../components/shared/Spinner' import InAppNotificationItem from '../components/Notifications/InAppNotificationItem.tsx' import { useInAppNotifications } from './inAppNotifications/useInAppNotifications' import { useIsPhone } from '../mobile/useIsPhone' import MNotifications from '../mobile/screens/notifications/MNotifications' export default function InAppNotificationsPage(): React.ReactElement { const isPhone = useIsPhone() return isPhone ? : } function InAppNotificationsPageDesktop(): React.ReactElement { const { t } = useTranslation() // Page = wiring container: store, filter, fetch + infinite scroll live in the hook. const { notifications, unreadCount, total, isLoading, hasMore, unreadOnly, setUnreadOnly, loaderRef, displayed, markAllRead, deleteAll, } = useInAppNotifications() return ( {/* Header */} {t('notifications.title')} {unreadCount > 0 && ( {unreadCount} )} {total} {total === 1 ? 'notification' : 'notifications'} {/* Bulk actions */} {unreadCount > 0 && ( e.currentTarget.style.background = 'var(--bg-tertiary)'} onMouseLeave={e => e.currentTarget.style.background = 'var(--bg-hover)'} > {t('notifications.markAllRead')} )} {notifications.length > 0 && ( {t('notifications.deleteAll')} )} {/* Filter toggle */} setUnreadOnly(false)} className={`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors ${!unreadOnly ? 'bg-content text-surface' : 'bg-surface-hover text-content-secondary'}`} > {t('notifications.all')} setUnreadOnly(true)} className={`px-3 py-1.5 rounded-lg text-sm font-medium transition-colors ${unreadOnly ? 'bg-content text-surface' : 'bg-surface-hover text-content-secondary'}`} > {t('notifications.unreadOnly')} {/* Notification list */} {isLoading && displayed.length === 0 ? ( ) : displayed.length === 0 ? ( ) : ( displayed.map(n => ( )) )} {/* Infinite scroll trigger */} {hasMore && ( {isLoading && } )} ) }
{total} {total === 1 ? 'notification' : 'notifications'}