<nav id="menu">

    <div class="menu-header">
        <img src="{{ asset('logo/plaza-logo-wide.png') }}">
    </div>

    <div class="menu-navigation">

        @foreach( config('menu') as $menu )

            <div class="menu-group">

                <div class="menu-group-title">
                    {{ $menu['name'] }}
                </div>

                @foreach( $menu['items'] as $item )
                    @if( !isset( $item['requires_auth'] ) || $item['requires_auth'] === true && $VISITOR->loggedIn() )
                        <a href="{{ isset($item['xf_route']) ? xfRoute($item['xf_route']) : $item['custom_route'] ?? route($item['route']) }}"
                            @class(['menu-item', 'active' => request()->routeIs( $item['route'] ?? '' )])
                            style="{{ isset( $item['color'] ) ? 'color:' . $item['color'] . ';' : '' }}"
                            {{ isset( $item['custom_route'] ) ? 'target="_blank"' : '' }}
                        >
                            <i data-lucide="{{ $item['icon'] }}"></i><span>{{ $item['name'] }}</span>
                        </a>
                    @endif
                @endforeach

            </div>

        @endforeach

    </div>

    <div class="menu-user">
        <div class="menu-user-avatar">
            <x-xen-foro-avatar />
        </div>
        <div class="menu-user-info">
            <span class="username">
                {{ $VISITOR->username ?? "Guest" }}
            </span>
            <span class="user_role">
                <a href="{{ $VISITOR->guest() ? xfRoute('login') : xfRoute('logout') . '?t=' . xfCsrfToken() }}">
                    {{ $VISITOR->guest() ? 'Login' : 'Logout' }}
                </a>
            </span>
        </div>
    </div>

</nav>
