diff --git a/frontend/src/component/personalDashboard/RoleAndOwnerInfo.tsx b/frontend/src/component/personalDashboard/RoleAndOwnerInfo.tsx index 3e19530420bd..c84beec34716 100644 --- a/frontend/src/component/personalDashboard/RoleAndOwnerInfo.tsx +++ b/frontend/src/component/personalDashboard/RoleAndOwnerInfo.tsx @@ -1,7 +1,8 @@ -import { styled } from '@mui/material'; +import { Typography, styled } from '@mui/material'; import { Badge } from 'component/common/Badge/Badge'; import { AvatarGroupFromOwners } from 'component/common/AvatarGroupFromOwners/AvatarGroupFromOwners'; import type { ProjectSchemaOwners } from 'openapi'; +import { HtmlTooltip } from 'component/common/HtmlTooltip/HtmlTooltip'; type Props = { roles: string[]; @@ -22,26 +23,97 @@ const InfoSection = styled('div')(({ theme }) => ({ alignItems: 'center', })); +const Roles = styled('ul')(({ theme }) => ({ + display: 'flex', + gap: theme.spacing(1), + flexFlow: 'row wrap', + listStyle: 'none', + padding: 0, +})); + +const TooltipRoles = styled('ul')(({ theme }) => ({ + gap: theme.spacing(1), + flexFlow: 'column', + display: 'flex', + listStyle: 'none', + padding: 0, +})); + +const RoleBadge = styled(Badge)({ + whitespace: 'nowrap', +}); + +const StyledAvatarGroup = styled(AvatarGroupFromOwners)({ + width: 'max-content', +}); + export const RoleAndOwnerInfo = ({ roles, owners }: Props) => { + const firstRoles = roles.slice(0, 3); + const extraRoles = roles.slice(3); return ( {roles.length > 0 ? ( <> - Your roles in this project: - {roles.map((role) => ( - - {role} - - ))} + + Your roles in this project: + + + {firstRoles.map((role) => ( +
  • + + {role} + +
  • + ))} + {extraRoles.length ? ( +
  • + + {extraRoles.map((role) => ( +
  • + + {role} + +
  • + ))} + + } + > + + {`+ ${extraRoles.length} more`} + + + + ) : null} +
    ) : ( You have no project roles in this project. )}
    - Project owner{owners.length > 1 ? 's' : ''} - + + Project owner{owners.length > 1 ? 's' : ''} + +
    );