Skip to content

Commit 5e40035

Browse files
committed
Merge remote-tracking branch 'origin/claude/add-system-notifications-01WmAjjkvm38e7XKm6ircfDH' into claude/add-system-notifications-01WmAjjkvm38e7XKm6ircfDH
# Conflicts: # components/system-notification-banner/SystemNotificationBanner.tsx
2 parents 4ab3725 + 13ee0f9 commit 5e40035

File tree

3 files changed

+46
-57
lines changed

3 files changed

+46
-57
lines changed

components/system-notification-banner/SystemNotificationBanner.tsx

Lines changed: 38 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,19 @@ const notificationConfig: Record<
3535
> = {
3636
info: {
3737
color: 'blue',
38-
icon: <IconInfoCircle size={20} />,
38+
icon: <IconInfoCircle size={16} />,
3939
},
4040
warning: {
4141
color: 'yellow',
42-
icon: <IconAlertTriangle size={20} />,
42+
icon: <IconAlertTriangle size={16} />,
4343
},
4444
error: {
4545
color: 'red',
46-
icon: <IconX size={20} />,
46+
icon: <IconX size={16} />,
4747
},
4848
success: {
4949
color: 'green',
50-
icon: <IconCircleCheck size={20} />,
50+
icon: <IconCircleCheck size={16} />,
5151
},
5252
};
5353

@@ -69,56 +69,44 @@ const SystemNotificationBanner = ({
6969
const config = notificationConfig[notification.type];
7070

7171
return (
72-
<Alert
72+
<Box
7373
key={notification.id}
74-
variant="filled"
75-
color={config.color}
76-
radius={0}
77-
icon={config.icon}
78-
title={notification.title}
79-
withCloseButton={notification.dismissible !== false}
80-
onClose={() => dismissNotification(notification.id)}
81-
styles={{
82-
root: {
83-
borderRadius: 0,
84-
},
85-
message: {
86-
color: 'inherit',
87-
},
88-
}}
74+
bg={`var(--mantine-color-${config.color}-filled)`}
75+
c="white"
76+
py="xs"
77+
px="md"
8978
>
90-
<Group justify="space-between" align="center" wrap="nowrap">
91-
<Text size="sm" inherit>
92-
{notification.message}
93-
</Text>
94-
{notification.action && (
95-
<Box>
96-
{notification.action.href ? (
97-
<Anchor
98-
href={notification.action.href}
99-
target="_blank"
100-
rel="noopener noreferrer"
101-
c="white"
102-
fw={600}
103-
size="sm"
104-
underline="always"
105-
>
106-
{notification.action.label}
107-
</Anchor>
108-
) : (
109-
<Button
110-
variant="white"
111-
color={config.color}
112-
size="compact-sm"
113-
onClick={notification.action.onClick}
114-
>
115-
{notification.action.label}
116-
</Button>
117-
)}
118-
</Box>
79+
<Group justify="space-between" align="center" wrap="nowrap" gap="md">
80+
<Group gap="xs" wrap="nowrap" style={{ flex: 1, minWidth: 0 }}>
81+
{config.icon}
82+
<Text size="sm" truncate>
83+
{notification.message}
84+
</Text>
85+
{notification.action?.href && (
86+
<Anchor
87+
href={notification.action.href}
88+
target="_blank"
89+
rel="noopener noreferrer"
90+
c="white"
91+
fw={600}
92+
size="sm"
93+
underline="always"
94+
style={{ flexShrink: 0 }}
95+
>
96+
{notification.action.label}
97+
</Anchor>
98+
)}
99+
</Group>
100+
{notification.dismissible !== false && (
101+
<CloseButton
102+
size="sm"
103+
c="white"
104+
onClick={() => dismissNotification(notification.id)}
105+
aria-label="Dismiss notification"
106+
/>
119107
)}
120108
</Group>
121-
</Alert>
109+
</Box>
122110
);
123111
})}
124112
</Stack>

contexts/system-notifications/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ export type NotificationType = 'info' | 'warning' | 'error' | 'success';
55
export interface SystemNotification {
66
id: string;
77
type: NotificationType;
8-
title: string;
98
message: string;
109
dismissible?: boolean;
1110
action?: {

public/system-announcements.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@
22
{
33
"id": "welcome-notification",
44
"type": "info",
5-
"title": "Welcome to DesignSparx Dashboard",
6-
"message": "This is a demo notification. Edit public/system-announcements.json to customize.",
7-
"dismissible": true
5+
"message": "Welcome to DesignSparx Dashboard. Edit public/system-announcements.json to customize.",
6+
"dismissible": true,
7+
"action": {
8+
"label": "Learn more",
9+
"href": "https://github.com/design-sparx/mantine-analytics-dashboard"
10+
}
811
},
912
{
1013
"id": "example-previous-announcement",
1114
"type": "warning",
12-
"title": "Example: Previous Breaking Change",
13-
"message": "This is an example of a previous announcement kept for history. Only the first item in the array is shown.",
15+
"message": "Example: API endpoints restructured in v4.0. Please review the migration guide.",
1416
"dismissible": true,
1517
"action": {
16-
"label": "Learn More",
18+
"label": "Read more",
1719
"href": "https://github.com/design-sparx/mantine-analytics-dashboard"
1820
}
1921
}

0 commit comments

Comments
 (0)