Add i18n support for import page and translations tabs
Local Build and Deploy / deploy (push) Successful in 1m7s
Local Build and Deploy / deploy (push) Successful in 1m7s
This commit is contained in:
1 parent
574a499e14
commit
5ae29e2a58
3 files changed
+55
-24
No files matched your search
@@ -1,28 +1,30 @@
|
||||
"use client";
|
||||
|
||||
import { useTranslations } from "next-intl";
|
||||
import { Gamepad2, Globe, Server } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import { usePathname } from "next/navigation";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const TABS = [
|
||||
{ href: "/admin/translations/cms", label: "CMS", icon: Globe },
|
||||
{ href: "/admin/translations/client", label: "Client (Nitro)", icon: Gamepad2 },
|
||||
{ href: "/admin/translations/emulator", label: "Emulator", icon: Server },
|
||||
] as const;
|
||||
|
||||
export function TranslationsTabs() {
|
||||
const t = useTranslations("pages.admin.translations.tabs");
|
||||
const pathname = usePathname();
|
||||
|
||||
const TABS = [
|
||||
{ href: "/admin/translations/cms", label: t("cms"), icon: Globe },
|
||||
{ href: "/admin/translations/client", label: t("client"), icon: Gamepad2 },
|
||||
{ href: "/admin/translations/emulator", label: t("emulator"), icon: Server },
|
||||
] as const;
|
||||
|
||||
return (
|
||||
<div className="flex gap-1 border-b">
|
||||
{TABS.map((t) => {
|
||||
const active = pathname === t.href || pathname.startsWith(`${t.href}/`);
|
||||
const Icon = t.icon;
|
||||
{TABS.map((tab) => {
|
||||
const active = pathname === tab.href || pathname.startsWith(`${tab.href}/`);
|
||||
const Icon = tab.icon;
|
||||
return (
|
||||
<Link
|
||||
key={t.href}
|
||||
href={t.href}
|
||||
key={tab.href}
|
||||
href={tab.href}
|
||||
className={cn(
|
||||
"-mb-px flex items-center gap-2 border-b-2 px-4 py-2 text-sm font-medium transition-colors",
|
||||
active
|
||||
@@ -31,7 +33,7 @@ export function TranslationsTabs() {
|
||||
)}
|
||||
>
|
||||
<Icon className="h-4 w-4" />
|
||||
{t.label}
|
||||
{tab.label}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
|
||||
Reference in new issue
Block a user