1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-11-24 20:06:55 +01:00
unleash.unleash/frontend/src/component/personalDashboard/AskOwnerToAddYouToTheirProject.tsx
Thomas Heartman e4cfb29adc
refactor: front end code pt II (#8444)
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)
2024-10-15 09:14:24 +00:00

30 lines
1.0 KiB
TypeScript

import { ActionBox } from './ActionBox';
import { NeutralCircleContainer } from './SharedComponents';
import type { PersonalDashboardSchemaProjectOwnersItem } from 'openapi';
import type { FC } from 'react';
import { AvatarGroupFromOwners } from 'component/common/AvatarGroupFromOwners/AvatarGroupFromOwners';
export const AskOwnerToAddYouToTheirProject: FC<{
owners: PersonalDashboardSchemaProjectOwnersItem[];
}> = ({ owners }) => {
return (
<ActionBox
title={
<>
<NeutralCircleContainer>2</NeutralCircleContainer>
Ask a project owner to add you to their project
</>
}
>
{owners.length ? (
<>
<p>Project owners in Unleash:</p>
<AvatarGroupFromOwners users={owners} avatarLimit={9} />
</>
) : (
<p>There are no project owners in Unleash to ask for access.</p>
)}
</ActionBox>
);
};