import React, { useState, useEffect } from 'react' import { ToastContainer, toast } from 'react-toastify' import ApplicationLogo from '@/Components/Defaults/ApplicationLogo' import Dropdown from '@/Components/Defaults/Dropdown' import { Link, usePage } from '@inertiajs/react' import { Breadcrumb } from 'flowbite-react' import { HiMenu, HiChevronDown, HiHome } from 'react-icons/hi' import { router } from '@inertiajs/react' import SidebarNav from './Partials/SidebarNav' import { HiOutlineBell } from 'react-icons/hi2' export default function Authenticated({ children, page = '', action = '', parent = null, }) { const { props: { count_unread_notifications, notifications, auth, flash }, } = usePage() const [showingNavigationDropdown, setShowingNavigationDropdown] = useState(false) const handleNotification = (notif) => { fetch(route('api.notification.update', notif)) router.get(route(route().current())) } useEffect(() => { if (flash.message !== null) { toast(flash.message.message, { type: flash.message.type }) } }, [flash]) return (
{page !== '' && ( parent === null ? router.visit(route('dashboard')) : router.visit(parent) } >

{page}

{typeof action === 'string' && ( {action} )} {typeof action === 'object' && action.map((item) => ( {item} ))}
)}
{children}
) }