From 6a6fbfad1ef8e64d55d28112514c9a5a85c5c847 Mon Sep 17 00:00:00 2001 From: andreas-unleash Date: Thu, 26 Jan 2023 08:26:43 +0200 Subject: [PATCH] Feat/po_project_members (#2994) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 Closes # ### Important files ## Discussion points Signed-off-by: andreas-unleash --- .../Project/ProjectInfo/ProjectInfo.styles.ts | 11 ++--- .../Project/ProjectInfo/ProjectInfo.tsx | 43 +++++-------------- .../ProjectInfo/ProjectMembersWidget.tsx | 42 ++++++++++++++++++ .../Project/ProjectInfo/ToggleTypesWidget.tsx | 12 +++--- 4 files changed, 65 insertions(+), 43 deletions(-) create mode 100644 frontend/src/component/project/Project/ProjectInfo/ProjectMembersWidget.tsx diff --git a/frontend/src/component/project/Project/ProjectInfo/ProjectInfo.styles.ts b/frontend/src/component/project/Project/ProjectInfo/ProjectInfo.styles.ts index a91b1339c7..6d25433d85 100644 --- a/frontend/src/component/project/Project/ProjectInfo/ProjectInfo.styles.ts +++ b/frontend/src/component/project/Project/ProjectInfo/ProjectInfo.styles.ts @@ -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, })); diff --git a/frontend/src/component/project/Project/ProjectInfo/ProjectInfo.tsx b/frontend/src/component/project/Project/ProjectInfo/ProjectInfo.tsx index c711887418..812c89cd88 100644 --- a/frontend/src/component/project/Project/ProjectInfo/ProjectInfo.tsx +++ b/frontend/src/component/project/Project/ProjectInfo/ProjectInfo.tsx @@ -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 ( ); diff --git a/frontend/src/component/project/Project/ProjectInfo/ProjectMembersWidget.tsx b/frontend/src/component/project/Project/ProjectInfo/ProjectMembersWidget.tsx new file mode 100644 index 0000000000..e93625a2a8 --- /dev/null +++ b/frontend/src/component/project/Project/ProjectInfo/ProjectMembersWidget.tsx @@ -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 ( + + + Project members + + + {memberCount} + + + view more + + + + ); +}; diff --git a/frontend/src/component/project/Project/ProjectInfo/ToggleTypesWidget.tsx b/frontend/src/component/project/Project/ProjectInfo/ToggleTypesWidget.tsx index 62c57fc534..155206ca41 100644 --- a/frontend/src/component/project/Project/ProjectInfo/ToggleTypesWidget.tsx +++ b/frontend/src/component/project/Project/ProjectInfo/ToggleTypesWidget.tsx @@ -52,27 +52,27 @@ export const ToggleTypesWidget = ({ features }: IToggleTypesWidgetProps) => { Toggle types used - +
Release
{release}
- +
Experiment
{experiment}
- +
Operational
{operational}
- +
Kill switch
{kill}
- - + +
Permission
{permission}