Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
3d157e1
Add config file for GraphQL language server
canac Dec 5, 2024
3c6d694
Extract typeguard into lib
canac Dec 5, 2024
d6ddc19
Refactor monthYearFormat to accept DateTime instances
canac Dec 5, 2024
f626902
Remove unused prop
canac Dec 6, 2024
6134977
Add button to reset goal to calculated goal
canac Dec 6, 2024
8bae54b
Add tests
canac Dec 6, 2024
59cdef8
Submit the form immediately
canac Dec 6, 2024
c34e68e
Create reusable LegendReferenceLine component
canac Dec 6, 2024
c202dcf
Create reusable BarChartSkeleton component
canac Dec 6, 2024
788db86
Unconditionally mock window.ResizeObserver
canac Dec 6, 2024
71868d1
Create HealthIndicatorGraph component
canac Dec 6, 2024
4537890
Remove Hi suffix from field names
canac Dec 9, 2024
31a2a39
Add graph colors to theme
canac Dec 9, 2024
fd88993
Create the bare bones of the Health Indicator widget
dr-bizz Dec 10, 2024
4fd1765
Add the widget to the dashboard
dr-bizz Dec 10, 2024
00f4250
Switching from makeStyles() to styled() components so we can pass in …
dr-bizz Dec 10, 2024
17d4511
Making dashboard responsive with new widget
dr-bizz Dec 11, 2024
22ca6ca
Hide HI widget when no data
dr-bizz Dec 11, 2024
b4015ca
Adding tests
dr-bizz Dec 11, 2024
33c9b3d
All locales will now be able to view the progress bar as we're no lon…
dr-bizz Dec 13, 2024
d32225f
Adding Tootltip about where the goal was created on monthlyGoal
dr-bizz Dec 13, 2024
8764489
Add percentage to overall score
dr-bizz Dec 16, 2024
3967d8e
Merge pull request #1229 from CruGlobal/add-hi-graph-to-dashboard-clean
dr-bizz Dec 16, 2024
35fe64e
Make reset button change the goal to null
canac Dec 19, 2024
0463bfa
Show the machine calculated goal currency
canac Jan 6, 2025
5146750
Merge pull request #1217 from CruGlobal/8481-hi-report-graph
canac Jan 7, 2025
580e7b1
Make currency nullable
canac Jan 8, 2025
6eb69ac
Load all months and use the most recent one
canac Jan 8, 2025
259374e
Refactor nested ternary
canac Jan 8, 2025
e9e0beb
Merge pull request #1218 from CruGlobal/8480-hi-preferences
canac Jan 9, 2025
ce71bb4
Create bare bones of the MPD Health Indicator report page
dr-bizz Jan 9, 2025
be34ecf
Adding Monthly goal and HI graphs to report page
dr-bizz Jan 9, 2025
c1107db
Health Formula component
dr-bizz Jan 9, 2025
091a9c9
Show no data message if no HI data
dr-bizz Jan 9, 2025
2ce0474
Merge pull request #1228 from CruGlobal/8479-hi-report-page
dr-bizz Jan 9, 2025
88812d6
Use the calculated support goal in the monthly goal thermometer
dr-bizz Jan 10, 2025
f295759
Animate MPD Health Indicator widget, so it is like the other cards an…
dr-bizz Jan 10, 2025
a597578
Moved the HI GQL query to Monthly Goal to make the code less confusin…
dr-bizz Jan 10, 2025
3dc1f04
Merge pull request #1254 from CruGlobal/health-indicator-improvements
dr-bizz Jan 10, 2025
3dbf252
REVERT BEFORE MERGE: use staging API for this branch
canac Feb 11, 2025
c7984a0
Fix health indicator tests
canac Feb 11, 2025
17a9123
Default to calculated goal on accounts list page
canac Feb 11, 2025
1b800f1
Show calculated goal in preferences goal accordion
canac Feb 11, 2025
8489b32
Make explanations consistently lowercase
canac Feb 12, 2025
b268d9a
Use additional boolean in calculations
canac Feb 12, 2025
9f74063
Add estimated indicator
canac Feb 12, 2025
3b19192
Merge pull request #1265 from CruGlobal/8538-hi-accounts-list-goal
canac Feb 12, 2025
4e70c65
Merge pull request #1266 from CruGlobal/8539-hi-preferences-goal
canac Feb 12, 2025
c2df079
Add id field to query
canac Feb 12, 2025
810f6c0
Merge branch 'main' into health-indicator
canac Feb 13, 2025
14e6cc7
Add preferences link when using calculated goal
canac Feb 13, 2025
d01cfeb
Merge pull request #1270 from CruGlobal/8540-hi-preferences-link
canac Feb 14, 2025
5ac296f
Add health indicator explanations
canac Feb 12, 2025
403dd83
Add chevron to accordions
canac Feb 13, 2025
8848f24
Use cached HI data when available
canac Feb 13, 2025
08d8a27
Remove additional padding
canac Feb 13, 2025
45f7306
Style accordions like preferences
canac Feb 13, 2025
deb1e46
Merge pull request #1268 from CruGlobal/8541-hi-expanded-text
canac Feb 14, 2025
93c93a6
Augment DonationHistories goal with health indicator data
canac Feb 12, 2025
a9b449a
Extract graph calculations into hook
canac Feb 12, 2025
4c42e3b
Add tests
canac Feb 12, 2025
0327c08
Show goal in legend even if it is not set
canac Feb 14, 2025
071f128
Fix clicking graph in coaching redirecting away
canac Feb 14, 2025
50cefbd
Remove dots from goal line
canac Feb 14, 2025
73e24ca
Use machine calculated goal when staff-entered goal is unavailable
canac Feb 14, 2025
ddcfc71
Use color from palette for reference line
canac Feb 18, 2025
876c0ce
Mock ComposedCharts and add click handler tests
canac Feb 18, 2025
8e999b0
Fix recharts warning by moving height to ResponsiveContainer
canac Feb 18, 2025
2dfb422
Prefer staff-entered goal over machine-calculated goal in the current…
canac Feb 21, 2025
0091d64
Extrapolate missing health indicator periods
canac Feb 21, 2025
4dcc38a
Merge pull request #1269 from CruGlobal/8542-hi-support-goal-history
canac Feb 24, 2025
840ab70
Visually indicate machine-calculated goals in accounts grid
canac Mar 18, 2025
d6c6dbf
Use strings for name query
canac Mar 18, 2025
4446ed0
Visually indicate machine-calculated goals on the dashboard
canac Mar 18, 2025
5f4841f
Remove unused method
canac Mar 19, 2025
22f1ad8
Use status colors from brand guidelines
canac Mar 19, 2025
6377821
Use an asterisk to link goal and error message
canac Mar 20, 2025
0e03f9e
Merge pull request #1279 from CruGlobal/8564-indicate-machine-calcula…
canac Mar 20, 2025
a2cf16c
Merge branch 'main' into health-indicator
canac Mar 24, 2025
71ddbc0
Indicate when the goal was last updated
canac Mar 20, 2025
95e4fe7
Show goal updated time in preferences
canac Mar 20, 2025
8c2e5f7
Make annotation handling more flexible
canac Mar 21, 2025
a1c8392
Update HealthIndicatorWidget
canac Mar 24, 2025
953f340
Add brand colors to cruColors and move other colors to mpdxColors
canac Mar 28, 2025
4a3d7f2
Update graph colors for better contrast
canac Mar 28, 2025
5f9de3c
Use more descriptive TypeScript type names in palette
canac Mar 31, 2025
d84b3bd
Extrapolate missing HI periods
canac Mar 26, 2025
da0893b
Pick the latest available HI period in DonationHistories
canac Mar 26, 2025
4008c12
Treat blank values as zero
canac Apr 10, 2025
e88d332
Merge pull request #1286 from CruGlobal/8567-multiple-data-points
canac Apr 11, 2025
5592765
Increase legend text contrast
canac Mar 31, 2025
c3fb9f3
Adjust donations graph colors
canac Mar 31, 2025
2e6d768
Make the goal line dashed gray
canac Apr 10, 2025
34d2357
Merge pull request #1289 from CruGlobal/8569-graph-colors
canac Apr 11, 2025
b1cd769
Clarify overall average label
canac Mar 28, 2025
e0f8581
Merge pull request #1290 from CruGlobal/8570-hi-average-label
canac Apr 15, 2025
091612a
Warn if the goal is below the machine-calculated goal
canac Mar 21, 2025
b348d96
Add low goal, old goal, and machine-calculated goal annotations to da…
canac Mar 21, 2025
4f01759
Extract HI logic into reusable module
canac Mar 21, 2025
473ee43
Use getHealthIndicatorInfo in AccountLists
canac Mar 21, 2025
09777b5
Use getHealthIndicatorInfo in MonthlyGoalAccordion
canac Mar 21, 2025
100da01
Add low goal warning to My Accounts grid
canac Mar 24, 2025
b0fee78
Adjust annotations based on new stakeholder mockups
canac Mar 26, 2025
70b8d64
Add success/warning/error colors to the theme
canac Mar 26, 2025
e5651a9
Use getHealthIndicatorInfo in graphData
canac Mar 27, 2025
8ff83fd
Remove unused mismatchedCurrencies property
canac Mar 27, 2025
2b30e9b
Move the annotation next to the goal when there isn't HI data
canac Mar 27, 2025
7aff140
Merge pull request #1284 from CruGlobal/8566-goal-warning
canac Apr 15, 2025
fc1024e
Merge branch 'health-indicator' into 8565-preference-goal-date
canac Apr 15, 2025
616e6ce
Load currency from AccountList instead of AccountListSettings
canac Apr 21, 2025
89e4489
Merge pull request #1283 from CruGlobal/8565-preference-goal-date
canac Apr 21, 2025
9d74ca0
Stop loading all HI periods when only the latest is needed
canac Mar 31, 2025
b4efd8d
Use getHealthIndicatorInfo in DonationHistories
canac Mar 31, 2025
5b7b0e0
Replace machine-calculated labels with NetSuite-calculated
canac Apr 21, 2025
d0afb66
Replace "machine calculated" with "machine-calculated" in test names
canac Apr 21, 2025
c05b446
Merge pull request #1292 from CruGlobal/8567-optimize-queries
canac Apr 21, 2025
4b5379f
Merge pull request #1299 from CruGlobal/8569-netsuite-calculated
canac Apr 23, 2025
a4a1059
Merge branch 'main' into health-indicator
canac May 21, 2025
77a0ac5
Make the goal line dashed for users without HI data
canac May 20, 2025
ad109f5
Update health indicator data missing message
canac May 20, 2025
fe5508d
Merge pull request #1316 from CruGlobal/8569-goal-line-dashed
canac May 21, 2025
8a9dd55
Merge pull request #1317 from CruGlobal/8568-missing-data-message
canac May 21, 2025
11ea806
Remove missing indicators from the weighted average
canac Mar 28, 2025
b8d3e42
Add the detailed MPD Health formula description
canac May 21, 2025
4c5c41f
Create constants for weights
canac May 23, 2025
35142f3
Merge pull request #1320 from CruGlobal/8582-missing-indicators
canac May 23, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

