import React from 'react'; import { GroupPanelType, isValidStr, useGroupInfo } from 'tailchat-shared'; import { useParams } from 'react-router'; import { GroupHeader } from './GroupHeader'; import { GroupSection } from '@/components/GroupSection'; import { CommonSidebarWrapper } from '@/components/CommonSidebarWrapper'; import { SidebarItem } from './SidebarItem'; interface GroupParams { groupId: string; } /** * 群组面板侧边栏组件 */ export const Sidebar: React.FC = React.memo(() => { const { groupId } = useParams(); const groupInfo = useGroupInfo(groupId); const groupPanels = groupInfo?.panels ?? []; return (
{groupPanels .filter((panel) => !isValidStr(panel.parentId)) .map((panel) => panel.type === GroupPanelType.GROUP ? ( {groupPanels .filter((sub) => sub.parentId === panel.id) .map((sub) => ( ))} ) : ( ) )}
); }); Sidebar.displayName = 'Sidebar';