1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-06 00:07:44 +01:00
unleash.unleash/frontend/src/component/personalDashboard/YourAdmins.tsx

61 lines
1.9 KiB
TypeScript
Raw Normal View History

import { UserAvatar } from 'component/common/UserAvatar/UserAvatar';
import { Typography, styled } from '@mui/material';
import type { PersonalDashboardSchemaAdminsItem } from 'openapi';
const StyledList = styled('ul')(({ theme }) => ({
padding: 0,
'li + li': {
marginTop: theme.spacing(2),
},
}));
const StyledListItem = styled('li')(({ theme }) => ({
display: 'flex',
flexFlow: 'row',
gap: theme.spacing(2),
}));
const Wrapper = styled('article')(({ theme }) => ({
display: 'flex',
flexFlow: 'column',
gap: theme.spacing(2),
}));
export const YourAdmins: React.FC<{
admins: PersonalDashboardSchemaAdminsItem[];
}> = ({ admins }) => {
return (
<Wrapper>
{admins.length ? (
<>
<p>
Your Unleash administrator
{admins.length > 1 ? 's are' : ' is'}:
</p>
<StyledList>
{admins.map((admin) => {
return (
<StyledListItem key={admin.id}>
<UserAvatar
sx={{
margin: 0,
}}
user={admin}
/>
<Typography>
{admin.name ||
admin.username ||
admin.email}
</Typography>
</StyledListItem>
);
})}
</StyledList>
</>
) : (
<p>You have no Unleash administrators to contact.</p>
)}
</Wrapper>
);
};