"use client"; import Link from "next/link"; import { useMemo, useState } from "react"; import { Bell, BriefcaseBusiness, MessageCircle, MoreHorizontal, ThumbsUp, UserPlus, type LucideIcon } from "lucide-react"; import { Avatar } from "@/components/Avatar"; import { people } from "@/lib/demo-data"; type NotificationCategory = "all" | "posts" | "mentions"; type NotificationItem = { id: string; category: NotificationCategory; icon: LucideIcon; person?: typeof people[number]; text: string; age: string; href: string; unread?: boolean; }; const filters: Array<{ label: string; value: NotificationCategory }> = [ { label: "All", value: "all" }, { label: "My posts", value: "posts" }, { label: "Mentions", value: "mentions" }, ]; const notifications: NotificationItem[] = [ { id: "network-accepted", category: "all", icon: UserPlus, person: people[0], text: "Jordan Lee accepted your invitation. You can now see each other’s updates.", age: "1h", href: "/my-network", unread: true }, { id: "post-reactions", category: "posts", icon: ThumbsUp, person: people[1], text: "Priya Raman and 18 others reacted to your post about design review rituals.", age: "3h", href: "/feed", unread: true }, { id: "post-comment", category: "posts", icon: MessageCircle, person: people[2], text: "Noah Williams commented: “This is exactly the tradeoff our team is discussing.”", age: "5h", href: "/feed", unread: true }, { id: "mention-thread", category: "mentions", icon: MessageCircle, person: people[1], text: "Priya Raman mentioned you in a thread about responsible AI review rituals.", age: "7h", href: "/notifications" }, { id: "job-alert", category: "all", icon: BriefcaseBusiness, text: "New roles match your job alert: Senior Product Designer in San Francisco Bay Area.", age: "1d", href: "/jobs" }, ]; export function NotificationsView() { const [activeFilter, setActiveFilter] = useState("all"); const [openMenuId, setOpenMenuId] = useState(null); const filteredNotifications = useMemo(() => ( activeFilter === "all" ? notifications : notifications.filter((item) => item.category === activeFilter) ), [activeFilter]); return (
{filters.map((filter) => ( ))}
{filteredNotifications.length ? filteredNotifications.map((item) => { const Icon = item.icon; const open = openMenuId === item.id; return (
{item.person ? : }

{item.text}

{open && }
); }) :

No notifications here

New updates will appear when they match this filter.

}
); }