Download tasks/linkedin/tests/oracle-runtime/clone/components/Notifications.tsx from TIGER-Lab/WebsiteBench: direct link, hf CLI and curl.
- Browser
- Download file 4.46 kB
-
https://huggingface.co/datasets/TIGER-Lab/WebsiteBench/resolve/main/tasks/linkedin/tests/oracle-runtime/clone/components/Notifications.tsx
- Command line
-
hf download hf://datasets/TIGER-Lab/WebsiteBench/tasks/linkedin/tests/oracle-runtime/clone/components/Notifications.tsx
-
curl -L -o Notifications.tsx https://huggingface.co/datasets/TIGER-Lab/WebsiteBench/resolve/main/tasks/linkedin/tests/oracle-runtime/clone/components/Notifications.tsx
4.46 kB
| "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<NotificationCategory>("all"); | |
| const [openMenuId, setOpenMenuId] = useState<string | null>(null); | |
| const filteredNotifications = useMemo(() => ( | |
| activeFilter === "all" | |
| ? notifications | |
| : notifications.filter((item) => item.category === activeFilter) | |
| ), [activeFilter]); | |
| return ( | |
| <div className="notifications-layout"> | |
| <aside className="surface notification-settings"> | |
| <Bell size={28} /> | |
| <h2>Manage your notifications</h2> | |
| <p>Choose what you hear about and how often.</p> | |
| <button>View settings</button> | |
| </aside> | |
| <section className="surface notifications-feed"> | |
| <div className="notification-tabs" role="tablist" aria-label="Notification filters"> | |
| {filters.map((filter) => ( | |
| <button | |
| aria-selected={activeFilter === filter.value} | |
| className={activeFilter === filter.value ? "active" : ""} | |
| key={filter.value} | |
| onClick={() => { | |
| setActiveFilter(filter.value); | |
| setOpenMenuId(null); | |
| }} | |
| role="tab" | |
| type="button" | |
| > | |
| {filter.label} | |
| </button> | |
| ))} | |
| </div> | |
| {filteredNotifications.length ? filteredNotifications.map((item) => { | |
| const Icon = item.icon; | |
| const open = openMenuId === item.id; | |
| return ( | |
| <article className={`notification-row ${item.unread ? "unread" : ""}`} key={item.id}> | |
| {item.person ? <Avatar name={item.person.name} src={item.person.avatar} size="lg" /> : <span className="notification-icon"><Icon size={23} /></span>} | |
| <Link prefetch={false} className="notification-copy" href={item.href}><p>{item.text}</p></Link> | |
| <time>{item.age}</time> | |
| <span className="notification-menu"> | |
| <button className="icon-button" aria-expanded={open} aria-label="Notification menu" onClick={() => setOpenMenuId(open ? null : item.id)} type="button"> | |
| <MoreHorizontal size={20} /> | |
| </button> | |
| {open && <span className="notification-menu-popover" role="menu"><button type="button">Mark as read</button><button type="button">Mute updates</button></span>} | |
| </span> | |
| </article> | |
| ); | |
| }) : <div className="empty-state"><Bell size={34} /><h3>No notifications here</h3><p>New updates will appear when they match this filter.</p></div>} | |
| </section> | |
| </div> | |
| ); | |
| } | |