mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-06 00:07:44 +01:00
e4cfb29adc
This PR continues the refactoring of the front end code for dashboards. The main points are: - Extracts the `ActionBox` component that we used in a lot of places. There were some minor differences between the various incarnations, so this also better aligns them. - Extract other components (`AskOwnerToAddYouToTheirProject`, `YourAdmins`) - Move the `NeutralCircleContainer` into `SharedComponents` - Delete the separate no content grid (this is now handled in projects instead) - extract my projects grid contents into a single function so that it's easier to understand what content you get for what states Here's all the states side by side: ![image](https://github.com/user-attachments/assets/c5abc406-7374-41e4-8ff6-d48fe61cd7c8)
61 lines
1.9 KiB
TypeScript
61 lines
1.9 KiB
TypeScript
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>
|
|
);
|
|
};
|