[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 318 additions and 30 deletions
Showing only changes of commit 4add41293b - Show all commits

View File

@@ -22,7 +22,7 @@ export default function LayoutContent({ children }: { children: React.ReactNode
useEffect(() => { useEffect(() => {
if (auth.user) { if (auth.user) {
getUserOrganizations() getUserOrganizations()
.then((organizations) => setOrgs(organizations)) .then((organizations) => setOrgs(Array.isArray(organizations) ? organizations : []))
.catch(err => console.error('Failed to fetch orgs for header', err)) .catch(err => console.error('Failed to fetch orgs for header', err))
} }
}, [auth.user]) }, [auth.user])

View File

@@ -65,8 +65,8 @@ export default function NotificationCenter() {
setError(null) setError(null)
try { try {
const res = await listNotifications() const res = await listNotifications()
setNotifications(res.notifications) setNotifications(Array.isArray(res?.notifications) ? res.notifications : [])
setUnreadCount(res.unread_count) setUnreadCount(typeof res?.unread_count === 'number' ? res.unread_count : 0)
} catch (err) { } catch (err) {
setError(getAuthErrorMessage(err as Error) || 'Failed to load notifications') setError(getAuthErrorMessage(err as Error) || 'Failed to load notifications')
setNotifications([]) setNotifications([])
@@ -160,14 +160,14 @@ export default function NotificationCenter() {
{error && ( {error && (
<div className="p-6 text-center text-red-500 text-sm">{error}</div> <div className="p-6 text-center text-red-500 text-sm">{error}</div>
)} )}
{!loading && !error && notifications.length === 0 && ( {!loading && !error && (notifications?.length ?? 0) === 0 && (
<div className="p-6 text-center text-neutral-500 dark:text-neutral-400 text-sm"> <div className="p-6 text-center text-neutral-500 dark:text-neutral-400 text-sm">
No notifications yet No notifications yet
</div> </div>
)} )}
{!loading && !error && notifications.length > 0 && ( {!loading && !error && (notifications?.length ?? 0) > 0 && (
<ul className="divide-y divide-neutral-200 dark:divide-neutral-700"> <ul className="divide-y divide-neutral-200 dark:divide-neutral-700">
{notifications.map((n) => ( {(notifications ?? []).map((n) => (
<li key={n.id}> <li key={n.id}>
{n.link_url ? ( {n.link_url ? (
<Link <Link

759
package-lock.json generated

File diff suppressed because it is too large Load Diff