import React, { useEffect, useState } from 'react'; import { fetchNotificaciones, fetchAllNotifications, marcarNotificacionComoVista } from '../api/notificaciones'; // Función para obtener el icono apropiado según el tipo de notificación const getNotificationIcon = (tipo) => { const iconProps = "w-6 h-6"; switch (tipo) { case 'success': case 'exito': return (
{count > 0 ? `${count} notificaciones encontradas` : 'No hay notificaciones'}
| ID | Tipo | Mensaje | Fecha | Estado |
|---|---|---|---|---|
| #{n.id} |
{getNotificationIcon(n.tipo?.tipo)}
{n.tipo?.descripcion || n.tipo?.tipo || 'Notificación'}
|
{n.mensaje} | {formatTimestamp(n.fecha_envio || n.created_at)} | {n.visto ? ( Leída ) : ( Nueva )} |
| - | ||||
No se encontraron notificaciones con los filtros aplicados.
{n.tipo?.descripcion || n.tipo?.tipo || 'Notificación'}
{n.visto ? ( Leída ) : ( Nueva )}{n.mensaje}