<?php

namespace App\Livewire;
use Livewire\Component;
use Illuminate\Support\Facades\Request;

class MainContentManager extends Component
{
    public $activePage;

    public function mount()
    {
        $segments = request()->segments();
        // Get the last part of the URL path
        $this->activePage = end($segments) ?? 'user-management';
    }

    protected $listeners = ['navigate-to-page' => 'setPage'];

    public function setPage($page)
    {
        $this->activePage = $page;
    }

    public function render()
    {
        return view('livewire.main-content-manager', [
            'activePage' => $this->activePage,
        ]);
    }
}

