refactor(app): tighten chat and sync boundaries

This commit is contained in:
2026-07-01 14:03:25 +08:00
parent f6e7adbe96
commit 760e4fe343
19 changed files with 215 additions and 677 deletions
-1
View File
@@ -2,7 +2,6 @@
* @file Automatically generated by barrelsby.
*/
export * from "./chat-auth-sync";
export * from "./chat-context";
export * from "./chat-events";
export * from "./chat-machine.actors";
-1
View File
@@ -6,5 +6,4 @@ export * from "./payment-context";
export * from "./payment-events";
export * from "./payment-machine";
export * from "./payment-machine.actors";
export * from "./payment-success-sync";
export * from "./payment-state";
@@ -12,10 +12,9 @@ import { usePathname, useRouter } from "next/navigation";
import { AuthStorage } from "@/data/storage/auth";
import { useAuthState } from "@/stores/auth/auth-context";
import { useChatDispatch } from "@/stores/chat/chat-context";
import { PROTECTED_ROUTES, ROUTES, type StaticRoute } from "@/router/routes";
import { useChatDispatch } from "./chat-context";
function isProtectedPath(pathname: string): boolean {
return PROTECTED_ROUTES.some((route: StaticRoute) => pathname === route);
}
+3
View File
@@ -0,0 +1,3 @@
export * from "./chat-auth-sync";
export * from "./payment-success-sync";
export * from "./user-auth-sync";
@@ -12,8 +12,7 @@ import { useEffect, useRef } from "react";
import { useChatDispatch } from "@/stores/chat/chat-context";
import { useUserDispatch } from "@/stores/user/user-context";
import { hasPendingChatUnlock } from "@/lib/navigation/chat_unlock_session";
import { usePaymentState } from "./payment-context";
import { usePaymentState } from "@/stores/payment/payment-context";
export function PaymentSuccessSync() {
const paymentState = usePaymentState();
@@ -12,8 +12,7 @@ import { useEffect, useRef } from "react";
import type { LoginStatus } from "@/data/dto/auth";
import { useAuthState } from "@/stores/auth/auth-context";
import { useUserDispatch } from "./user-context";
import { useUserDispatch } from "@/stores/user/user-context";
export function UserAuthSync() {
const { hasInitialized, isLoading, loginStatus } = useAuthState();
-1
View File
@@ -2,7 +2,6 @@
* @file Automatically generated by barrelsby.
*/
export * from "./user-auth-sync";
export * from "./user-context";
export * from "./user-events";
export * from "./user-machine.actors";