From 61a7786b0acd09a9515abbbfff582e00122485fe Mon Sep 17 00:00:00 2001 From: qikongjian Date: Fri, 19 Sep 2025 18:07:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=B3=A8=E5=86=8C=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=93=8D=E5=BA=94=E5=BC=8F=E8=AE=BE=E8=AE=A1=E5=92=8C?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/signup/page.tsx | 250 ++++++++++++++++++++++---- components/ui/google-login-button.tsx | 169 +++++++++++++++++ docs/height-responsive-ux-analysis.md | 152 ++++++++++++++++ 3 files changed, 541 insertions(+), 30 deletions(-) create mode 100644 components/ui/google-login-button.tsx create mode 100644 docs/height-responsive-ux-analysis.md diff --git a/app/signup/page.tsx b/app/signup/page.tsx index f36f14c..6e1e195 100644 --- a/app/signup/page.tsx +++ b/app/signup/page.tsx @@ -5,6 +5,7 @@ import { useRouter } from "next/navigation"; import Link from "next/link"; import { signInWithGoogle, registerUser, sendVerificationLink } from "@/lib/auth"; import { GradientText } from "@/components/ui/gradient-text"; +import { GoogleLoginButton } from "@/components/ui/google-login-button"; import { Eye, EyeOff, Mail } from "lucide-react"; export default function SignupPage() { @@ -25,8 +26,38 @@ export default function SignupPage() { const [resendLoading, setResendLoading] = useState(false); const [resendMessage, setResendMessage] = useState(""); const [resendError, setResendError] = useState(""); + const [googleLoading, setGoogleLoading] = useState(false); const router = useRouter(); + // Handle scroll indicator for small screens + React.useEffect(() => { + const handleScroll = () => { + const scrollableElement = document.querySelector('.signup-form > div:nth-child(2)'); + const formElement = document.querySelector('.signup-form'); + if (scrollableElement && formElement) { + const hasScroll = scrollableElement.scrollHeight > scrollableElement.clientHeight; + const isScrolledToBottom = scrollableElement.scrollTop + scrollableElement.clientHeight >= scrollableElement.scrollHeight - 10; + + if (hasScroll && !isScrolledToBottom) { + formElement.classList.add('has-scroll'); + } else { + formElement.classList.remove('has-scroll'); + } + } + }; + + const scrollableElement = document.querySelector('.signup-form > div:nth-child(2)'); + if (scrollableElement) { + scrollableElement.addEventListener('scroll', handleScroll); + // Check initially + handleScroll(); + + return () => { + scrollableElement.removeEventListener('scroll', handleScroll); + }; + } + }, []); + /** Password validation function with English prompts */ const validatePassword = (password: string): string => { if (password.length < 8) { @@ -137,6 +168,19 @@ export default function SignupPage() { } }; + const handleGoogleSignIn = () => { + try { + setGoogleLoading(true); + setFormError(""); + // signInWithGoogle redirects to Google OAuth, so we don't need await + signInWithGoogle(); + } catch (error: any) { + console.error("Google sign-in error:", error); + setFormError(error.message || "Google sign-in failed, please try again"); + setGoogleLoading(false); + } + }; + const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); @@ -185,6 +229,148 @@ export default function SignupPage() { return ( <>
+ {/* Height-responsive container styles */} + {/* 背景视频 */}
@@ -222,18 +408,21 @@ export default function SignupPage() { - {/* 注册框 - 居中显示 */} -
-
-
+ {/* 注册框 - 响应式高度显示 */} +
+
+ {/* Fixed Header */} +

Sign Up, for free

Create your account to get started

-
-
+ {/* Scrollable Middle Content */} +
+ +
@@ -246,7 +435,7 @@ export default function SignupPage() { className="w-full px-4 py-3 rounded-lg bg-black/30 border border-white/20 text-white placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-purple-500 focus:border-transparent" />
-
+
@@ -260,7 +449,7 @@ export default function SignupPage() { />
-
+
@@ -285,8 +474,8 @@ export default function SignupPage() {
-
-