[PULSE-55] In-app notification center, settings tab, and notifications page #28

Merged
uz1mani merged 13 commits from staging into main 2026-02-16 19:46:02 +00:00
6 changed files with 296 additions and 719 deletions
Showing only changes of commit c37613e823 - Show all commits

View File

@@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
### Added ### Added
- **In-app notification center.** Bell icon in the header with dropdown of recent notifications. Uptime monitor status changes (down, degraded, recovered) create in-app notifications with links to the uptime page. - **In-app notification center.** Bell icon in the header with dropdown of recent notifications. Uptime monitor status changes (down, degraded, recovered) create in-app notifications with links to the uptime page.
- **Payment failed notifications.** When Stripe sends `invoice.payment_failed`, owners and admins receive an in-app notification with a link to update payment method. Members do not see billing notifications.
## [0.5.1-alpha] - 2026-02-12 ## [0.5.1-alpha] - 2026-02-12

View File

@@ -46,7 +46,7 @@ function formatTimeAgo(dateStr: string): string {
} }
greptile-apps[bot] commented 2026-02-16 19:38:19 +00:00 (Migrated from github.com)
Review

Duplicated formatTimeAgo and getTypeIcon utilities

formatTimeAgo and getTypeIcon are identical copies between this file and app/notifications/page.tsx. Consider extracting them into a shared utility (e.g., lib/utils/notifications.ts) to avoid maintaining the same logic in two places.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix With AI
This is a comment left during a code review.
Path: components/notifications/NotificationCenter.tsx
Line: 34:46

Comment:
**Duplicated `formatTimeAgo` and `getTypeIcon` utilities**

`formatTimeAgo` and `getTypeIcon` are identical copies between this file and `app/notifications/page.tsx`. Consider extracting them into a shared utility (e.g., `lib/utils/notifications.ts`) to avoid maintaining the same logic in two places.

<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>

How can I resolve this? If you propose a fix, please make it concise.
**Duplicated `formatTimeAgo` and `getTypeIcon` utilities** `formatTimeAgo` and `getTypeIcon` are identical copies between this file and `app/notifications/page.tsx`. Consider extracting them into a shared utility (e.g., `lib/utils/notifications.ts`) to avoid maintaining the same logic in two places. <sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub> <details><summary>Prompt To Fix With AI</summary> `````markdown This is a comment left during a code review. Path: components/notifications/NotificationCenter.tsx Line: 34:46 Comment: **Duplicated `formatTimeAgo` and `getTypeIcon` utilities** `formatTimeAgo` and `getTypeIcon` are identical copies between this file and `app/notifications/page.tsx`. Consider extracting them into a shared utility (e.g., `lib/utils/notifications.ts`) to avoid maintaining the same logic in two places. <sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub> How can I resolve this? If you propose a fix, please make it concise. ````` </details>
uz1mani commented 2026-02-16 19:41:44 +00:00 (Migrated from github.com)
Review

Issue: formatTimeAgo and getTypeIcon were duplicated in NotificationCenter.tsx and app/notifications/page.tsx, so both need updates when the behavior changes.
Fix: Moved both helpers to lib/utils/notifications.tsx and switched both consumers to import from the shared utility.
Why: Centralizes logic in one place so future changes are consistent across the notification center and notifications page.

Issue: formatTimeAgo and getTypeIcon were duplicated in NotificationCenter.tsx and app/notifications/page.tsx, so both need updates when the behavior changes. Fix: Moved both helpers to lib/utils/notifications.tsx and switched both consumers to import from the shared utility. Why: Centralizes logic in one place so future changes are consistent across the notification center and notifications page.
function getTypeIcon(type: string) { function getTypeIcon(type: string) {
if (type.includes('down') || type.includes('degraded')) { if (type.includes('down') || type.includes('degraded') || type.startsWith('billing_')) {
return <AlertTriangleIcon className="w-4 h-4 shrink-0 text-amber-500" /> return <AlertTriangleIcon className="w-4 h-4 shrink-0 text-amber-500" />
} }
return <CheckCircleIcon className="w-4 h-4 shrink-0 text-emerald-500" /> return <CheckCircleIcon className="w-4 h-4 shrink-0 text-emerald-500" />