diff --git a/frontend/src/component/personalDashboard/PersonalDashboard.test.tsx b/frontend/src/component/personalDashboard/PersonalDashboard.test.tsx index 96b17dc546..dbc8d1b93c 100644 --- a/frontend/src/component/personalDashboard/PersonalDashboard.test.tsx +++ b/frontend/src/component/personalDashboard/PersonalDashboard.test.tsx @@ -142,10 +142,6 @@ test('Render personal dashboard for a long running project', async () => { await screen.findByText('70%'); // avg health past window await screen.findByText('someone created a flag'); await screen.findByText('Member'); - await screen.findByText('81%'); // current health score - await screen.findByText('12 feature flags'); // active flags - await screen.findByText('13 feature flags'); // stale flags - await screen.findByText('14 feature flags'); // potentially stale flags await screen.findByText('myFlag'); await screen.findByText('production'); await screen.findByText('Last 48 hours'); diff --git a/frontend/src/component/personalDashboard/ProjectSetupComplete.tsx b/frontend/src/component/personalDashboard/ProjectSetupComplete.tsx index 290358b302..c84cc94136 100644 --- a/frontend/src/component/personalDashboard/ProjectSetupComplete.tsx +++ b/frontend/src/component/personalDashboard/ProjectSetupComplete.tsx @@ -3,8 +3,6 @@ import type { FC } from 'react'; import { Link } from 'react-router-dom'; import Lightbulb from '@mui/icons-material/LightbulbOutlined'; import type { PersonalDashboardProjectDetailsSchemaInsights } from '../../openapi'; -import { ProjectHealthChart } from 'component/project/Project/ProjectInsights/ProjectHealth/ProjectHealthChart'; -import { FlagCounts } from '../project/Project/ProjectInsights/ProjectHealth/FlagCounts'; const TitleContainer = styled('div')(({ theme }) => ({ display: 'flex', @@ -57,11 +55,11 @@ const ConnectedSdkProject: FC<{ project: string }> = ({ project }) => { ); }; -type HeathTrend = 'consistent' | 'improved' | 'declined' | 'unknown'; +type HealthTrend = 'consistent' | 'improved' | 'declined' | 'unknown'; const determineProjectHealthTrend = ( insights: PersonalDashboardProjectDetailsSchemaInsights, -): HeathTrend => { +): HealthTrend => { const { avgHealthCurrentWindow, avgHealthPastWindow } = insights; if (avgHealthCurrentWindow === null || avgHealthPastWindow === null) { @@ -80,11 +78,11 @@ const determineProjectHealthTrend = ( }; const ProjectHealthMessage: FC<{ - trend: HeathTrend; + trend: HealthTrend; insights: PersonalDashboardProjectDetailsSchemaInsights; project: string; }> = ({ trend, insights, project }) => { - const { avgHealthCurrentWindow, avgHealthPastWindow } = insights; + const { avgHealthCurrentWindow, avgHealthPastWindow, health } = insights; const improveMessage = 'Remember to archive your stale feature flags to keep the project health growing.'; const keepDoingMessage = @@ -92,36 +90,60 @@ const ProjectHealthMessage: FC<{ if (trend === 'improved') { return ( - - On average, your project health went up from{' '} - {avgHealthPastWindow}% to{' '} - {avgHealthCurrentWindow}%{' '} - during the last 4 weeks.
{keepDoingMessage} -
+ <> + + On average, your project health went up from{' '} + {avgHealthPastWindow}% to{' '} + {avgHealthCurrentWindow}%{' '} + during the last 4 weeks. + + {keepDoingMessage} + ); } if (trend === 'declined') { return ( - - On average, your project health went down from{' '} - {avgHealthPastWindow}% to{' '} - {avgHealthCurrentWindow}%{' '} - during the last 4 weeks.
{improveMessage} -
+ <> + + On average, your project health went down from{' '} + {avgHealthPastWindow}% to{' '} + {avgHealthCurrentWindow}%{' '} + during the last 4 weeks. + + {improveMessage} + ); } if (trend === 'consistent') { return ( - - On average, your project health has remained at{' '} - {avgHealthCurrentWindow}%{' '} - during the last 4 weeks.
- {avgHealthCurrentWindow && avgHealthCurrentWindow >= 70 - ? keepDoingMessage - : improveMessage} -
+ <> + + On average, your project health has remained at{' '} + {avgHealthCurrentWindow}%{' '} + during the last 4 weeks. + + + {avgHealthCurrentWindow && avgHealthCurrentWindow >= 70 + ? keepDoingMessage + : improveMessage} + + + ); + } + + if (trend === 'unknown') { + return ( + <> + + Your current health score is{' '} + {health}%. + + + {health >= 70 ? keepDoingMessage : improveMessage} + + ); } @@ -141,22 +163,6 @@ export const ProjectSetupComplete: FC<{ Project health - - - - -