import React from 'react' import { router, usePage } from '@inertiajs/react' import { HiOutlineBell } from 'react-icons/hi2' import Dropdown from '@/Components/Defaults/Dropdown' import { isEmpty } from 'lodash' export default function NotificationContent() { const { props: { notifications, count_unread_notifications }, } = usePage() const handleNotification = (notif) => { fetch(route('api.notification.update', notif)) if (isEmpty(notif.url) === false) { router.visit(notif.url) return } router.get(route(route().current())) } return (
{count_unread_notifications}
{notifications.map((notif) => (
handleNotification(notif)} key={notif.id} >
{notif.description}
{notif.format_created_at}
))} {notifications.length > 0 && (
router.get(route('notifications.index')) } > lihat semua
handleNotification()} > tandai semua dibaca
)} {notifications.length === 0 && (
Tidak ada notifikasi
)}
) }