fix(auth): hide email option in other sign-in dialog

This commit is contained in:
2026-06-17 17:07:53 +08:00
parent b34533b242
commit d074f1a813
4 changed files with 5 additions and 29 deletions
@@ -112,9 +112,6 @@ export function AuthEmailPanel({
setShowOptions(false);
onGoogle?.();
}}
onEmail={() => {
// 在 email 模式下不再显示 Email 入口
}}
googleSlot={googleSlot}
/>
</div>
@@ -11,7 +11,6 @@
* `AuthGoogleLoginSubmitted` 事件,状态机内部调 next-auth/react 的 signIn(provider)
* - busy / error 状态来自 `useAuthState()`(与邮箱登录同源)
* - "Other Sign-in Options" 链接打开底部弹层
* - 弹层 Email 按钮 → 触发 `onSwitchToEmail`(父级派发 `AuthPanelModeChanged`
*/
import Image from "next/image";
import { useState } from "react";
@@ -24,11 +23,7 @@ import { AuthOtherOptionsDialog } from "./auth-other-options-dialog";
import { AuthProviderIcon } from "./auth-provider-icon";
import styles from "./auth-facebook-panel.module.css";
export interface AuthFacebookPanelProps {
onSwitchToEmail: () => void;
}
export function AuthFacebookPanel({ onSwitchToEmail }: AuthFacebookPanelProps) {
export function AuthFacebookPanel() {
const [showOptions, setShowOptions] = useState(false);
const { isLoading, errorMessage } = useAuthState();
const authDispatch = useAuthDispatch();
@@ -98,7 +93,6 @@ export function AuthFacebookPanel({ onSwitchToEmail }: AuthFacebookPanelProps) {
mode="facebook"
onFacebook={() => handleFacebook()}
onGoogle={() => handleGoogle()}
onEmail={onSwitchToEmail}
/>
</div>
);
@@ -9,12 +9,11 @@
* - 固定底部、宽 100%(≤500px)、顶部圆角 28px
* - drag handle 40×4 灰胶囊
* - 标题 "Other Sign-in Options" 24px bold 深色
* - 条件渲染 Email / Facebook 按钮(40px 白胶囊 + 边框 + 图标)
* - email 模式下渲染 Facebook 按钮(40px 白胶囊 + 边框 + 图标)
* - 始终渲染 Google 按钮
* - Cancel 文本按钮
*/
import type { ReactNode } from "react";
import { Mail } from "lucide-react";
import { BottomSheet } from "@/app/_components/core/bottom-sheet";
@@ -27,7 +26,6 @@ export interface AuthOtherOptionsDialogProps {
onClose: () => void;
onFacebook: () => void;
onGoogle: () => void;
onEmail: () => void;
/** 当前面板模式:facebook 模式下显示 Email + Googleemail 模式下显示 Facebook + Google。 */
mode: "facebook" | "email";
/** 自定义子节点(如嵌入 GIS 按钮) */
@@ -39,7 +37,6 @@ export function AuthOtherOptionsDialog({
onClose,
onFacebook,
onGoogle,
onEmail,
mode,
googleSlot,
}: AuthOtherOptionsDialogProps) {
@@ -53,17 +50,7 @@ export function AuthOtherOptionsDialog({
<div className={styles.handle} aria-hidden="true" />
<h2 className={styles.title}>Other Sign-in Options</h2>
{mode === "facebook" ? (
<AuthSocialButton
icon={<Mail size={20} aria-hidden="true" />}
onClick={() => {
onClose();
onEmail();
}}
>
Email Sign In / Register
</AuthSocialButton>
) : (
{mode === "email" ? (
<AuthSocialButton
icon={<AuthProviderIcon provider="facebook" />}
onClick={() => {
@@ -73,7 +60,7 @@ export function AuthOtherOptionsDialog({
>
Facebook Sign In
</AuthSocialButton>
)}
) : null}
{googleSlot ? (
<div className={styles.googleSlot}>{googleSlot}</div>
+1 -3
View File
@@ -16,8 +16,6 @@ export function AuthPanel() {
const dispatch = useAuthDispatch();
const router = useRouter();
const switchToEmail = () =>
dispatch({ type: "AuthPanelModeChanged", mode: "email" });
const switchToFacebook = () =>
dispatch({ type: "AuthPanelModeChanged", mode: "facebook" });
@@ -41,7 +39,7 @@ export function AuthPanel() {
</button>
{state.authPanelMode === "facebook" ? (
<AuthFacebookPanel onSwitchToEmail={switchToEmail} />
<AuthFacebookPanel />
) : (
<AuthEmailPanel
onSwitchToFacebook={() => {