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.
tailchat/web/src/components/Panel/group/TextPanel.tsx

34 lines
1.1 KiB
TypeScript

import { ChatBox } from '@/components/ChatBox';
import { ChatInputMentionsContextProvider } from '@/components/ChatBox/ChatInputBox/context';
import React from 'react';
import { useGroupPanel, useGroupMemberInfos } from 'tailchat-shared';
import { GroupPanelWrapper } from './Wrapper';
interface TextPanelProps {
groupId: string;
panelId: string;
}
export const TextPanel: React.FC<TextPanelProps> = React.memo(
({ groupId, panelId }) => {
const groupMembers = useGroupMemberInfos(groupId);
const panelInfo = useGroupPanel(groupId, panelId);
if (panelInfo === undefined) {
return null;
}
return (
<GroupPanelWrapper groupId={groupId} panelId={panelId} showHeader={true}>
<ChatInputMentionsContextProvider
users={groupMembers.map((m) => ({
id: m._id,
display: m.nickname,
}))}
>
<ChatBox converseId={panelId} isGroup={true} groupId={groupId} />
</ChatInputMentionsContextProvider>
</GroupPanelWrapper>
);
}
);
TextPanel.displayName = 'TextPanel';