style: ui improvement to the notification cards.

This commit is contained in:
Nathnael
2026-07-06 10:54:43 +00:00
parent ca3a6072d8
commit 298ad6227b
11 changed files with 211 additions and 109 deletions

View File

@@ -1,5 +1,9 @@
import { CurrentUser } from "@edr/api-common";
import { NotificationAudience } from "@edr/types";
import {
NotificationAudience,
NotificationPriority,
NotificationType,
} from "@edr/types";
import {
Body,
Controller,
@@ -62,7 +66,13 @@ export class NotificationInboxController {
sendTest(
@CurrentUser() user: AuthUserPayload,
@Body()
body: { audience?: NotificationAudience; title?: string; message?: string },
body: {
audience?: NotificationAudience;
type?: NotificationType;
priority?: NotificationPriority;
title?: string;
message?: string;
},
) {
return this.service.sendTestToUser(resolveAuthUserId(user), body ?? {});
}

View File

@@ -109,15 +109,21 @@ export class NotificationInboxService {
/** [dev/verification only] Send a canned notification straight to one user. */
async sendTestToUser(
userId: string,
body: { audience?: NotificationAudience; title?: string; message?: string },
body: {
audience?: NotificationAudience;
type?: NotificationType;
priority?: NotificationPriority;
title?: string;
message?: string;
},
): Promise<NotificationDto> {
const entity = await this.repo.create({
recipientUserId: userId,
audience: body.audience ?? NotificationAudience.BACKOFFICE,
type: NotificationType.GENERIC,
type: body.type ?? NotificationType.GENERIC,
title: body.title ?? "Test notification",
body: body.message ?? "This is a test in-app notification.",
priority: NotificationPriority.NORMAL,
priority: body.priority ?? NotificationPriority.NORMAL,
isRead: false,
});
const dto = this.toDto(entity);

View File

@@ -30,6 +30,7 @@ function toItem(n: NotificationDto): NotificationItemData {
body: n.body,
createdAt: n.createdAt,
isRead: n.isRead,
priority: n.priority,
link: n.link,
data: n.data,
};

View File

@@ -20,7 +20,7 @@ export function resolveNotificationVisual(
case NotificationType.CLEARANCE_REVIEW:
return { icon: <ClipboardCheck size={ICON_SIZE} />, color: "orange" };
default:
return { icon: <Bell size={ICON_SIZE} />, color: "gray" };
return { icon: <Bell size={ICON_SIZE} />, color: "edr-green" };
}
}

View File

@@ -30,6 +30,7 @@ function toItem(n: NotificationDto): NotificationItemData {
body: n.body,
createdAt: n.createdAt,
isRead: n.isRead,
priority: n.priority,
link: n.link,
data: n.data,
};

View File

@@ -28,7 +28,7 @@ export function resolveNotificationVisual(
case NotificationType.INVOICE_ISSUED:
return { icon: <Receipt size={ICON_SIZE} />, color: "violet" };
default:
return { icon: <Bell size={ICON_SIZE} />, color: "gray" };
return { icon: <Bell size={ICON_SIZE} />, color: "edr-green" };
}
}