<?php
// Barra de navegación compartida (hub, panel, admin, wiki). Requiere init.php cargado.
$__u = is_logged_in() ? current_user() : null;
?>
<nav class="nav"><div class="in">
  <a class="brand" href="<?= e(BASE) ?>/"><span class="logo">🎰</span><span><b>infinity3113</b><small data-i18n="brandSub">Minecraft Plugins</small></span></a>
  <div class="navlinks">
    <a href="<?= e(BASE) ?>/" data-i18n="navHubPlugins">Plugins</a>
    <?php if ($__u): ?>
      <a href="<?= e(BASE) ?>/panel/" data-i18n="navMyPanel">Mi panel</a>
      <?php if (is_admin()): ?><a href="<?= e(BASE) ?>/admin/">Admin</a><?php endif; ?>
    <?php endif; ?>
  </div>
  <div class="langsw" role="group" aria-label="Idioma">
    <button type="button" data-lang="en">EN</button><button type="button" data-lang="fr">FR</button><button type="button" data-lang="zh">中文</button><button type="button" data-lang="es">ES</button>
  </div>
  <?php if ($__u): ?>
    <span class="uchip"><span class="ava"><?= e(initials($__u['username'])) ?></span><span class="unm"><?= e($__u['username']) ?></span><?php if ($__u['role']==='admin'): ?><span class="badge b-admin">Admin</span><?php endif; ?></span>
    <a href="<?= e(BASE) ?>/logout.php" class="btn ghost sm" data-i18n="navLogout">Salir</a>
  <?php else: ?>
    <a href="<?= e(BASE) ?>/login.php" class="btn ghost sm" data-i18n="navLogin">Entrar</a>
    <a href="<?= e(BASE) ?>/register.php" class="btn primary sm" data-i18n="navRegister">Crear cuenta</a>
  <?php endif; ?>
</div></nav>
