<?php

declare(strict_types=1);

/**
 * BLOG 頁頂部導覽列（與首頁 topbar 一致）。
 *
 * @var array{id:int,username:string,display_name:string,avatar_rel:string}|null $fatePublicMember
 * @var bool $fateAdminNavVisible
 * @var bool $fateForumNavVisible
 * @var bool $fateBlogNavVisible
 * @var string $fateBlogNavLabel
 */

if (!isset($fateBlogNavLabel) || $fateBlogNavLabel === '') {
    $fateBlogNavLabel = fate_blog_nav_label();
}
?>
<header class="topbar">
    <div class="topbar-inner">
        <a class="brand" href="./"><?= htmlspecialchars($fateBrand['title_main'], ENT_QUOTES, 'UTF-8') ?> <span><?= htmlspecialchars($fateBrand['title_sub'], ENT_QUOTES, 'UTF-8') ?></span></a>
        <nav>
            <a href="./">探索列表</a>
            <?php if (!empty($fateBlogNavVisible)): ?>
                <a href="blog.php" class="is-active"><?= htmlspecialchars($fateBlogNavLabel, ENT_QUOTES, 'UTF-8') ?></a>
            <?php endif; ?>
            <?php if (!empty($fateForumNavVisible)): ?>
                <a href="forum/">討論區</a>
            <?php endif; ?>
            <?php
            if (!function_exists('fate_masseur_weekly_recommend_enabled')) {
                require_once dirname(__DIR__, 3) . '/includes/fate_masseur_rewards.php';
            }
            if (fate_masseur_weekly_recommend_enabled()):
            ?>
                <a href="masseur_weekly.php">週推榜</a>
            <?php endif; ?>
            <?php if ($fatePublicMember !== null): ?>
                <a href="member_profile.php">我的帳號</a>
                <a href="logout.php">登出</a>
            <?php else: ?>
                <a href="login.php?next=<?= rawurlencode('blog.php') ?>">登入</a>
                <a href="register.php">註冊</a>
            <?php endif; ?>
            <?php if (!empty($fateAdminNavVisible)): ?>
                <a href="admin/">管理後台</a>
            <?php endif; ?>
        </nav>
    </div>
</header>
