feat(chat): implement pull-to-refresh functionality and pagination for chat history
This commit is contained in:
@@ -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 ? (
|
||||
|
||||
Reference in New Issue
Block a user