From fbe385666a1fb4af942bb97499227991a71af75d Mon Sep 17 00:00:00 2001 From: kang Date: Tue, 26 May 2026 09:57:05 +0800 Subject: [PATCH] feat(admin): enhance login form with language switcher and update script handling - Added AdminLanguageSwitcher to the login form for improved language selection. - Replaced inline script with next/script component for better performance and safety in layout.tsx. - Updated language initialization logic to ensure consistent SSR and client rendering. --- src/app/layout.tsx | 5 ++++- src/components/admin/login-form.tsx | 4 ++++ src/i18n/index.ts | 14 +++----------- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 78707c2..0b9c52e 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,5 +1,6 @@ import type { Metadata } from "next"; import { Geist, Geist_Mono } from "next/font/google"; +import Script from "next/script"; import { Providers } from "@/components/providers"; import "./globals.css"; @@ -37,7 +38,9 @@ export default function RootLayout({ className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`} > - {children} diff --git a/src/components/admin/login-form.tsx b/src/components/admin/login-form.tsx index 890af37..0eeb4dd 100644 --- a/src/components/admin/login-form.tsx +++ b/src/components/admin/login-form.tsx @@ -8,6 +8,7 @@ import { toast } from "sonner"; import { isAxiosError } from "axios"; import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; +import { AdminLanguageSwitcher } from "@/components/admin/admin-language-switcher"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"; import { Input } from "@/components/ui/input"; @@ -121,6 +122,9 @@ export function LoginForm() { return (
+
+ +