env:
# Use production API for codegen to make sure production is compatible with the code to be merged
API_URL: 'https://api.mpdx.org/graphql'
API_URL: 'https://api.stage.mpdx.org/graphql' # TODO: Revert this before merging!
SITE_URL: 'http://stage.mpdx.org'

jobs:
Expand Down
6 changes: 6 additions & 0 deletions __tests__/util/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ Object.defineProperty(window, 'location', {

window.HTMLElement.prototype.scrollIntoView = jest.fn();

window.ResizeObserver = jest.fn().mockReturnValue({
observe: jest.fn(),
unobserve: jest.fn(),
disconnect: jest.fn(),
});

window.URL.revokeObjectURL = jest.fn();

beforeEach(() => {
Expand Down
14 changes: 0 additions & 14 deletions __tests__/util/windowResizeObserver.ts

This file was deleted.

4 changes: 4 additions & 0 deletions graphql.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"schema": "src/graphql/schema.graphql",
"documents": "**/*.graphql"
}
2 changes: 1 addition & 1 deletion pages/404.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import BaseLayout from 'src/components/Layouts/Basic';
import useGetAppSettings from 'src/hooks/useGetAppSettings';

const BoxWrapper = styled(Box)(({ theme }) => ({
backgroundColor: theme.palette.cruGrayLight.main,
backgroundColor: theme.palette.mpdxGrayLight.main,
height: 300,
minWidth: 700,
margin: 'auto',
Expand Down
2 changes: 1 addition & 1 deletion pages/500.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import BaseLayout from 'src/components/Layouts/Basic';
import useGetAppSettings from 'src/hooks/useGetAppSettings';

const BoxWrapper = styled(Box)(({ theme }) => ({
backgroundColor: theme.palette.cruGrayLight.main,
backgroundColor: theme.palette.mpdxGrayLight.main,
height: 300,
minWidth: 700,
margin: 'auto',
Expand Down
6 changes: 6 additions & 0 deletions pages/GetAccountLists.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@ query GetAccountLists {
id
name
monthlyGoal
monthlyGoalUpdatedAt
receivedPledges
totalPledges
currency
healthIndicatorData {
id
machineCalculatedGoal
machineCalculatedGoalCurrency
}
}
}
}
12 changes: 11 additions & 1 deletion pages/accountLists/GetDashboard.graphql
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
query GetDashboard($accountListId: ID!) {
query GetDashboard($accountListId: ID!, $periodBegin: ISO8601Date!) {
user {
id
firstName
}
accountList(id: $accountListId) {
id
name
monthlyGoal
monthlyGoalUpdatedAt
receivedPledges
totalPledges
currency
Expand All @@ -21,11 +23,19 @@ query GetDashboard($accountListId: ID!) {
averageIgnoreCurrent
periods {
startDate
endDate
convertedTotal
totals {
currency
convertedAmount
}
}
}
healthIndicatorData(accountListId: $accountListId, beginDate: $periodBegin) {
id
indicationPeriodBegin
machineCalculatedGoal
machineCalculatedGoalCurrency
staffEnteredGoal
}
}
1 change: 1 addition & 0 deletions pages/accountLists/[accountListId].page.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ describe('AccountListsId page', () => {
contacts: {
totalCount: 5,
},
healthIndicatorData: [],
},
}),
});
Expand Down
5 changes: 5 additions & 0 deletions pages/accountLists/[accountListId].page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Head from 'next/head';
import React, { ReactElement, useEffect, useState } from 'react';
import { ApolloError } from '@apollo/client';
import { DateTime } from 'luxon';
import {
GetDefaultAccountDocument,
GetDefaultAccountQuery,
Expand Down Expand Up @@ -106,6 +107,10 @@ export const getServerSideProps = makeGetServerSideProps(
query: GetDashboardDocument,
variables: {
accountListId: query.accountListId,
periodBegin: DateTime.now()
.startOf('month')
.minus({ years: 1 })
.toISODate(),
// TODO: implement these variables in query
// endOfDay: DateTime.local().endOf('day').toISO(),
// today: DateTime.local().endOf('day').toISODate(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import React from 'react';
import { ThemeProvider } from '@mui/material/styles';
import { LocalizationProvider } from '@mui/x-date-pickers';
import { AdapterLuxon } from '@mui/x-date-pickers/AdapterLuxon';
import { render } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { SnackbarProvider } from 'notistack';
import { I18nextProvider } from 'react-i18next';
import TestRouter from '__tests__/util/TestRouter';
import { GqlMockedProvider } from '__tests__/util/graphqlMocking';
import i18n from 'src/lib/i18n';
import theme from 'src/theme';
import HealthIndicatorPage from './index.page';

const accountListId = 'account-list-1';
const router = {
query: { accountListId },
isReady: true,
};

const Components = () => (
<I18nextProvider i18n={i18n}>
<LocalizationProvider dateAdapter={AdapterLuxon}>
<SnackbarProvider>
<ThemeProvider theme={theme}>
<TestRouter router={router}>
<GqlMockedProvider>
<HealthIndicatorPage />
</GqlMockedProvider>
</TestRouter>
</ThemeProvider>
</SnackbarProvider>
</LocalizationProvider>
</I18nextProvider>
);

describe('MPD Health Indicator Page', () => {
it('should show initial financial accounts page', async () => {
const { findByText } = render(<Components />);

expect(await findByText('Overall Staff MPD Health')).toBeInTheDocument();
});

it('should open and close menu', async () => {
const { findByRole, getByRole, queryByRole } = render(<Components />);

userEvent.click(
await findByRole('button', { name: 'Toggle Navigation Panel' }),
);
expect(getByRole('heading', { name: 'Reports' })).toBeInTheDocument();
userEvent.click(getByRole('img', { name: 'Close' }));
expect(queryByRole('heading', { name: 'Reports' })).not.toBeInTheDocument();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import Head from 'next/head';
import React, { useState } from 'react';
import { Box } from '@mui/material';
import { useTranslation } from 'react-i18next';
import { ensureSessionAndAccountList } from 'pages/api/utils/pagePropsHelpers';
import { SidePanelsLayout } from 'src/components/Layouts/SidePanelsLayout';
import Loading from 'src/components/Loading';
import { HealthIndicatorReport } from 'src/components/Reports/HealthIndicatorReport/HealthIndicatorReport';
import { headerHeight } from 'src/components/Shared/Header/ListHeader';
import {
MultiPageMenu,
NavTypeEnum,
} from 'src/components/Shared/MultiPageLayout/MultiPageMenu/MultiPageMenu';
import { useAccountListId } from 'src/hooks/useAccountListId';
import useGetAppSettings from 'src/hooks/useGetAppSettings';

const HealthIndicatorPage: React.FC = () => {
const { t } = useTranslation();
const accountListId = useAccountListId();
const { appName } = useGetAppSettings();
const [navListOpen, setNavListOpen] = useState(false);

const handleNavListToggle = () => {
setNavListOpen(!navListOpen);
};
return (
<>
<Head>
<title>{`${appName} | ${t('Reports - MPD Health')}`}</title>
</Head>

{accountListId ? (
<Box sx={{ background: 'common.white' }}>
<SidePanelsLayout
headerHeight={headerHeight}
isScrollBox={false}
leftOpen={navListOpen}
leftWidth="290px"
mainContent={
<HealthIndicatorReport
accountListId={accountListId}
isNavListOpen={navListOpen}
onNavListToggle={handleNavListToggle}
title={t('Overall Staff MPD Health')}
/>
}
leftPanel={
<MultiPageMenu
isOpen={navListOpen}
selectedId="healthIndicator"
onClose={handleNavListToggle}
navType={NavTypeEnum.Reports}
/>
}
/>
</Box>
) : (
<Loading loading />
)}
</>
);
};

export const getServerSideProps = ensureSessionAndAccountList;

export default HealthIndicatorPage;
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
} from 'src/components/Settings/preferences/GetAccountPreferences.generated';
import { GetPersonalPreferencesQuery } from 'src/components/Settings/preferences/GetPersonalPreferences.generated';
import { GetProfileInfoQuery } from 'src/components/Settings/preferences/GetProfileInfo.generated';
import { MachineCalculatedGoalQuery } from 'src/components/Settings/preferences/accordions/MonthlyGoalAccordion/MachineCalculatedGoal.generated';
import { TestSetupProvider } from 'src/components/Setup/SetupProvider';
import theme from 'src/theme';
import Preferences from './preferences.page';
Expand Down Expand Up @@ -68,6 +69,7 @@ const MocksProviders: React.FC<MocksProvidersProps> = ({
GetPersonalPreferences: GetPersonalPreferencesQuery;
GetProfileInfo: GetProfileInfoQuery;
CanUserExportData: CanUserExportDataQuery;
MachineCalculatedGoal: MachineCalculatedGoalQuery;
}>
mocks={{
GetAccountPreferences: {
Expand All @@ -79,10 +81,10 @@ const MocksProviders: React.FC<MocksProvidersProps> = ({
name: 'test',
activeMpdMonthlyGoal: null,
activeMpdFinishAt: null,
currency: 'USD',
activeMpdStartAt: null,
salaryOrganizationId: null,
settings: {
currency: 'USD',
homeCountry: 'USA',
monthlyGoal: 100,
tester: true,
Expand Down Expand Up @@ -132,6 +134,11 @@ const MocksProviders: React.FC<MocksProvidersProps> = ({
exportedAt: null,
},
},
MachineCalculatedGoal: {
accountList: {
healthIndicatorData: null,
},
},
}}
onCall={mutationSpy}
>
Expand Down
16 changes: 7 additions & 9 deletions pages/accountLists/[accountListId]/settings/preferences.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -248,73 +248,71 @@
accountPreferencesData?.accountList?.settings?.monthlyGoal ||
null
}
accountListId={accountListId}
currency={
accountPreferencesData?.accountList?.settings?.currency || ''
monthlyGoalUpdatedAt={
accountPreferencesData?.accountList?.monthlyGoalUpdatedAt ??
null
}
accountListId={accountListId}
currency={accountPreferencesData?.accountList?.currency || null}
disabled={onSetupTour && setup !== 1}
handleSetupChange={handleSetupChange}
/>
<HomeCountryAccordion
handleAccordionChange={setExpandedAccordion}
expandedAccordion={expandedAccordion}
homeCountry={
accountPreferencesData?.accountList?.settings?.homeCountry || ''
}
accountListId={accountListId}
countries={countries}
disabled={onSetupTour && setup !== 2}
handleSetupChange={handleSetupChange}
/>
<CurrencyAccordion
handleAccordionChange={setExpandedAccordion}
expandedAccordion={expandedAccordion}
currency={
accountPreferencesData?.accountList?.settings?.currency || ''
}
currency={accountPreferencesData?.accountList?.currency || null}
accountListId={accountListId}
disabled={onSetupTour}
/>
{userOrganizationAccountsData?.userOrganizationAccounts &&
userOrganizationAccountsData?.userOrganizationAccounts?.length >
1 && (
<PrimaryOrgAccordion
handleAccordionChange={setExpandedAccordion}
expandedAccordion={expandedAccordion}
organizations={userOrganizationAccountsData}
salaryOrganizationId={
accountPreferencesData?.accountList?.salaryOrganizationId ||
''
}
accountListId={accountListId}
disabled={onSetupTour}
/>
)}
<EarlyAdopterAccordion
handleAccordionChange={setExpandedAccordion}
expandedAccordion={expandedAccordion}
tester={
accountPreferencesData?.accountList?.settings?.tester || false
}
accountListId={accountListId}
disabled={onSetupTour}
/>
<MpdInfoAccordion
handleAccordionChange={setExpandedAccordion}
expandedAccordion={expandedAccordion}
activeMpdStartAt={
accountPreferencesData?.accountList?.activeMpdStartAt || ''
}
activeMpdFinishAt={
accountPreferencesData?.accountList?.activeMpdFinishAt || ''
}
activeMpdMonthlyGoal={
accountPreferencesData?.accountList?.activeMpdMonthlyGoal ||
null
}
currency={
accountPreferencesData?.accountList?.settings?.currency || ''
}
currency={accountPreferencesData?.accountList?.currency || ''}

Check notice on line 315 in pages/accountLists/[accountListId]/settings/preferences.page.tsx

View check run for this annotation

CodeScene Delta Analysis / CodeScene Cloud Delta Analysis (main)

✅ Getting better: Complex Method

Preferences:React.FC decreases in cyclomatic complexity from 86 to 85, threshold = 10. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
accountListId={accountListId}
disabled={onSetupTour}
/>
Expand Down
7 changes: 3 additions & 4 deletions pages/api/Schema/CoachingAnswerSets/dataHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import {
CoachingAnswerSet,
CoachingQuestion,
} from 'src/graphql/types.generated';

const isNotNull = <T>(item: T | null): item is T => item !== null;
import { isNotNullish } from 'src/lib/typeGuards';

interface CoachingAnswerSetData {
id: string;
Expand Down Expand Up @@ -77,10 +76,10 @@ const parseCoachingAnswerSet = (
};
const answers = relationships.answers.data
.map(({ id }) => getIncludedAnswer(id, included))
.filter(isNotNull);
.filter(isNotNullish);
const questions = relationships.questions.data
.map(({ id }) => getIncludedQuestion(id, included))
.filter(isNotNull);
.filter(isNotNullish);

return {
id,
Expand Down
2 changes: 1 addition & 1 deletion pages/logout.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { clearDataDogUser } from 'src/lib/dataDog';
import { ensureSessionAndAccountList } from './api/utils/pagePropsHelpers';

const BoxWrapper = styled(Box)(({ theme }) => ({
backgroundColor: theme.palette.cruGrayLight.main,
backgroundColor: theme.palette.mpdxGrayLight.main,
height: 300,
minWidth: 700,
margin: 'auto',
Expand Down
Loading
Loading