mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
Feat/po_project_members (#2994)
<!-- Thanks for creating a PR! To make it easier for reviewers and everyone else to understand what your changes relate to, please add some relevant content to the headings below. Feel free to ignore or delete sections that you don't think are relevant. Thank you! ❤️ --> - Initial separation on project members into it's own component - Styling fixes - Hide new ToggleTypesWidget behind a flag Members widget: https://linear.app/unleash/issue/1-586/project-overview-members-widget ## About the changes <!-- Describe the changes introduced. What are they and why are they being introduced? Feel free to also add screenshots or steps to view the changes if they're visual. --> <!-- Does it close an issue? Multiple? --> Closes # <!-- (For internal contributors): Does it relate to an issue on public roadmap? --> <!-- Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item: # --> ### Important files <!-- PRs can contain a lot of changes, but not all changes are equally important. Where should a reviewer start looking to get an overview of the changes? Are any files particularly important? --> ## Discussion points <!-- Anything about the PR you'd like to discuss before it gets merged? Got any questions or doubts? --> Signed-off-by: andreas-unleash <andreas@getunleash.ai>
This commit is contained in:
parent
bc46918f66
commit
6a6fbfad1e
@ -53,11 +53,11 @@ export const StyledParagraphSubtitle = styled('p')(({ theme }) => ({
|
||||
|
||||
export const StyledParagraphGridRow = styled('div')(({ theme }) => ({
|
||||
display: 'grid',
|
||||
gridGap: theme.spacing(2),
|
||||
gridTemplateColumns: '10% 70% 20%',
|
||||
margin: theme.spacing(1, 2, 1, 2),
|
||||
gridGap: theme.spacing(1),
|
||||
gridTemplateColumns: `${theme.spacing(1.25)} auto auto`,
|
||||
margin: theme.spacing(1, 0, 1, 0),
|
||||
fontSize: theme.fontSizes.smallBody,
|
||||
color: theme.palette.tertiary.dark,
|
||||
color: theme.palette.text.secondary,
|
||||
textAlign: 'left',
|
||||
alignItems: 'center',
|
||||
}));
|
||||
@ -72,8 +72,9 @@ export const StyledParagraphEmphasizedText = styled('p')(({ theme }) => ({
|
||||
}));
|
||||
|
||||
export const StyledCount = styled('p')(({ theme }) => ({
|
||||
fontSize: '1.2rem',
|
||||
fontSize: theme.typography.h2.fontSize,
|
||||
fontWeight: 'bold',
|
||||
textAlign: 'right',
|
||||
color: theme.palette.text.primary,
|
||||
}));
|
||||
|
||||
|
@ -1,19 +1,12 @@
|
||||
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
||||
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';
|
||||
|
||||
import { DEFAULT_PROJECT_ID } from 'hooks/api/getters/useDefaultProject/useDefaultProjectId';
|
||||
import {
|
||||
StyledArrowIcon,
|
||||
StyledDivContainer,
|
||||
StyledDivInfoContainer,
|
||||
StyledLink,
|
||||
StyledParagraphEmphasizedText,
|
||||
StyledParagraphSubtitle,
|
||||
StyledSpanLinkText,
|
||||
} from './ProjectInfo.styles';
|
||||
import { StyledDivContainer } from './ProjectInfo.styles';
|
||||
import { IFeatureToggleListItem } from '../../../../interfaces/featureToggle';
|
||||
import { HealthWidget } from './HealthWidget';
|
||||
import { ToggleTypesWidget } from './ToggleTypesWidget';
|
||||
import { ProjectMembersWidget } from './ProjectMembersWidget';
|
||||
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
||||
|
||||
interface IProjectInfoProps {
|
||||
id: string;
|
||||
@ -30,13 +23,6 @@ const ProjectInfo = ({
|
||||
features,
|
||||
}: IProjectInfoProps) => {
|
||||
const { uiConfig } = useUiConfig();
|
||||
|
||||
let link = `/admin/users`;
|
||||
|
||||
if (uiConfig?.versionInfo?.current?.enterprise) {
|
||||
link = `/projects/${id}/settings/access`;
|
||||
}
|
||||
|
||||
return (
|
||||
<aside>
|
||||
<StyledDivContainer>
|
||||
@ -44,23 +30,16 @@ const ProjectInfo = ({
|
||||
<ConditionallyRender
|
||||
condition={id !== DEFAULT_PROJECT_ID}
|
||||
show={
|
||||
<StyledDivInfoContainer style={{ marginBottom: '0' }}>
|
||||
<StyledParagraphSubtitle data-loading>
|
||||
Project members
|
||||
</StyledParagraphSubtitle>
|
||||
<StyledParagraphEmphasizedText data-loading>
|
||||
{memberCount}
|
||||
</StyledParagraphEmphasizedText>
|
||||
<StyledLink data-loading to={link}>
|
||||
<StyledSpanLinkText data-loading>
|
||||
view more{' '}
|
||||
</StyledSpanLinkText>
|
||||
<StyledArrowIcon data-loading />
|
||||
</StyledLink>
|
||||
</StyledDivInfoContainer>
|
||||
<ProjectMembersWidget
|
||||
projectId={id}
|
||||
memberCount={memberCount}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
<ToggleTypesWidget features={features} />
|
||||
<ConditionallyRender
|
||||
condition={Boolean(uiConfig?.flags.newProjectOverview)}
|
||||
show={<ToggleTypesWidget features={features} />}
|
||||
/>
|
||||
</StyledDivContainer>
|
||||
</aside>
|
||||
);
|
||||
|
@ -0,0 +1,42 @@
|
||||
import {
|
||||
StyledArrowIcon,
|
||||
StyledDivInfoContainer,
|
||||
StyledLink,
|
||||
StyledParagraphEmphasizedText,
|
||||
StyledParagraphSubtitle,
|
||||
StyledSpanLinkText,
|
||||
} from './ProjectInfo.styles';
|
||||
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
||||
|
||||
interface IProjectMembersWidgetProps {
|
||||
projectId: string;
|
||||
memberCount: number;
|
||||
}
|
||||
|
||||
export const ProjectMembersWidget = ({
|
||||
projectId,
|
||||
memberCount,
|
||||
}: IProjectMembersWidgetProps) => {
|
||||
const { uiConfig } = useUiConfig();
|
||||
|
||||
let link = `/admin/users`;
|
||||
|
||||
if (uiConfig?.versionInfo?.current?.enterprise) {
|
||||
link = `/projects/${projectId}/settings/access`;
|
||||
}
|
||||
|
||||
return (
|
||||
<StyledDivInfoContainer>
|
||||
<StyledParagraphSubtitle data-loading>
|
||||
Project members
|
||||
</StyledParagraphSubtitle>
|
||||
<StyledParagraphEmphasizedText data-loading>
|
||||
{memberCount}
|
||||
</StyledParagraphEmphasizedText>
|
||||
<StyledLink data-loading to={link}>
|
||||
<StyledSpanLinkText data-loading>view more </StyledSpanLinkText>
|
||||
<StyledArrowIcon data-loading />
|
||||
</StyledLink>
|
||||
</StyledDivInfoContainer>
|
||||
);
|
||||
};
|
@ -52,27 +52,27 @@ export const ToggleTypesWidget = ({ features }: IToggleTypesWidgetProps) => {
|
||||
Toggle types used
|
||||
</StyledParagraphSubtitle>
|
||||
<StyledParagraphGridRow data-loading>
|
||||
<ReleaseToggleIcon fontSize="inherit" data-loading />
|
||||
<ReleaseToggleIcon fontSize="small" data-loading />
|
||||
<div>Release</div>
|
||||
<StyledCount>{release}</StyledCount>
|
||||
</StyledParagraphGridRow>
|
||||
<StyledParagraphGridRow data-loading>
|
||||
<ExperimentToggleIcon fontSize="inherit" data-loading />
|
||||
<ExperimentToggleIcon fontSize="small" data-loading />
|
||||
<div>Experiment</div>
|
||||
<StyledCount>{experiment}</StyledCount>
|
||||
</StyledParagraphGridRow>
|
||||
<StyledParagraphGridRow data-loading>
|
||||
<OperationalToggleIcon fontSize="inherit" data-loading />
|
||||
<OperationalToggleIcon fontSize="small" data-loading />
|
||||
<div>Operational</div>
|
||||
<StyledCount>{operational}</StyledCount>
|
||||
</StyledParagraphGridRow>
|
||||
<StyledParagraphGridRow data-loading>
|
||||
<KillToggleIcon fontSize="inherit" data-loading />
|
||||
<KillToggleIcon fontSize="small" data-loading />
|
||||
<div>Kill switch</div>
|
||||
<StyledCount>{kill}</StyledCount>
|
||||
</StyledParagraphGridRow>
|
||||
<StyledParagraphGridRow data-loading>
|
||||
<PermissionToggleIcon fontSize="inherit" data-loading />
|
||||
<StyledParagraphGridRow data-loading style={{ margin: 0 }}>
|
||||
<PermissionToggleIcon fontSize="small" data-loading />
|
||||
<div>Permission</div>
|
||||
<StyledCount>{permission}</StyledCount>
|
||||
</StyledParagraphGridRow>
|
||||
|
Loading…
Reference in New Issue
Block a user