<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="assests/css/style.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-sRIl4kxILFvY47J16cr9ZwB07vP4J8+LH7qKQnuqkuIAvNWLzeN8tE5YBujZqJLB" crossorigin="anonymous">
    <script src="https://use.fontawesome.com/releases/v6.3.0/js/all.js" crossorigin="anonymous"></script>
    <title>Folliow</title>
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-light">
        <div class="container-fluid">
            {* Logo *}
            <a class="navbar-brand d-flex align-items-center" href="index.php">
                <img src="assests/img/logo.png" alt="Logo" class="logo-image">
            </a>
            
            {* Toggler pour mobile *}
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            
            {* Menu de navigation *}
            <div class="collapse navbar-collapse" id="navbarNav">
                <ul class="navbar-nav me-auto">
                   
                    <li class="nav-item">
                        <a class="nav-link" href="?ctrl=&action=">À propos</a>
                    </li>

                    <li class="nav-item">
                        <a class="nav-link" href="?ctrl=project&action=search">Rechercher</a>
                    </li>
                    {if isset($smarty.session.user)}
                        <li class="nav-item">
                            <a class="nav-link" href="?ctrl=project&action=project">Ajouter un projet</a>
                        </li>
                        {if $smarty.session.user.authorisation_name == "Administrateur"}
                            <li class="nav-item">
                                <a class="nav-link" href="?ctrl=admin&action=admin">Admin</a>
                            </li>
                        {/if}
                    {/if}
                </ul>
                
                {* Menu secondaire *}
                <nav class="col-4 d-flex justify-content-end align-items-center" aria-label="Connexion utilisateur">
                    {if !isset($smarty.session.user)}
                        {* Utilisateur non connecté *}
                        <ul class="navbar-nav">    
                            <li class="nav-item">
                                <a class="nav-link" href="index.php?ctrl=user&action=signin" title="Créer un compte" aria-label="Créer un compte">
                                    S'inscrire
                                </a>
                            </li>
                            <li class="nav-item">    
                                <a class="nav-link" href="index.php?ctrl=user&action=login" title="Se connecter" aria-label="Se connecter">
                                    Se connecter 
                                </a>
                            </li>
                        </ul> 
                    {else}
                        {* Utilisateur connecté *}
                        <ul class="navbar-nav">   
                            <li class="nav-item"> 
                                <a class="nav-link" href="edit_account.php" title="Modifier mon compte" aria-label="Modifier mon compte">
                                    <img src="{$smarty.session.user.user_image}"
                                        class="rounded-circle flex-shrink-0 mt-2 ml-5"
                                        style="width: 36px; height: 36px; object-fit: cover;"
                                        alt="Photo de profil">
                                </a>
                            </li>

                            <li class="nav-item"> 
                                <a class="nav-link" href="index.php?ctrl=user&action=logout" title="Se déconnecter" aria-label="Se déconnecter">
                                    Logout
                                </a>
                            </li>
                        </ul>
                    {/if}
                </nav>
            </div>
        </div>
    </nav>
</body>
</html>
