Improve the frontend

This commit is contained in:
Urtzi Alfaro
2025-10-21 19:50:07 +02:00
parent 05da20357d
commit 8d30172483
105 changed files with 14699 additions and 4630 deletions

View File

@@ -102,6 +102,16 @@ export const Header = forwardRef<HeaderRef, HeaderProps>(({
const [isNotificationPanelOpen, setIsNotificationPanelOpen] = useState(false);
// Filter notifications to last 24 hours for the notification bell
// This prevents showing old/stale alerts in the notification panel
const recentNotifications = React.useMemo(() => {
const oneDayAgo = Date.now() - (24 * 60 * 60 * 1000);
return notifications.filter(n => {
const alertTime = new Date(n.timestamp).getTime();
return alertTime > oneDayAgo;
});
}, [notifications]);
const defaultSearchPlaceholder = searchPlaceholder || t('common:forms.search_placeholder', 'Search...');
// Expose ref methods
@@ -259,7 +269,7 @@ export const Header = forwardRef<HeaderRef, HeaderProps>(({
</Button>
<NotificationPanel
notifications={notifications}
notifications={recentNotifications}
isOpen={isNotificationPanelOpen}
onClose={() => setIsNotificationPanelOpen(false)}
onMarkAsRead={markAsRead}