fix: added permission check for count visibility

pull/3470/head
Brandon 2 years ago committed by Brandon Cohen
parent 81125c94f8
commit 630ebe3f2a

@ -169,22 +169,28 @@ const MobileMenu = ({
className: 'h-5 w-5', className: 'h-5 w-5',
})} })}
<span className="ml-2">{link.content}</span> <span className="ml-2">{link.content}</span>
{link.href === '/requests' && pendingRequestsCount && ( {link.href === '/requests' &&
<div className="ml-auto"> pendingRequestsCount &&
<Badge badgeType="gradient"> pendingRequestsCount > 0 &&
{pendingRequestsCount < 100 hasPermission(Permission.MANAGE_REQUESTS) && (
? pendingRequestsCount <div className="ml-auto">
: '99+'} <Badge badgeType="gradient">
</Badge> {pendingRequestsCount < 100
</div> ? pendingRequestsCount
)} : '99+'}
{link.href === '/issues' && openIssuesCount && ( </Badge>
<div className="ml-auto"> </div>
<Badge badgeType="gradient"> )}
{openIssuesCount < 100 ? openIssuesCount : '99+'} {link.href === '/issues' &&
</Badge> openIssuesCount &&
</div> openIssuesCount &&
)} hasPermission(Permission.MANAGE_ISSUES) && (
<div className="ml-auto">
<Badge badgeType="gradient">
{openIssuesCount < 100 ? openIssuesCount : '99+'}
</Badge>
</div>
)}
</a> </a>
</Link> </Link>
); );
@ -210,15 +216,17 @@ const MobileMenu = ({
className: 'h-6 w-6', className: 'h-6 w-6',
} }
)} )}
{link.href === '/requests' && pendingRequestsCount && ( {link.href === '/requests' &&
<div className="absolute left-3 bottom-2.5"> pendingRequestsCount &&
<span className="inline-flex whitespace-nowrap rounded-full border border-white bg-gradient-to-br from-indigo-600 to-purple-600 px-1 text-xs font-semibold !text-indigo-100 shadow-black"> hasPermission(Permission.MANAGE_REQUESTS) && (
{pendingRequestsCount < 100 <div className="absolute left-3 bottom-2.5">
? pendingRequestsCount <span className="inline-flex whitespace-nowrap rounded-full border border-white bg-gradient-to-br from-indigo-600 to-purple-600 px-1 text-xs font-semibold !text-indigo-100 shadow-black">
: '99+'} {pendingRequestsCount < 100
</span> ? pendingRequestsCount
</div> : '99+'}
)} </span>
</div>
)}
</a> </a>
</Link> </Link>
); );

@ -264,7 +264,8 @@ const Sidebar = ({
)} )}
{sidebarLink.messagesKey === 'requests' && {sidebarLink.messagesKey === 'requests' &&
pendingRequestsCount && pendingRequestsCount &&
pendingRequestsCount > 0 && ( pendingRequestsCount > 0 &&
hasPermission(Permission.MANAGE_REQUESTS) && (
<div className="ml-auto"> <div className="ml-auto">
<Badge badgeType="gradient"> <Badge badgeType="gradient">
{pendingRequestsCount < 100 {pendingRequestsCount < 100
@ -275,7 +276,8 @@ const Sidebar = ({
)} )}
{sidebarLink.messagesKey === 'issues' && {sidebarLink.messagesKey === 'issues' &&
openIssuesCount && openIssuesCount &&
openIssuesCount > 0 && ( openIssuesCount > 0 &&
hasPermission(Permission.MANAGE_ISSUES) && (
<div className="ml-auto"> <div className="ml-auto">
<Badge badgeType="gradient"> <Badge badgeType="gradient">
{openIssuesCount < 100 {openIssuesCount < 100

Loading…
Cancel
Save