"use client"; import { Bell, Trash2, CheckCircle2 } from "@/components/icons/platform-icons"; import { useNotifications } from "@/modules/system/hooks/useNotifications"; import { cn } from "@/lib/utils"; import { formatDistanceToNow } from "date-fns"; import { useState } from "react"; const KIND_DOT: Record = { error: "bg-status-red", success: "bg-status-green", info: "bg-primary", }; type Filter = "all" | "unread"; export function NotificationsPanel() { const { notifications, unreadCount, markAllRead, clearAll } = useNotifications(); const [filter, setFilter] = useState("all"); const visible = filter === "unread" ? notifications.filter((n) => !n.read) : notifications; return (
{/* Toolbar */}
{(["all", "unread"] as Filter[]).map((f) => ( ))}
{/* List */}
{visible.length === 0 ? (

{filter === "unread" ? "No unread notifications" : "No notifications"}

) : (
    {visible.map((n) => (
  • {n.title} {formatDistanceToNow(new Date(n.createdAt), { addSuffix: true })}

    {n.body}

  • ))}
)}
); }