- 在 package.json 和 package-lock.json 中新增 laravel-echo 和 pusher-js 依赖 - 在 API 模块中新增 draw 相关函数的导出 - 在 PlayerAppShell 组件中引入 PlayerBottomNav 以增强底部导航 - 在 HallScreen 组件中引入 HallDrawPanel 以展示当前期号
65 lines
1.9 KiB
TypeScript
65 lines
1.9 KiB
TypeScript
"use client";
|
||
|
||
import Link from "next/link";
|
||
import { usePathname } from "next/navigation";
|
||
|
||
import { LayoutGrid, Trophy, Wallet } from "lucide-react";
|
||
|
||
import { cn } from "@/lib/utils";
|
||
|
||
const tabs = [
|
||
{ href: "/hall", label: "大厅", icon: LayoutGrid, match: (p: string) => p === "/hall" },
|
||
{
|
||
href: "/wallet",
|
||
label: "钱包",
|
||
icon: Wallet,
|
||
match: (p: string) => p === "/wallet" || p.startsWith("/wallet/"),
|
||
},
|
||
{
|
||
href: "/results",
|
||
label: "开奖",
|
||
icon: Trophy,
|
||
match: (p: string) => p === "/results" || p.startsWith("/results/"),
|
||
},
|
||
] as const;
|
||
|
||
/**
|
||
* 移动端 H5 主导航:底部 Tab(界面文档 §1.1 以手机为主)。
|
||
*/
|
||
export function PlayerBottomNav() {
|
||
const pathname = usePathname() ?? "";
|
||
|
||
return (
|
||
<nav
|
||
className="fixed bottom-0 left-0 right-0 z-50 border-t border-border bg-background/95 pb-[env(safe-area-inset-bottom,0px)] backdrop-blur-md supports-[backdrop-filter]:bg-background/90"
|
||
aria-label="主导航"
|
||
>
|
||
<div className="mx-auto grid h-14 max-w-lg grid-cols-3">
|
||
{tabs.map(({ href, label, icon: Icon, match }) => {
|
||
const active = match(pathname);
|
||
return (
|
||
<Link
|
||
key={href}
|
||
href={href}
|
||
prefetch
|
||
aria-current={active ? "page" : undefined}
|
||
className={cn(
|
||
"flex flex-col items-center justify-center gap-0.5 text-[11px] font-medium transition-colors",
|
||
active
|
||
? "text-primary"
|
||
: "text-muted-foreground hover:text-foreground active:text-foreground",
|
||
)}
|
||
>
|
||
<Icon
|
||
aria-hidden
|
||
className={cn("size-[22px]", active && "stroke-[2.25px]")}
|
||
/>
|
||
{label}
|
||
</Link>
|
||
);
|
||
})}
|
||
</div>
|
||
</nav>
|
||
);
|
||
}
|