1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-04 00:18:01 +01:00

feat: handle owners and project roles in the UI (#8315)

This commit uses the now-included project owner and role information
to populate the owner/role section. If you have no roles, we'll tell
you that you don't instead of displaying an empty set of badges.
This commit is contained in:
Thomas Heartman 2024-10-02 09:37:02 +02:00 committed by GitHub
parent f47ae12263
commit 6936da7403
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 9 deletions

View File

@ -163,10 +163,12 @@ export const MyProjects: FC<{
</SpacedGridItem>
<SpacedGridItem item lg={4} md={1} />
<SpacedGridItem item lg={8} md={1}>
{activeProject ? (
{personalDashboardProjectDetails ? (
<RoleAndOwnerInfo
roles={['owner', 'custom']}
owners={[{ ownerType: 'system' }]}
roles={personalDashboardProjectDetails.roles.map(
(role) => role.name,
)}
owners={personalDashboardProjectDetails.owners}
/>
) : null}
</SpacedGridItem>

View File

@ -25,12 +25,18 @@ export const RoleAndOwnerInfo = ({ roles, owners }: Props) => {
return (
<Wrapper>
<InfoSection>
<span>Your roles in this project:</span>
{roles.map((role) => (
<Badge key={role} color='secondary'>
{role}
</Badge>
))}
{roles.length > 0 ? (
<>
<span>Your roles in this project:</span>
{roles.map((role) => (
<Badge key={role} color='secondary'>
{role}
</Badge>
))}
</>
) : (
<span>You have no project roles in this project.</span>
)}
</InfoSection>
<InfoSection>
<span>Project owner{owners.length > 1 ? 's' : ''}</span>