diff --git a/src/pages/ChatPage.tsx b/src/pages/ChatPage.tsx index 7ddc602..1ac6de8 100644 --- a/src/pages/ChatPage.tsx +++ b/src/pages/ChatPage.tsx @@ -10,12 +10,19 @@ type MessageItem = { isDeleted?: boolean } +type PageInfo = { + nextExpectedSeq?: number + highestCommittedSeq?: number + hasMore?: boolean +} + export default function ChatPage() { const [searchParams, setSearchParams] = useSearchParams() const guildId = searchParams.get('guildId') ?? '' const [channelId, setChannelId] = useState(() => searchParams.get('channelId') ?? '') const [content, setContent] = useState('') const [messages, setMessages] = useState([]) + const [pageInfo, setPageInfo] = useState(null) const [socketState, setSocketState] = useState<'offline' | 'online'>('offline') const [seqFrom, setSeqFrom] = useState('1') const [seqTo, setSeqTo] = useState('999999') @@ -55,6 +62,7 @@ export default function ChatPage() { }, }) setMessages(res.data.items ?? []) + setPageInfo(res.data.page ?? null) } async function sendMessage() { @@ -133,6 +141,12 @@ export default function ChatPage() { ))} + {pageInfo ? ( +

+ next_expected_seq: {pageInfo.nextExpectedSeq ?? '-'} | highest_committed_seq:{' '} + {pageInfo.highestCommittedSeq ?? '-'} | has_more: {String(pageInfo.hasMore ?? false)} +

+ ) : null} ) }