import { Box, Icon, Tag } from '@rocket.chat/fuselage'; import type { Keys as IconName } from '@rocket.chat/icons'; import type { ReactElement } from 'react'; import { memo } from 'react'; import SidebarGenericItem from './SidebarGenericItem'; type SidebarNavigationItemProps = { permissionGranted?: (() => boolean) | boolean; pathSection: string; icon?: IconName; label?: string; tag?: string; currentPath?: string; externalUrl?: boolean; badge?: () => ReactElement; }; const SidebarNavigationItem = ({ permissionGranted, pathSection, icon, label, currentPath, tag, externalUrl, // eslint-disable-next-line @typescript-eslint/naming-convention badge: Badge, }: SidebarNavigationItemProps) => { const path = pathSection; const isActive = !!path && currentPath?.includes(path as string); if (permissionGranted === false || (typeof permissionGranted === 'function' && !permissionGranted())) { return null; } return ( {icon && } {label} {tag && {tag}} {Badge ? : null} ); }; export default memo(SidebarNavigationItem);