From 9430bee86fbf943283eb5a6f63bd750b875ff433 Mon Sep 17 00:00:00 2001 From: 苏向夜 Date: Fri, 23 Jan 2026 20:51:28 +0800 Subject: feat(ui): add new ui project --- packages/ui-new/src/components/login-modal.tsx | 156 +++++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 packages/ui-new/src/components/login-modal.tsx (limited to 'packages/ui-new/src/components/login-modal.tsx') diff --git a/packages/ui-new/src/components/login-modal.tsx b/packages/ui-new/src/components/login-modal.tsx new file mode 100644 index 0000000..9152494 --- /dev/null +++ b/packages/ui-new/src/components/login-modal.tsx @@ -0,0 +1,156 @@ +import { Mail, User } from "lucide-react"; +import { useAuthStore } from "@/stores/auth-store"; + +export function LoginModal() { + const authStore = useAuthStore(); + + const handleOfflineLogin = () => { + if (authStore.offlineUsername.trim()) { + authStore.performOfflineLogin(); + } + }; + + const handleKeyPress = (e: React.KeyboardEvent) => { + if (e.key === "Enter") { + handleOfflineLogin(); + } + }; + + if (!authStore.isLoginModalOpen) return null; + + return ( +
+
+
+ {/* Header */} +
+

Login

+ +
+ + {/* Content based on mode */} + {authStore.loginMode === "select" && ( +
+

+ Choose your preferred login method +

+ + +
+ )} + + {authStore.loginMode === "offline" && ( +
+
+ + authStore.setOfflineUsername(e.target.value)} + onKeyDown={handleKeyPress} + className="w-full px-4 py-2.5 bg-zinc-800 border border-zinc-700 rounded-lg text-white placeholder:text-zinc-500 focus:outline-none focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 transition-colors" + placeholder="Enter your Minecraft username" + /> +
+
+ + +
+
+ )} + + {authStore.loginMode === "microsoft" && ( +
+ {authStore.deviceCodeData && ( +
+
+
+ {authStore.deviceCodeData.userCode} +
+

+ Your verification code +

+
+

+ Visit{" "} + + {authStore.deviceCodeData.verificationUri} + {" "} + and enter the code above +

+
+ )} +
+

+ {authStore.msLoginStatus} +

+ +
+
+ )} +
+
+
+ ); +} -- cgit v1.2.3-70-g09d2