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.
31 lines
836 B
TypeScript
31 lines
836 B
TypeScript
import { LoadingSpinner } from '@/components/LoadingSpinner';
|
|
import React from 'react';
|
|
import { useSingleUserSetting } from 'tailchat-shared';
|
|
import { NormalMessageList } from './NormalList';
|
|
import type { MessageListProps } from './types';
|
|
import { VirtualizedMessageList } from './VirtualizedList';
|
|
|
|
export const ChatMessageList: React.FC<MessageListProps> = React.memo(
|
|
(props) => {
|
|
const { value: useVirtualizedList, loading } = useSingleUserSetting(
|
|
'messageListVirtualization',
|
|
false
|
|
);
|
|
|
|
if (loading) {
|
|
return (
|
|
<div className="flex-1">
|
|
<LoadingSpinner />
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return useVirtualizedList ? (
|
|
<VirtualizedMessageList {...props} />
|
|
) : (
|
|
<NormalMessageList {...props} />
|
|
);
|
|
}
|
|
);
|
|
ChatMessageList.displayName = 'ChatMessageList';
|