Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insights UI improvements #6433

Merged
merged 3 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions frontend/src/component/executiveDashboard/ExecutiveDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const ExecutiveDashboard: VFC = () => {
const stateConfig = {
projects: withDefault(ArrayParam, [allOption.id]),
};
const [state, setState] = usePersistentTableState(`insights`, stateConfig);
const [state, setState] = usePersistentTableState('insights', stateConfig);
const setProjects = (projects: string[]) => {
setState({ projects });
};
Expand Down Expand Up @@ -79,7 +79,7 @@ export const ExecutiveDashboard: VFC = () => {
selectedProjects={projects}
onChange={setProjects}
dataTestId={'DASHBOARD_PROJECT_SELECT'}
sx={{ flex: 1, maxWidth: '360px' }}
sx={{ flex: 1, maxWidth: '360px', width: '100%' }}
/>
}
/>
Expand Down Expand Up @@ -157,7 +157,10 @@ export const ExecutiveDashboard: VFC = () => {
</ChartWidget>
}
/>
<Widget title='Average health'>
<Widget
title='Average health'
tooltip='Average health is a percentage of flags that are not stale nor potencially stale.'
>
<HealthStats
value={summary.averageHealth}
healthy={summary.active}
Expand Down Expand Up @@ -185,7 +188,10 @@ export const ExecutiveDashboard: VFC = () => {
<TimeToProductionChart projectFlagTrends={projectsData} />
</ChartWidget> */}
</StyledGrid>
<Widget title='Metrics'>
<Widget
title='Metrics'
tooltip='Summary of all flag evaluations reported by SDKs.'
>
<MetricsSummaryChart metricsSummaryTrends={metricsData} />
</Widget>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,57 @@ import { ReactNode, VFC } from 'react';
import { useUiFlag } from 'hooks/useUiFlag';
import { useFeedback } from 'component/feedbackNew/useFeedback';
import { ReviewsOutlined } from '@mui/icons-material';
import { Button, Typography } from '@mui/material';
import {
Button,
Typography,
styled,
useMediaQuery,
useTheme,
} from '@mui/material';
import { PageHeader } from 'component/common/PageHeader/PageHeader';
import { Badge } from 'component/common/Badge/Badge';
import { ShareLink } from './ShareLink/ShareLink';
import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender';

type DashboardHeaderProps = {
actions?: ReactNode;
};

const StyledActionsContainer = styled('div')(({ theme }) => ({
display: 'flex',
gap: theme.spacing(1),
[theme.breakpoints.down('md')]: {
flexDirection: 'column',
gap: theme.spacing(1),
},
}));

const StyledActionButtons = styled('div')(({ theme }) => ({
display: 'flex',
gap: theme.spacing(1),
}));

const StyledExternalActionsContainer = styled('div')(({ theme }) => ({
display: 'flex',
gap: theme.spacing(1),
width: 300,
[theme.breakpoints.down('md')]: {
width: '100%',
},
}));

const StyledActionsSmallScreen = styled('div')(({ theme }) => ({
display: 'flex',
flexDirection: 'column',
alignItems: 'flex-end',
gap: theme.spacing(1),
marginTop: theme.spacing(2),
}));

export const DashboardHeader: VFC<DashboardHeaderProps> = ({ actions }) => {
const showInactiveUsers = useUiFlag('showInactiveUsers');
const theme = useTheme();
const isSmallScreen = useMediaQuery(theme.breakpoints.down('md'));

const { openFeedback } = useFeedback(
'insights',
Expand All @@ -29,33 +69,53 @@ export const DashboardHeader: VFC<DashboardHeaderProps> = ({ actions }) => {
};

return (
<PageHeader
titleElement={
<Typography
variant='h1'
component='div'
sx={(theme) => ({
display: 'flex',
alignItems: 'center',
gap: theme.spacing(1),
})}
>
<span>Insights</span> <Badge color='success'>Beta</Badge>
</Typography>
}
actions={
<>
{actions}
<ShareLink />
<Button
startIcon={<ReviewsOutlined />}
variant='outlined'
onClick={createFeedbackContext}
<>
<PageHeader
titleElement={
<Typography
variant='h1'
component='div'
sx={(theme) => ({
display: 'flex',
alignItems: 'center',
gap: theme.spacing(1),
})}
>
Provide feedback
</Button>
</>
}
/>
<span>Insights</span>{' '}
<Badge color='success'>Beta</Badge>
</Typography>
}
actions={
<StyledActionsContainer>
<ConditionallyRender
condition={!isSmallScreen}
show={
<StyledExternalActionsContainer>
{actions}
</StyledExternalActionsContainer>
}
/>
<StyledActionButtons>
<ShareLink />
<Button
startIcon={<ReviewsOutlined />}
variant='outlined'
onClick={createFeedbackContext}
>
Provide feedback
</Button>
</StyledActionButtons>
</StyledActionsContainer>
}
/>
<ConditionallyRender
condition={isSmallScreen}
show={
<StyledActionsSmallScreen>
{actions}
</StyledActionsSmallScreen>
}
/>
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,17 @@ const StyledRingContent = styled(Box)(({ theme }) => ({

const StyledInsightsContainer = styled(Box)(({ theme }) => ({
marginTop: theme.spacing(4),
padding: theme.spacing(1.5),
padding: theme.spacing(1.5, 2),
background: theme.palette.background.elevation2,
borderRadius: `${theme.shape.borderRadius}px`,
borderRadius: `${theme.shape.borderRadiusMedium}px`,
display: 'flex',
alignItems: 'center',
}));

const StyledHeaderContainer = styled(Box)(({ theme }) => ({
display: 'flex',
alignItems: 'center',
marginBottom: theme.spacing(0.5),
}));

const StyledTextContainer = styled(Box)(({ theme }) => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,23 @@ const StyledUserContainer = styled(Box)(({ theme }) => ({

const StyledUserBox = styled(Box)(({ theme }) => ({
borderRadius: `${theme.shape.borderRadiusExtraLarge}px`,
backgroundColor: theme.palette.primary.main,
backgroundColor: theme.palette.background.alternative,
maxWidth: 300,
padding: theme.spacing(2),
marginBottom: theme.spacing(3),
margin: `0 auto ${theme.spacing(3)}`,
position: 'relative',
zIndex: 2,
}));

const StyledCustomShadow = styled(Box)(({ theme }) => ({
width: '220px',
maxWidth: 270,
height: '54px',
backgroundColor: 'rgba(108, 101, 229, 0.30)',
position: 'absolute',
margin: '0 auto',
top: '45px',
left: '15px',
right: '15px',
borderRadius: `${theme.shape.borderRadiusExtraLarge}px`,
zIndex: 1,
}));
Expand Down
Loading