2024-09-26 12:47:29 +02:00
|
|
|
import { styled } from '@mui/material';
|
|
|
|
import { Badge } from 'component/common/Badge/Badge';
|
2024-09-27 10:41:25 +02:00
|
|
|
import { AvatarGroupFromOwners } from 'component/common/AvatarGroupFromOwners/AvatarGroupFromOwners';
|
2024-09-26 12:47:29 +02:00
|
|
|
import type { ProjectSchemaOwners } from 'openapi';
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
roles: string[];
|
|
|
|
owners: ProjectSchemaOwners;
|
|
|
|
};
|
|
|
|
|
|
|
|
const Wrapper = styled('div')(({ theme }) => ({
|
|
|
|
width: '100%',
|
|
|
|
display: 'flex',
|
|
|
|
flexDirection: 'row',
|
|
|
|
gap: theme.spacing(1),
|
|
|
|
justifyContent: 'space-between',
|
|
|
|
}));
|
|
|
|
|
|
|
|
const InfoSection = styled('div')(({ theme }) => ({
|
|
|
|
display: 'flex',
|
|
|
|
gap: theme.spacing(1),
|
2024-10-03 14:29:49 +02:00
|
|
|
alignItems: 'center',
|
2024-09-26 12:47:29 +02:00
|
|
|
}));
|
|
|
|
|
|
|
|
export const RoleAndOwnerInfo = ({ roles, owners }: Props) => {
|
|
|
|
return (
|
|
|
|
<Wrapper>
|
|
|
|
<InfoSection>
|
2024-10-02 09:37:02 +02:00
|
|
|
{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>
|
|
|
|
)}
|
2024-09-26 12:47:29 +02:00
|
|
|
</InfoSection>
|
|
|
|
<InfoSection>
|
|
|
|
<span>Project owner{owners.length > 1 ? 's' : ''}</span>
|
2024-09-27 10:41:25 +02:00
|
|
|
<AvatarGroupFromOwners users={owners} avatarLimit={3} />
|
2024-09-26 12:47:29 +02:00
|
|
|
</InfoSection>
|
|
|
|
</Wrapper>
|
|
|
|
);
|
|
|
|
};
|