mirror of https://github.com/msgbyte/tailchat
refactor: 抽象与整理部分聊天代码
parent
41afc64cce
commit
3757c7804f
@ -1,15 +1,14 @@
|
||||
import React from 'react';
|
||||
import {
|
||||
VirtualizedMessageList,
|
||||
VirtualizedMessageListProps,
|
||||
} from './VirtualizedList';
|
||||
import type { MessageListProps } from './types';
|
||||
import { VirtualizedMessageList } from './VirtualizedList';
|
||||
|
||||
export const ChatMessageList: React.FC<VirtualizedMessageListProps> =
|
||||
React.memo((props) => {
|
||||
export const ChatMessageList: React.FC<MessageListProps> = React.memo(
|
||||
(props) => {
|
||||
return (
|
||||
<div className="flex-1">
|
||||
<VirtualizedMessageList {...props} />
|
||||
</div>
|
||||
);
|
||||
});
|
||||
}
|
||||
);
|
||||
ChatMessageList.displayName = 'ChatMessageList';
|
||||
|
@ -0,0 +1,9 @@
|
||||
import type { ChatMessage } from 'tailchat-shared';
|
||||
|
||||
export interface MessageListProps {
|
||||
messages: ChatMessage[];
|
||||
isLoadingMore: boolean;
|
||||
hasMoreMessage: boolean;
|
||||
onUpdateReadedMessage: (lastMessageId: string) => void;
|
||||
onLoadMore: () => void;
|
||||
}
|
Loading…
Reference in New Issue