feat: 添加货币管理功能,更新国际化支持,移除报表相关代码
This commit is contained in:
@@ -5,41 +5,26 @@ import { usePathname } from "next/navigation";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const LINKS: { href: string; key: string; match?: "exact" | "prefix" }[] = [
|
||||
{ href: "/admin/config/plays", key: "plays" },
|
||||
{ href: "/admin/config/odds", key: "odds" },
|
||||
{ href: "/admin/config/rebate", key: "rebate" },
|
||||
{ href: "/admin/config/risk-cap", key: "risk-cap" },
|
||||
];
|
||||
|
||||
function linkActive(pathname: string, href: string, match: "exact" | "prefix"): boolean {
|
||||
if (match === "exact") {
|
||||
return pathname === href || pathname === `${href}/`;
|
||||
}
|
||||
return pathname === href || pathname.startsWith(`${href}/`);
|
||||
}
|
||||
import { CONFIG_NAV_GROUPS } from "@/modules/config/config-nav-model";
|
||||
|
||||
export function ConfigSubNav() {
|
||||
const { t } = useTranslation("config");
|
||||
const pathname = usePathname();
|
||||
const links = CONFIG_NAV_GROUPS.flatMap((group) => group.items);
|
||||
|
||||
return (
|
||||
<nav
|
||||
className="flex flex-wrap gap-2 border-b border-border pb-3 mb-6"
|
||||
aria-label={t("nav.aria")}
|
||||
>
|
||||
{LINKS.map(({ href, key, match = "prefix" }) => {
|
||||
const active = linkActive(pathname, href, match);
|
||||
<nav className="flex w-full flex-wrap items-end gap-1 border-b border-border/60 px-1" aria-label={t("nav.aria")}>
|
||||
{links.map(({ href, key }) => {
|
||||
const active = pathname === href || pathname.startsWith(`${href}/`);
|
||||
return (
|
||||
<Link
|
||||
key={href}
|
||||
href={href}
|
||||
className={cn(
|
||||
"rounded-md px-3 py-1.5 text-sm transition-colors",
|
||||
"border-b-2 px-4 py-3 text-sm font-medium transition-colors",
|
||||
active
|
||||
? "bg-primary text-primary-foreground"
|
||||
: "bg-muted/60 text-muted-foreground hover:bg-muted hover:text-foreground",
|
||||
? "border-primary text-primary"
|
||||
: "border-transparent text-muted-foreground hover:border-border/80 hover:text-foreground",
|
||||
)}
|
||||
>
|
||||
{t(`nav.items.${key}`)}
|
||||
|
||||
Reference in New Issue
Block a user