'use client'; import { useEffect, useState } from 'react'; import { loadComponent } from '@/lib/material-components'; import { useOptimizedFetch } from '@/hooks/useOptimizedFetch'; export default function NotificationsPage() { const [componentsLoaded, setComponentsLoaded] = useState(false); const [filter, setFilter] = useState<'unread'>('unread'); useEffect(() => { Promise.all([ loadComponent('elevated-card'), loadComponent('list'), loadComponent('list-item'), loadComponent('icon'), loadComponent('chip-set'), loadComponent('assist-chip'), ]).then(() => { setComponentsLoaded(true); }).catch((err) => { console.error('Error loading components:', err); setComponentsLoaded(true); }); }, []); const { data: notificationsData, loading, refetch } = useOptimizedFetch({ url: '/notifications/', cacheKey: 'notifications_list', cacheTTL: 1 * 60 * 1000, // 1 минута }); if (!componentsLoaded) { return (
Нет непрочитанных уведомлений