refactor: Simplify chat menu items rendering in SiderBar
This commit is contained in:
@@ -294,39 +294,36 @@ const SiderBar = () => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{/* Chat Section - Only show if there are chat items */}
|
{/* Chat Section - Only show if there are chat items */}
|
||||||
{chatItems.length > 0 && (
|
{chatMenuItems.map((item) => {
|
||||||
<>
|
if (item.items && item.items.length > 0) {
|
||||||
{chatMenuItems.map((item) => {
|
return (
|
||||||
if (item.items && item.items.length > 0) {
|
<Nav.Sub
|
||||||
return (
|
key={item.itemKey}
|
||||||
<Nav.Sub
|
itemKey={item.itemKey}
|
||||||
key={item.itemKey}
|
text={item.text}
|
||||||
itemKey={item.itemKey}
|
icon={item.icon}
|
||||||
text={item.text}
|
>
|
||||||
icon={item.icon}
|
{item.items.map((subItem) => (
|
||||||
>
|
|
||||||
{item.items.map((subItem) => (
|
|
||||||
<Nav.Item
|
|
||||||
key={subItem.itemKey}
|
|
||||||
itemKey={subItem.itemKey}
|
|
||||||
text={subItem.text}
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
</Nav.Sub>
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return (
|
|
||||||
<Nav.Item
|
<Nav.Item
|
||||||
key={item.itemKey}
|
key={subItem.itemKey}
|
||||||
itemKey={item.itemKey}
|
itemKey={subItem.itemKey}
|
||||||
text={item.text}
|
text={subItem.text}
|
||||||
icon={item.icon}
|
|
||||||
/>
|
/>
|
||||||
);
|
))}
|
||||||
}
|
</Nav.Sub>
|
||||||
})}
|
);
|
||||||
</>
|
} else {
|
||||||
)}
|
return (
|
||||||
|
<Nav.Item
|
||||||
|
key={item.itemKey}
|
||||||
|
itemKey={item.itemKey}
|
||||||
|
text={item.text}
|
||||||
|
icon={item.icon}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})}
|
||||||
|
|
||||||
|
|
||||||
{/* Divider */}
|
{/* Divider */}
|
||||||
<Divider style={dividerStyle} />
|
<Divider style={dividerStyle} />
|
||||||
|
|||||||
Reference in New Issue
Block a user