Improve the frontend
This commit is contained in:
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user