diff --git a/frontend/src/i18n/locales/en.json b/frontend/src/i18n/locales/en.json index fe511d83..5f3e4e66 100644 --- a/frontend/src/i18n/locales/en.json +++ b/frontend/src/i18n/locales/en.json @@ -4153,18 +4153,21 @@ "allCaughtUp": "All caught up", "any": "Any", "apps": "Services", + "category": "Category", "critical": "Critical", "deliveryLog": "Delivery log", "dismiss": "Dismiss {{title}}", "filterByCategory": "Filter by category", "filterBySeverity": "Filter by severity", "filterNotifications": "Filter notifications", + "filters": "Filters", "loadMore": "Load more", "markAllRead": "Mark all read", "markCategoryRead": "Mark {{category}} read", "noNotificationsYet": "No notifications yet.", "noUnreadNotifications": "No unread notifications.", "notifications": "Notifications", + "reset": "Reset", "success": "Success", "unread": "Unread", "unreadCount": "{{count}} unread" diff --git a/frontend/src/pages/Notifications.jsx b/frontend/src/pages/Notifications.jsx index 7741252b..a4d03a68 100644 --- a/frontend/src/pages/Notifications.jsx +++ b/frontend/src/pages/Notifications.jsx @@ -1,6 +1,6 @@ import { useState, useEffect, useCallback } from 'react'; import { useNavigate } from 'react-router-dom'; -import { Bell, CheckCheck, ScrollText, X } from 'lucide-react'; +import { Bell, CheckCheck, Filter, ScrollText, X } from 'lucide-react'; import api from '../services/api'; import PageLayout from '../layouts/PageLayout'; import { Button } from '@/components/ui/button'; @@ -8,6 +8,8 @@ import { useAuth } from '../contexts/useAuth.js'; import { useNotifications } from '../contexts/useNotifications.js'; import { timeAgo } from '../utils/time'; import { useTranslation } from 'react-i18next'; +import { Sheet, SheetTrigger, SheetContent, SheetTitle } from '@/components/ui/sheet'; +import useMediaQuery from '../hooks/useMediaQuery'; const SEVERITY_DOT = { critical: '#fb6f6f', @@ -46,6 +48,8 @@ export default function Notifications() { const [unreadCount, setUnreadCount] = useState(0); const [loading, setLoading] = useState(true); const [hasMore, setHasMore] = useState(false); + const compact = useMediaQuery('(max-width: 768px)'); + const activeFilters = (category ? 1 : 0) + (severity ? 1 : 0); const fetchPage = useCallback(async (startOffset, replace) => { setLoading(true); @@ -89,6 +93,36 @@ export default function Notifications() { fetchPage(0, true); }; + const categoryChips = ( +
+ {CATEGORY_CHIPS.map((c) => ( + + ))} +
+ ); + const severityChips = ( +
+ {SEVERITY_CHIPS.map((s) => ( + + ))} +
+ ); + const chipsets = <>{categoryChips}{severityChips}; + // Live system notices (admin config hints) come from the shared context so they // surface here too, above the bus history. const noticeItems = (ctxItems || []).filter((it) => it.kind === 'notice'); @@ -112,52 +146,51 @@ export default function Notifications() { )} >
-
- - -
- -
-
- {CATEGORY_CHIPS.map((c) => ( - - ))} -
-
- {SEVERITY_CHIPS.map((s) => ( - - ))} +
+
+ +
+ {compact ? ( + + + + + + {t('app.notifications.filters', 'Filters')} +
+ {t('app.notifications.category', 'Category')} + {categoryChips} + {t('common.labels.severity', 'Severity')} + {severityChips} + +
+
+
+ ) : ( +
{chipsets}
+ )}
{loading && items.length === 0 && noticeItems.length === 0 ? ( diff --git a/frontend/src/styles/pages/_notification-center.scss b/frontend/src/styles/pages/_notification-center.scss index 3cf77117..7824b3c1 100644 --- a/frontend/src/styles/pages/_notification-center.scss +++ b/frontend/src/styles/pages/_notification-center.scss @@ -3,10 +3,36 @@ .sk-notif-page { // Width and gutter come from the page shell, as on every page. + &__toolbar { + display: flex; + align-items: center; + flex-wrap: wrap; + gap: $space-3; + margin-bottom: $space-4; + } + + &__filter-btn { position: relative; margin-inline-start: auto; } + + &__filter-count { + margin-inline-start: $space-1; + font-size: $text-xs; + color: $accent-primary; + } + + &__sheet { + display: flex; + flex-direction: column; + gap: $space-3; + } + + &__sheet-label { + font-size: $text-xs; + color: $text-secondary; + } + &__filters { display: inline-flex; gap: $space-1; - margin-bottom: $space-4; background: $bg-card; border: 1px solid $border-subtle; border-radius: $radius-card; @@ -334,9 +360,8 @@ display: flex; flex-wrap: wrap; gap: $space-4; - padding: 0 0 $space-3; - margin-bottom: $space-2; - border-bottom: 1px solid $border-subtle; + padding-inline-start: $space-4; + border-inline-start: 1px solid $border-subtle; } .sk-notif-chipset {