"use client" import { useState } from "react" import { mockNotifications } from "@/lib/mock-data" import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" import { Button } from "@/components/ui/button" import { Badge } from "@/components/ui/badge" import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs" import { Bell, CheckCircle2, AlertCircle, Info, User, FileText, Calendar, Clock, Trash2, Check, MoreVertical, Settings, Filter } from "lucide-react" import { cn } from "@/lib/utils" import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "@/components/ui/dropdown-menu" export function NotificationsPage() { const [notifications, setNotifications] = useState(mockNotifications) const [filter, setFilter] = useState("all") const unreadCount = notifications.filter(n => !n.read).length const filteredNotifications = notifications.filter(notification => { if (filter === "all") return true if (filter === "unread") return !notification.read return notification.type === filter }) const markAsRead = (id: string) => { setNotifications(prev => prev.map(n => n.id === id ? { ...n, read: true } : n )) } const markAllAsRead = () => { setNotifications(prev => prev.map(n => ({ ...n, read: true }))) } const deleteNotification = (id: string) => { setNotifications(prev => prev.filter(n => n.id !== id)) } const getNotificationIcon = (type: string) => { switch (type) { case "requisition": return case "approval": return case "candidate": return case "interview": return case "reminder": return case "alert": return default: return } } const getNotificationColor = (type: string, priority: string) => { if (priority === "high") return "bg-destructive/10 text-destructive border-destructive/20" switch (type) { case "requisition": return "bg-primary/10 text-primary border-primary/20" case "approval": return "bg-accent/10 text-accent border-accent/20" case "candidate": return "bg-blue-500/10 text-blue-500 border-blue-500/20" case "interview": return "bg-purple-500/10 text-purple-500 border-purple-500/20" case "reminder": return "bg-yellow-500/10 text-yellow-500 border-yellow-500/20" default: return "bg-muted text-muted-foreground border-muted" } } const formatDate = (dateString: string) => { const date = new Date(dateString) const now = new Date() const diff = now.getTime() - date.getTime() const hours = Math.floor(diff / (1000 * 60 * 60)) const days = Math.floor(hours / 24) if (hours < 1) return "Hace menos de 1 hora" if (hours < 24) return `Hace ${hours} hora${hours > 1 ? "s" : ""}` if (days < 7) return `Hace ${days} dia${days > 1 ? "s" : ""}` return date.toLocaleDateString("es-MX", { day: "numeric", month: "short" }) } return (
{/* Header */}

Notificaciones

Tienes {unreadCount} notificaciones sin leer

{/* Stats */}
setFilter("all")} >
{notifications.length}
Todas
setFilter("unread")} >
{unreadCount}
{unreadCount}
Sin leer
setFilter("approval")} >
{notifications.filter(n => n.type === "approval").length}
Aprobaciones
setFilter("interview")} >
{notifications.filter(n => n.type === "interview").length}
Entrevistas
setFilter("candidate")} >
{notifications.filter(n => n.type === "candidate").length}
Candidatos
{/* Notifications List */}
{filter === "all" ? "Todas las notificaciones" : filter === "unread" ? "Notificaciones sin leer" : `Notificaciones de ${filter}`} {filteredNotifications.length}
{filteredNotifications.length > 0 ? (
{filteredNotifications.map(notification => (
markAsRead(notification.id)} >
{getNotificationIcon(notification.type)}

{notification.title}

{notification.message}

{!notification.read && (
)} {notification.priority === "high" && ( Urgente )}
{formatDate(notification.createdAt)} {notification.actionUrl && ( )}
e.stopPropagation()}> { e.stopPropagation() markAsRead(notification.id) }}> Marcar como leida { e.stopPropagation() deleteNotification(notification.id) }} className="text-destructive" > Eliminar
))}
) : (

No hay notificaciones

)}
) }