mirror of https://github.com/msgbyte/tailchat
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
814 B
TypeScript
29 lines
814 B
TypeScript
3 years ago
|
import { LoadingSpinner } from '@/components/LoadingSpinner';
|
||
4 years ago
|
import React from 'react';
|
||
3 years ago
|
import { useSingleUserSetting } from 'tailchat-shared';
|
||
4 years ago
|
import { NormalMessageList } from './NormalList';
|
||
4 years ago
|
import type { MessageListProps } from './types';
|
||
3 years ago
|
import { VirtualizedMessageList } from './VirtualizedList';
|
||
4 years ago
|
|
||
4 years ago
|
export const ChatMessageList: React.FC<MessageListProps> = React.memo(
|
||
|
(props) => {
|
||
3 years ago
|
const { value: useVirtualizedList, loading } = useSingleUserSetting(
|
||
|
'messageListVirtualization',
|
||
|
false
|
||
|
);
|
||
|
|
||
|
if (loading) {
|
||
|
return <LoadingSpinner />;
|
||
|
}
|
||
|
|
||
4 years ago
|
return useVirtualizedList ? (
|
||
4 years ago
|
<div className="flex-1">
|
||
4 years ago
|
<VirtualizedMessageList {...props} />
|
||
4 years ago
|
</div>
|
||
4 years ago
|
) : (
|
||
|
<NormalMessageList {...props} />
|
||
4 years ago
|
);
|
||
4 years ago
|
}
|
||
|
);
|
||
4 years ago
|
ChatMessageList.displayName = 'ChatMessageList';
|