{(() => {
const panel = open ? (
Notifications
{unreadCount > 0 && (
)}
{loading && (
{Array.from({ length: 4 }).map((_, i) => (
))}
)}
{error && (
{error}
)}
{!loading && !error && (notifications?.length ?? 0) === 0 && (
No notifications yet
)}
{!loading && !error && (notifications?.length ?? 0) > 0 && (
{(notifications ?? []).map((n) => (
-
{n.link_url ? (
handleNotificationClick(n)}
className={`block px-4 py-3 hover:bg-neutral-50 dark:hover:bg-neutral-800/50 transition-colors ${!n.read ? 'bg-brand-orange/5 dark:bg-brand-orange/10' : ''}`}
>
{getTypeIcon(n.type)}
{n.title}
{n.body && (
{n.body}
)}
{formatTimeAgo(n.created_at)}
) : (
)}
))}
)}
setOpen(false)}
className="text-sm text-brand-orange hover:underline"
>
View all
setOpen(false)}
className="flex items-center gap-2 text-sm text-neutral-400 hover:text-brand-orange dark:hover:text-brand-orange transition-colors"
>
Manage settings
) : null
return anchor === 'right' && panel && typeof document !== 'undefined'
? createPortal(panel, document.body)
: panel
})()}
)
}