mirror of https://github.com/msgbyte/tailchat
				
				
				
			refactor: 群组面板界面
							parent
							
								
									3e8e8870d6
								
							
						
					
					
						commit
						fce6b81ba2
					
				@ -0,0 +1,11 @@
 | 
			
		||||
import { ChatBox } from '@/components/ChatBox';
 | 
			
		||||
import React from 'react';
 | 
			
		||||
 | 
			
		||||
interface TextPanelProps {
 | 
			
		||||
  panelId: string;
 | 
			
		||||
}
 | 
			
		||||
export const TextPanel: React.FC<TextPanelProps> = React.memo(({ panelId }) => {
 | 
			
		||||
  // return <ChatBox converseId={panelId} />;
 | 
			
		||||
  return <div>TODO: panelId: {panelId}</div>;
 | 
			
		||||
});
 | 
			
		||||
TextPanel.displayName = 'TextPanel';
 | 
			
		||||
@ -0,0 +1,25 @@
 | 
			
		||||
import { TextPanel } from '@/components/Panel/group/TextPanel';
 | 
			
		||||
import { Alert } from 'antd';
 | 
			
		||||
import React from 'react';
 | 
			
		||||
import { useParams } from 'react-router';
 | 
			
		||||
import { GroupPanelType, useGroupPanel } from 'tailchat-shared';
 | 
			
		||||
 | 
			
		||||
export const GroupPanelRender: React.FC = React.memo(() => {
 | 
			
		||||
  const { groupId, panelId } = useParams<{
 | 
			
		||||
    groupId: string;
 | 
			
		||||
    panelId: string;
 | 
			
		||||
  }>();
 | 
			
		||||
 | 
			
		||||
  const panelInfo = useGroupPanel(groupId, panelId);
 | 
			
		||||
 | 
			
		||||
  if (panelInfo === undefined) {
 | 
			
		||||
    return null;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (panelInfo.type === GroupPanelType.TEXT) {
 | 
			
		||||
    return <TextPanel panelId={panelInfo.id} />;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return <Alert message="未知的面板类型" />;
 | 
			
		||||
});
 | 
			
		||||
GroupPanelRender.displayName = 'GroupPanelRender';
 | 
			
		||||
					Loading…
					
					
				
		Reference in New Issue