perf: add indexed notification summaries and widget

This commit is contained in:
2026-07-29 14:16:29 +02:00
parent 992d2ca533
commit e32ba3663b
9 changed files with 312 additions and 36 deletions
+56 -2
View File
@@ -1,5 +1,10 @@
import { createElement, lazy } from "react";
import type { PlatformWebModule, SettingsSectionsUiCapability } from "@govoplan/core-webui";
import type {
DashboardWidgetsUiCapability,
PlatformWebModule,
SettingsSectionsUiCapability
} from "@govoplan/core-webui";
import NotificationSummaryWidget from "./features/notifications/NotificationSummaryWidget";
import { generatedTranslations } from "./i18n/generatedTranslations";
import "./styles/notifications.css";
@@ -8,6 +13,47 @@ const NotificationSettingsPanel = lazy(() => import("./features/notifications/No
const notificationRead = ["notifications:notification:read"];
const notificationDashboardWidgets: DashboardWidgetsUiCapability = {
widgets: [
{
id: "notifications.summary",
surfaceId: "notifications.widget.summary",
title: "Notifications",
description: "Unread notifications and delivery state.",
moduleId: "notifications",
category: "Communication",
order: 60,
defaultSize: "medium",
supportedSizes: ["medium", "wide"],
anyOf: notificationRead,
refreshIntervalMs: 30_000,
defaultConfiguration: {
showDeliveryState: true
},
configurationFields: [
{
id: "showDeliveryState",
label: "Show delivery state",
description: "Include pending and failed delivery counts.",
kind: "boolean"
}
],
render: ({ settings, effectiveView, refreshKey, configuration }) =>
createElement(NotificationSummaryWidget, {
settings,
refreshKey,
configuration,
showCenterLink: (
!effectiveView?.activeViewId
|| effectiveView.visibleSurfaceIds.includes(
"notifications.route.notifications"
)
)
})
}
]
};
const notificationSettingsSections: SettingsSectionsUiCapability = {
sections: [
{
@@ -30,6 +76,13 @@ export const notificationsModule: PlatformWebModule = {
optionalDependencies: ["mail", "tasks", "portal", "workflow", "calendar", "scheduling"],
translations: generatedTranslations,
viewSurfaces: [
{
id: "notifications.widget.summary",
moduleId: "notifications",
kind: "section",
label: "Notification summary widget",
order: 30
},
{
id: "notifications.settings.preferences",
moduleId: "notifications",
@@ -42,7 +95,8 @@ export const notificationsModule: PlatformWebModule = {
{ path: "/notifications", anyOf: notificationRead, order: 59, render: ({ settings, auth }) => createElement(NotificationCenterPage, { settings, auth }) }
],
uiCapabilities: {
"settings.sections": notificationSettingsSections
"settings.sections": notificationSettingsSections,
"dashboard.widgets": notificationDashboardWidgets
}
};