feat(chat): implement pull-to-refresh functionality and pagination for chat history

This commit is contained in:
2026-07-15 18:19:35 +08:00
parent 05ca15be48
commit c37a2f9040
21 changed files with 892 additions and 66 deletions
+10 -1
View File
@@ -5,7 +5,10 @@ import Image from "next/image";
import { useRouter, useSearchParams } from "next/navigation";
import { useAuthDispatch, useAuthState } from "@/stores/auth/auth-context";
import { useChatState } from "@/stores/chat/chat-context";
import {
useChatDispatch,
useChatState,
} from "@/stores/chat/chat-context";
import { ROUTES } from "@/router/routes";
import { MobileShell } from "@/app/_components/core";
@@ -45,6 +48,7 @@ export function ChatScreen() {
const router = useRouter();
const searchParams = useSearchParams();
const state = useChatState();
const chatDispatch = useChatDispatch();
const authState = useAuthState();
const authDispatch = useAuthDispatch();
useSplashLatestMessageSync({
@@ -232,12 +236,17 @@ export function ChatScreen() {
initialScrollReady={
state.historyLoaded && isPromotionBootstrapReady
}
canLoadMoreHistory={state.hasMoreHistory}
isLoadingMoreHistory={state.isLoadingMoreHistory}
isUnlockingMessage={state.isUnlockingMessage}
unlockingMessageId={state.unlockingMessageId}
onUnlockPrivateMessage={handleUnlockPrivateMessage}
onUnlockVoiceMessage={handleUnlockVoiceMessage}
onUnlockImageMessage={handleUnlockImageMessage}
onOpenImage={handleOpenImage}
onLoadMoreHistory={() => {
chatDispatch({ type: "ChatLoadMoreHistoryRequested" });
}}
/>
{messageLimitBanner.visible ? (