From 3649bb93000c8f417d98cecc277c4da1dd9690e6 Mon Sep 17 00:00:00 2001 From: kang Date: Mon, 25 May 2026 14:54:31 +0800 Subject: [PATCH] feat: implement initial language resolution for SSR and local storage support - Added a function to determine the initial language based on server-side rendering and local storage. - Updated i18n initialization to use the resolved initial language instead of the default. --- src/app/(player)/layout.tsx | 4 ++- src/app/layout.tsx | 5 +++ src/components/layout/player-app-shell.tsx | 2 +- src/components/layout/player-bottom-nav.tsx | 8 +++-- .../layout/player-mobile-viewport.tsx | 31 +++++++++++++++++++ src/features/hall/hall-betting-grid.tsx | 2 +- src/i18n/index.ts | 16 ++++++++-- src/lib/player-viewport.ts | 9 ++++++ 8 files changed, 70 insertions(+), 7 deletions(-) create mode 100644 src/components/layout/player-mobile-viewport.tsx create mode 100644 src/lib/player-viewport.ts diff --git a/src/app/(player)/layout.tsx b/src/app/(player)/layout.tsx index 5fd7b57..e9b6a87 100644 --- a/src/app/(player)/layout.tsx +++ b/src/app/(player)/layout.tsx @@ -1,7 +1,9 @@ +import { PlayerMobileViewport } from "@/components/layout/player-mobile-viewport"; + export default function PlayerRootLayout({ children, }: Readonly<{ children: React.ReactNode; }>) { - return children; + return {children}; } diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 4c55015..cd009bc 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -20,6 +20,11 @@ export const metadata: Metadata = { description: "Lottery player", }; +export const viewport = { + width: "device-width", + initialScale: 1, +}; + export default function RootLayout({ children, }: Readonly<{ diff --git a/src/components/layout/player-app-shell.tsx b/src/components/layout/player-app-shell.tsx index 47f81fe..0d7b427 100644 --- a/src/components/layout/player-app-shell.tsx +++ b/src/components/layout/player-app-shell.tsx @@ -20,7 +20,7 @@ export function PlayerAppShell({ children }: PlayerAppShellProps): ReactNode { return (
-
+
{children}
diff --git a/src/components/layout/player-bottom-nav.tsx b/src/components/layout/player-bottom-nav.tsx index 12adfa5..3fd7fa5 100644 --- a/src/components/layout/player-bottom-nav.tsx +++ b/src/components/layout/player-bottom-nav.tsx @@ -6,6 +6,7 @@ import { usePathname } from "next/navigation"; import { BarChart3, ClipboardList, Home, Wallet } from "lucide-react"; import { useTranslation } from "react-i18next"; +import { playerViewportFixedBarClass } from "@/lib/player-viewport"; import { cn } from "@/lib/utils"; const tabs = [ @@ -48,10 +49,13 @@ export function PlayerBottomNav() { return (