refactor(router): centralize app route transitions

This commit is contained in:
2026-07-03 14:15:52 +08:00
parent 91dde42f92
commit 873a0a8bce
10 changed files with 188 additions and 133 deletions
+3 -4
View File
@@ -2,9 +2,8 @@
/**
* 认证面板:顶层 switchFacebook / Email+ 悬浮返回按钮
*/
import { useRouter } from "next/navigation";
import { BackButton } from "@/app/_components";
import { useAppNavigator } from "@/router/use-app-navigator";
import { useAuthDispatch, useAuthState } from "@/stores/auth/auth-context";
import { AuthEmailPanel } from "./auth-email-panel";
@@ -14,7 +13,7 @@ import styles from "./auth-panel.module.css";
export function AuthPanel() {
const state = useAuthState();
const dispatch = useAuthDispatch();
const router = useRouter();
const navigator = useAppNavigator();
const switchToFacebook = () =>
dispatch({ type: "AuthPanelModeChanged", mode: "facebook" });
@@ -25,7 +24,7 @@ export function AuthPanel() {
if (state.authPanelMode === "email") {
switchToFacebook();
} else {
router.back();
navigator.back();
}
};