mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-23 00:22:19 +01:00
1-3095: small UI tweaks sidebar boxes (#8721)
This PR fixes three minor UI issues: 1. The modal is too wide. Turns out that `SidebarModal` has a fixed width of 1300. `DynamicSidebarModal` does not, so that switch makes it much leaner. 2. The lifecycle boxes should grow in width to fill whatever space they have available. 3. If you have 1 flag in any of the stages, we should say "1 flag" instead of "1 flags". Sidebar before:  Sidebar after:  The lifecycle boxes at their very widest: 
This commit is contained in:
parent
ce271a635a
commit
20c5a6f7ce
@ -5,12 +5,12 @@ import useLoading from 'hooks/useLoading';
|
|||||||
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
|
import { useRequiredPathParam } from 'hooks/useRequiredPathParam';
|
||||||
import type { FC } from 'react';
|
import type { FC } from 'react';
|
||||||
import { PrettifyLargeNumber } from 'component/common/PrettifyLargeNumber/PrettifyLargeNumber';
|
import { PrettifyLargeNumber } from 'component/common/PrettifyLargeNumber/PrettifyLargeNumber';
|
||||||
|
import type { ProjectStatusSchemaLifecycleSummary } from 'openapi';
|
||||||
const LifecycleBox = styled('li')(({ theme }) => ({
|
const LifecycleBox = styled('li')(({ theme }) => ({
|
||||||
padding: theme.spacing(2),
|
padding: theme.spacing(2),
|
||||||
borderRadius: theme.shape.borderRadiusExtraLarge,
|
borderRadius: theme.shape.borderRadiusExtraLarge,
|
||||||
border: `2px solid ${theme.palette.divider}`,
|
border: `2px solid ${theme.palette.divider}`,
|
||||||
width: '180px',
|
gap: theme.spacing(4),
|
||||||
height: '175px',
|
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexFlow: 'column',
|
flexFlow: 'column',
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
@ -19,9 +19,10 @@ const LifecycleBox = styled('li')(({ theme }) => ({
|
|||||||
const Wrapper = styled('ul')(({ theme }) => ({
|
const Wrapper = styled('ul')(({ theme }) => ({
|
||||||
display: 'grid',
|
display: 'grid',
|
||||||
listStyle: 'none',
|
listStyle: 'none',
|
||||||
gridTemplateColumns: 'repeat(auto-fit, 180px)',
|
gridTemplateColumns: 'repeat(auto-fit, minmax(180px, 1fr))',
|
||||||
gap: theme.spacing(1),
|
gap: theme.spacing(1),
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
|
padding: 0,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const Counter = styled('span')({
|
const Counter = styled('span')({
|
||||||
@ -90,6 +91,13 @@ export const ProjectLifecycleSummary = () => {
|
|||||||
loading,
|
loading,
|
||||||
'[data-loading-project-lifecycle-summary=true]',
|
'[data-loading-project-lifecycle-summary=true]',
|
||||||
);
|
);
|
||||||
|
const flagWord = (stage: keyof ProjectStatusSchemaLifecycleSummary) => {
|
||||||
|
if (data?.lifecycleSummary[stage].currentFlags === 1) {
|
||||||
|
return 'flag';
|
||||||
|
} else {
|
||||||
|
return 'flags';
|
||||||
|
}
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<Wrapper ref={loadingRef}>
|
<Wrapper ref={loadingRef}>
|
||||||
<LifecycleBox>
|
<LifecycleBox>
|
||||||
@ -104,7 +112,7 @@ export const ProjectLifecycleSummary = () => {
|
|||||||
stage={{ name: 'initial' }}
|
stage={{ name: 'initial' }}
|
||||||
/>
|
/>
|
||||||
</Counter>
|
</Counter>
|
||||||
<span>flags in initial</span>
|
<span>{flagWord('initial')} in initial</span>
|
||||||
</p>
|
</p>
|
||||||
<AverageDaysStat
|
<AverageDaysStat
|
||||||
averageDays={data?.lifecycleSummary.initial.averageDays}
|
averageDays={data?.lifecycleSummary.initial.averageDays}
|
||||||
@ -122,7 +130,7 @@ export const ProjectLifecycleSummary = () => {
|
|||||||
stage={{ name: 'pre-live' }}
|
stage={{ name: 'pre-live' }}
|
||||||
/>
|
/>
|
||||||
</Counter>
|
</Counter>
|
||||||
<span>flags in pre-live</span>
|
<span>{flagWord('preLive')} in pre-live</span>
|
||||||
</p>
|
</p>
|
||||||
<AverageDaysStat
|
<AverageDaysStat
|
||||||
averageDays={data?.lifecycleSummary.preLive.averageDays}
|
averageDays={data?.lifecycleSummary.preLive.averageDays}
|
||||||
@ -140,7 +148,7 @@ export const ProjectLifecycleSummary = () => {
|
|||||||
stage={{ name: 'live' }}
|
stage={{ name: 'live' }}
|
||||||
/>
|
/>
|
||||||
</Counter>
|
</Counter>
|
||||||
<span>flags in live</span>
|
<span>{flagWord('live')} in live</span>
|
||||||
</p>
|
</p>
|
||||||
<AverageDaysStat
|
<AverageDaysStat
|
||||||
averageDays={data?.lifecycleSummary.live.averageDays}
|
averageDays={data?.lifecycleSummary.live.averageDays}
|
||||||
@ -160,7 +168,7 @@ export const ProjectLifecycleSummary = () => {
|
|||||||
stage={{ name: 'completed' }}
|
stage={{ name: 'completed' }}
|
||||||
/>
|
/>
|
||||||
</Counter>
|
</Counter>
|
||||||
<span>flags in cleanup</span>
|
<span>{flagWord('completed')} in cleanup</span>
|
||||||
</p>
|
</p>
|
||||||
<AverageDaysStat
|
<AverageDaysStat
|
||||||
averageDays={data?.lifecycleSummary.completed.averageDays}
|
averageDays={data?.lifecycleSummary.completed.averageDays}
|
||||||
@ -178,7 +186,7 @@ export const ProjectLifecycleSummary = () => {
|
|||||||
stage={{ name: 'archived' }}
|
stage={{ name: 'archived' }}
|
||||||
/>
|
/>
|
||||||
</Counter>
|
</Counter>
|
||||||
<span>flags in archived</span>
|
<span>{flagWord('archived')} in archived</span>
|
||||||
</p>
|
</p>
|
||||||
<Stats>
|
<Stats>
|
||||||
<dt>This month</dt>
|
<dt>This month</dt>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { styled } from '@mui/material';
|
import { styled } from '@mui/material';
|
||||||
import { SidebarModal } from 'component/common/SidebarModal/SidebarModal';
|
import { DynamicSidebarModal } from 'component/common/SidebarModal/SidebarModal';
|
||||||
import { ProjectResources } from './ProjectResources';
|
import { ProjectResources } from './ProjectResources';
|
||||||
import { ProjectActivity } from './ProjectActivity';
|
import { ProjectActivity } from './ProjectActivity';
|
||||||
import { ProjectHealth } from './ProjectHealth';
|
import { ProjectHealth } from './ProjectHealth';
|
||||||
@ -34,7 +34,7 @@ const HealthRow = styled('div')(({ theme }) => ({
|
|||||||
|
|
||||||
export const ProjectStatusModal = ({ open, close }: Props) => {
|
export const ProjectStatusModal = ({ open, close }: Props) => {
|
||||||
return (
|
return (
|
||||||
<SidebarModal open={open} onClose={close} label='Project status'>
|
<DynamicSidebarModal open={open} onClose={close} label='Project status'>
|
||||||
<ModalContentContainer>
|
<ModalContentContainer>
|
||||||
<HealthRow>
|
<HealthRow>
|
||||||
<ProjectHealth />
|
<ProjectHealth />
|
||||||
@ -45,6 +45,6 @@ export const ProjectStatusModal = ({ open, close }: Props) => {
|
|||||||
|
|
||||||
<ProjectLifecycleSummary />
|
<ProjectLifecycleSummary />
|
||||||
</ModalContentContainer>
|
</ModalContentContainer>
|
||||||
</SidebarModal>
|
</DynamicSidebarModal>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user