diff --git a/webui/package.json b/webui/package.json index da668d8..c2786dc 100644 --- a/webui/package.json +++ b/webui/package.json @@ -14,10 +14,11 @@ "./styles/notifications.css": "./src/styles/notifications.css" }, "scripts": { - "test:action-url": "rm -rf .component-test-build && mkdir -p .component-test-build && printf '{\"type\":\"commonjs\"}\\n' > .component-test-build/package.json && tsc -p tsconfig.tests.json && node .component-test-build/tests/action-url.test.js" + "test:action-url": "rm -rf .component-test-build && mkdir -p .component-test-build && printf '{\"type\":\"commonjs\"}\\n' > .component-test-build/package.json && tsc -p tsconfig.tests.json && node .component-test-build/tests/action-url.test.js", + "test:ui-structure": "node scripts/test-notification-page-structure.mjs" }, "peerDependencies": { - "@govoplan/core-webui": "^0.1.8", + "@govoplan/core-webui": "^0.1.9", "lucide-react": "^1.23.0", "react": "^19.0.0", "react-dom": "^19.0.0", diff --git a/webui/scripts/test-notification-page-structure.mjs b/webui/scripts/test-notification-page-structure.mjs new file mode 100644 index 0000000..8048888 --- /dev/null +++ b/webui/scripts/test-notification-page-structure.mjs @@ -0,0 +1,18 @@ +import assert from "node:assert/strict"; +import { readFileSync } from "node:fs"; +import { fileURLToPath } from "node:url"; + +const pagePath = fileURLToPath(new URL("../src/features/notifications/NotificationCenterPage.tsx", import.meta.url)); +const stylesPath = fileURLToPath(new URL("../src/styles/notifications.css", import.meta.url)); +const page = readFileSync(pagePath, "utf8"); +const styles = readFileSync(stylesPath, "utf8"); + +assert.match(page, /SelectionList,[\s\S]*SelectionListItem,[\s\S]*from "@govoplan\/core-webui"/); +assert.match(page, //); +assert.match(page, / {loading ?
Loading notifications
: null} {!loading && notifications.length === 0 ?
No notifications in this view.
: null} - {notifications.map((notification) => ( - - ))} + {notifications.length > 0 ? ( + + {notifications.map((notification) => ( + setSelectedId(notification.id)} + > + + {notification.subject || notification.event_kind} + {formatStatus(notification.status)} + + + {notification.source_module} + {formatDate(notification.created_at)} + + + ))} + + ) : null}
diff --git a/webui/src/styles/notifications.css b/webui/src/styles/notifications.css index 25be1a9..4e88589 100644 --- a/webui/src/styles/notifications.css +++ b/webui/src/styles/notifications.css @@ -79,27 +79,14 @@ padding: 8px; } +.notifications-selection-list { + gap: 4px; +} + .notifications-list-item { - width: 100%; display: grid; gap: 4px; min-height: 58px; - border: 0; - border-radius: 6px; - background: transparent; - color: var(--text); - cursor: pointer; - padding: 9px; - text-align: left; -} - -.notifications-list-item:hover, -.notifications-list-item.is-selected { - background: var(--sidebar-hover-bg); -} - -.notifications-list-item.is-selected { - box-shadow: inset 3px 0 var(--accent); } .notifications-list-item.is-read {