98 lines
4.2 KiB
TypeScript
98 lines
4.2 KiB
TypeScript
import { getTranslations } from "next-intl/server";
|
|
import Link from "next/link";
|
|
import { auth } from "@/lib/auth";
|
|
import { LanguageSwitcher } from "@/components/language-switcher";
|
|
import { ThemeSwitcher } from "@/components/theme-switcher";
|
|
|
|
export async function Navigation() {
|
|
const session = await auth();
|
|
const t = await getTranslations("nav");
|
|
const isStaff = (session?.user?.rank ?? 0) >= 7;
|
|
|
|
return (
|
|
<nav className="relative shadow-sm" style={{ backgroundColor: "var(--color-navbar)" }}>
|
|
<div className="mx-auto flex min-h-[60px] max-w-7xl flex-wrap items-center px-4 gap-x-1 md:gap-x-2">
|
|
<Link href="/" className="nav-item">
|
|
<img src="/assets/images/icons/navigation/me.png" alt="" className="mr-1 hidden w-5 h-5 lg:inline-block" />
|
|
{t("home")}
|
|
</Link>
|
|
|
|
<details className="relative">
|
|
<summary className="nav-item list-none cursor-pointer [&::-webkit-details-marker]:hidden">
|
|
<img src="/assets/images/icons/navigation/community.png" alt="" className="mr-1 hidden w-5 h-5 lg:inline-block" />
|
|
{t("community")}
|
|
</summary>
|
|
<div
|
|
className="absolute left-0 mt-1 min-w-[190px] rounded-md shadow-lg z-50 py-1"
|
|
style={{ backgroundColor: "var(--color-dropdown)" }}
|
|
>
|
|
<Link href="/news" className="dropdown-item">{t("articles")}</Link>
|
|
<Link href="/photos" className="dropdown-item">{t("photos")}</Link>
|
|
<Link href="/staff" className="dropdown-item">{t("staff")}</Link>
|
|
<Link href="/rankings" className="dropdown-item">{t("rankings")}</Link>
|
|
<Link href="/guilds" className="dropdown-item">{t("guilds")}</Link>
|
|
</div>
|
|
</details>
|
|
|
|
<details className="relative">
|
|
<summary className="nav-item list-none cursor-pointer [&::-webkit-details-marker]:hidden">
|
|
<img src="/assets/images/icons/navigation/shop.png" alt="" className="mr-1 hidden w-5 h-5 lg:inline-block" />
|
|
{t("shop")}
|
|
</summary>
|
|
<div
|
|
className="absolute left-0 mt-1 min-w-[190px] rounded-md shadow-lg z-50 py-1"
|
|
style={{ backgroundColor: "var(--color-dropdown)" }}
|
|
>
|
|
<Link href="/shop" className="dropdown-item">{t("shop")}</Link>
|
|
<Link href="/marketplace" className="dropdown-item">{t("market")}</Link>
|
|
<Link href="/rares" className="dropdown-item">{t("rareValues")}</Link>
|
|
</div>
|
|
</details>
|
|
|
|
<Link href="/leaderboard" className="nav-item">
|
|
<img src="/assets/images/icons/navigation/leaderboards.png" alt="" className="mr-1 hidden w-5 h-5 lg:inline-block" />
|
|
{t("leaderboards")}
|
|
</Link>
|
|
|
|
<Link href="/radio" className="nav-item">
|
|
{t("radio")}
|
|
</Link>
|
|
|
|
<details className="relative">
|
|
<summary className="nav-item list-none cursor-pointer [&::-webkit-details-marker]:hidden">
|
|
<img src="/assets/images/icons/navigation/rules.gif" alt="" className="mr-1 hidden w-5 h-5 lg:inline-block" />
|
|
{t("assistance")}
|
|
</summary>
|
|
<div
|
|
className="absolute left-0 mt-1 min-w-[190px] rounded-md shadow-lg z-50 py-1"
|
|
style={{ backgroundColor: "var(--color-dropdown)" }}
|
|
>
|
|
<Link href="/help" className="dropdown-item">{t("helpCenter")}</Link>
|
|
{session?.user ? (
|
|
<Link href="/help/tickets" className="dropdown-item">{t("myTickets")}</Link>
|
|
) : null}
|
|
<Link href="/badges" className="dropdown-item">{t("badges")}</Link>
|
|
<Link href="/draw-badge" className="dropdown-item">{t("drawBadge")}</Link>
|
|
</div>
|
|
</details>
|
|
|
|
{session?.user ? (
|
|
<>
|
|
<Link href="/friends" className="nav-item">{t("friends")}</Link>
|
|
<Link href="/messages" className="nav-item">{t("messages")}</Link>
|
|
</>
|
|
) : null}
|
|
|
|
{isStaff ? (
|
|
<Link href="/admin" className="nav-item">{t("admin")}</Link>
|
|
) : null}
|
|
|
|
<div className="ml-auto flex items-center gap-x-2">
|
|
<LanguageSwitcher />
|
|
<ThemeSwitcher />
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
);
|
|
}
|