forked from UKSOURCE/ipv6
Fix basepath ipv6, fix sponsor.
This commit is contained in:
@@ -20,9 +20,14 @@ export default function HeaderClient({
|
||||
const { lang, setLang } = useLanguage();
|
||||
const { site } = useTranslation();
|
||||
|
||||
const isHome = pathname === "/";
|
||||
const isHome = pathname === "/" || pathname === "/ipv6" || pathname === "/ipv6/";
|
||||
const navItems = useMemo(() => site.nav.filter((x) => x.href !== "/"), [site.nav]);
|
||||
|
||||
const isActive = (href: string) => {
|
||||
if (href === "/") return isHome;
|
||||
return pathname === href || pathname === `/ipv6${href}` || pathname?.startsWith(`${href}/`) || pathname?.startsWith(`/ipv6${href}/`);
|
||||
};
|
||||
|
||||
const registerLabel = lang === "vi" ? "Đăng Ký" : "Register";
|
||||
const registerNowLabel = lang === "vi" ? "Đăng Ký Ngay" : "Register Now";
|
||||
const backLabel = lang === "vi" ? "Trang Chủ" : "Home";
|
||||
@@ -56,7 +61,7 @@ export default function HeaderClient({
|
||||
{backLabel}
|
||||
</Link>
|
||||
{navItems.map((item) => {
|
||||
const active = pathname === item.href;
|
||||
const active = isActive(item.href);
|
||||
return (
|
||||
<Link
|
||||
key={item.href}
|
||||
@@ -157,7 +162,7 @@ export default function HeaderClient({
|
||||
{backLabel}
|
||||
</Link>
|
||||
{navItems.map((item) => {
|
||||
const active = pathname === item.href;
|
||||
const active = isActive(item.href);
|
||||
return (
|
||||
<Link
|
||||
key={item.href}
|
||||
|
||||
Reference in New Issue
Block a user