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

QA dashboard overview FE #2329

Open
wants to merge 189 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
189 commits
Select commit Hold shift + click to select a range
867a45d
adding overview to qa dashbaord
AdamAdHocTeam Aug 27, 2024
dcaed9a
audit vuln and test
AdamAdHocTeam Aug 27, 2024
00af0ec
make generic overview widget
AdamAdHocTeam Aug 28, 2024
0abcc02
audit vuln ignore
AdamAdHocTeam Aug 28, 2024
17a559d
changed resource and qa to use same underlying componenet still need …
AdamAdHocTeam Aug 28, 2024
f47316c
merge main
AdamAdHocTeam Aug 28, 2024
5d8f73a
css cleanup
AdamAdHocTeam Aug 28, 2024
6e11760
match font and icon size on regional dashboard
AdamAdHocTeam Aug 29, 2024
f383ed3
updates for recipients with no tta WIP
AdamAdHocTeam Sep 3, 2024
719b2b5
Use current branch
thewatermethod Sep 4, 2024
78966d8
Initial commit
thewatermethod Sep 4, 2024
a005c4d
file rename
AdamAdHocTeam Sep 4, 2024
4c19317
add subfilters hook for filter panel
thewatermethod Sep 4, 2024
3d906eb
Filter config properly stripped per page
thewatermethod Sep 4, 2024
780a4a0
Merge remote-tracking branch 'origin/main' into mb/TTAHUB-3345/filter…
thewatermethod Sep 4, 2024
1d2a226
Add tests
thewatermethod Sep 4, 2024
23057d0
fixes per Matt
AdamAdHocTeam Sep 4, 2024
2b45b79
audit vuln
AdamAdHocTeam Sep 4, 2024
865c1d1
more css updates per Matt
AdamAdHocTeam Sep 4, 2024
6904903
merge main
AdamAdHocTeam Sep 4, 2024
c0afcb5
Add test for uncovered files
thewatermethod Sep 4, 2024
551b342
update regional dashboard overview to use new widget
AdamAdHocTeam Sep 5, 2024
3fec804
Merge branch 'al-ttahub-3316-3317-overview-widgets' into al-display-d…
AdamAdHocTeam Sep 5, 2024
503aee3
push to dev for UI review
AdamAdHocTeam Sep 6, 2024
9c364f6
updates for generic widget paging hook
AdamAdHocTeam Sep 6, 2024
aa7a53e
updates with tests for drill downs
AdamAdHocTeam Sep 6, 2024
25bc5b3
Merge remote-tracking branch origin/al-display-details-for-qa-dashbao…
thewatermethod Sep 6, 2024
0d59c65
remove error for coverage
AdamAdHocTeam Sep 6, 2024
9c5e831
added recips with ohs standard fei and hoooked up modals to the first…
AdamAdHocTeam Sep 6, 2024
f6f3098
Merge remote-tracking branch origin/al-display-details-for-qa-dashbao…
thewatermethod Sep 9, 2024
62e0226
Add filter code to recipients with no tta
thewatermethod Sep 9, 2024
b3c0c88
Remove unneeded lint ignores
thewatermethod Sep 9, 2024
a09c045
Merge branch 'al-ttahub-3316-3317-overview-widgets' into al-display-d…
AdamAdHocTeam Sep 9, 2024
9f63e36
merge latest and push to dev
AdamAdHocTeam Sep 9, 2024
62c95f1
add ssdi fetcher for use with backend
thewatermethod Sep 9, 2024
94d6206
Add domain filter select
thewatermethod Sep 9, 2024
4aff0bf
Raise coverage thres, add some tests for coverage
thewatermethod Sep 9, 2024
35b37dc
Add loader test
thewatermethod Sep 9, 2024
f0e4239
Add additioanl test
thewatermethod Sep 9, 2024
ef927c9
More test coverage
thewatermethod Sep 9, 2024
8ed83de
Fix DomainResultFilter test
thewatermethod Sep 9, 2024
1c3cbec
Add StepIndicator test
thewatermethod Sep 9, 2024
c5eb3c5
Add two more tests
thewatermethod Sep 9, 2024
6165551
add another test, remove unused file
thewatermethod Sep 9, 2024
283045e
Add tests for fetchers
thewatermethod Sep 9, 2024
3fbd1d8
Added more tests
thewatermethod Sep 9, 2024
dc481d0
Add filter key test
thewatermethod Sep 9, 2024
1f067e8
Add test for training report filters
thewatermethod Sep 9, 2024
6c6cf1d
Revert package.json
thewatermethod Sep 9, 2024
43be196
fixes and test updates per Matt
AdamAdHocTeam Sep 9, 2024
dcfec7c
add test will add more realistic testing once filters are hooked up
AdamAdHocTeam Sep 9, 2024
9c78aae
Merge remote-tracking branch origin/al-display-details-for-qa-dashbao…
thewatermethod Sep 10, 2024
e472afb
add QA dashboard test
thewatermethod Sep 10, 2024
bbe55d0
Add many tests
thewatermethod Sep 10, 2024
c223253
Add useFilters test
thewatermethod Sep 10, 2024
35bd35c
add more tests
thewatermethod Sep 10, 2024
322f0af
add test for RUS
thewatermethod Sep 10, 2024
1756177
Add resource dashboard test
thewatermethod Sep 10, 2024
40d97c7
another test, this time for use filters
thewatermethod Sep 10, 2024
d1089d6
Add known issues override
thewatermethod Sep 10, 2024
e61cd90
Move support link to constants
thewatermethod Sep 10, 2024
db950ad
more audit ignore
thewatermethod Sep 10, 2024
ac0aafa
changes per Matt
AdamAdHocTeam Sep 10, 2024
b787ca6
more refactor
thewatermethod Sep 10, 2024
55fc482
Remove unused file, remove impossible case
thewatermethod Sep 10, 2024
5137c3f
merge main
AdamAdHocTeam Sep 10, 2024
e0a47e4
Merge branch 'al-ttahub-3316-3317-overview-widgets' into al-display-d…
AdamAdHocTeam Sep 10, 2024
6159f63
Fix bug add tests event summary
thewatermethod Sep 10, 2024
a2ee4cc
merge
AdamAdHocTeam Sep 10, 2024
b8ada07
merge main again
AdamAdHocTeam Sep 10, 2024
d16c63c
ignore BE audit
AdamAdHocTeam Sep 10, 2024
1ea3704
Merge branch 'al-ttahub-3316-3317-overview-widgets' into al-display-d…
AdamAdHocTeam Sep 10, 2024
011face
ignore audit for now
AdamAdHocTeam Sep 10, 2024
e2771e1
more refactor
thewatermethod Sep 10, 2024
bbe046c
More refactoring for test coverage
thewatermethod Sep 10, 2024
8212f55
Update known issues again
thewatermethod Sep 10, 2024
2528758
Merge remote-tracking branch 'origin/al-display-details-for-qa-dashba…
thewatermethod Sep 10, 2024
783d5f0
90% branch coverage
thewatermethod Sep 10, 2024
83975a0
Merge branch 'al-ttahub-3316-3317-overview-widgets' into al-display-d…
AdamAdHocTeam Sep 10, 2024
f8a65d1
audit vuln ignore for now
AdamAdHocTeam Sep 11, 2024
e934d49
Merge branch 'al-ttahub-3316-3317-overview-widgets' into al-display-d…
AdamAdHocTeam Sep 11, 2024
8970675
Separate pull request to make review simpler
thewatermethod Sep 11, 2024
258ca07
Merge remote-tracking branch 'origin/al-display-details-for-qa-dashba…
thewatermethod Sep 11, 2024
b02a0c0
Merge branch 'mb/TTAHUB/3345/add-filters-to-qa-dash' into mb/TTAHUB-3…
thewatermethod Sep 11, 2024
5962737
WIP recipeints with class scores and goals
AdamAdHocTeam Sep 11, 2024
f6ec623
Merge branch main into mb/TTAHUB/3345/add-filters-to-qa-dash
thewatermethod Sep 11, 2024
8135ccc
Merge branch 'mb/TTAHUB/3345/add-filters-to-qa-dash' into mb/TTAHUB-3…
thewatermethod Sep 11, 2024
eb00b7f
Merge branch 'main' into mb/TTAHUB/3345/add-filters-to-qa-dash
thewatermethod Sep 11, 2024
94aadc4
Merge branch 'mb/TTAHUB/3345/add-filters-to-qa-dash' into mb/TTAHUB-3…
thewatermethod Sep 11, 2024
af4ca11
WIP added recipient and goal cards with base tests
AdamAdHocTeam Sep 12, 2024
acd09ef
merge main
AdamAdHocTeam Sep 12, 2024
48aa028
fix bad merge
AdamAdHocTeam Sep 12, 2024
7acab83
Merge branch 'al-ttahub-3316-3317-overview-widgets' into al-display-d…
AdamAdHocTeam Sep 12, 2024
9dda046
change prop name
AdamAdHocTeam Sep 12, 2024
34408fd
audit vulns be
AdamAdHocTeam Sep 12, 2024
077b3d3
Merge branch 'al-ttahub-3316-3317-overview-widgets' into al-display-d…
AdamAdHocTeam Sep 12, 2024
3d2f720
Updates and fixes per Kelly
AdamAdHocTeam Sep 13, 2024
ce4a32c
per Kelly remove left margin on drawer for fei
AdamAdHocTeam Sep 13, 2024
10c738a
Merge pull request #2349 from HHS/al-display-details-for-qa-dashbaord
AdamAdHocTeam Sep 13, 2024
d06ac1f
Merge remote-tracking branch origin/al-ttahub-3316-3317-overview-widg…
thewatermethod Sep 13, 2024
ffc88dd
Fix test
thewatermethod Sep 13, 2024
1c8ba98
Initial commit
thewatermethod Sep 16, 2024
9ec598b
Merge pull request #2355 from HHS/mb/TTAHUB-3345/filters-on-QA-dashboard
thewatermethod Sep 16, 2024
064446d
Fix test
thewatermethod Sep 16, 2024
cab051b
Merge pull request #2358 from HHS/mb/TTAHUB/3345/add-filters-to-qa-dash
thewatermethod Sep 16, 2024
c93b2d4
Begin to parameterize line graph
thewatermethod Sep 16, 2024
5caad14
badges cleanup and added to class details page
AdamAdHocTeam Sep 16, 2024
5653b39
Lots of refactoring
thewatermethod Sep 16, 2024
abd4e62
Merge branch 'al-ttahub-3316-3317-overview-widgets' into mb/TTAHUB-33…
thewatermethod Sep 16, 2024
ad22f09
updtes for class goals WIP
AdamAdHocTeam Sep 17, 2024
b6dd6d1
css cleanup
AdamAdHocTeam Sep 17, 2024
9138d9d
fix typo for test
AdamAdHocTeam Sep 17, 2024
f9f6fec
add remaining page controls and spread out over widget component WIP
AdamAdHocTeam Sep 18, 2024
80bcebf
Rolling more code uphill in the snow with no shoes
thewatermethod Sep 18, 2024
3f92fae
more cleanup and tests
AdamAdHocTeam Sep 18, 2024
6be31ac
More fixes to LineGraph, etc
thewatermethod Sep 18, 2024
00eae54
Merge branch 'main' into al-ttahub-3316-3317-overview-widgets
AdamAdHocTeam Sep 18, 2024
f420355
Merge branch 'al-ttahub-3316-3317-overview-widgets' of https://github…
AdamAdHocTeam Sep 18, 2024
730b9c1
fix merge
AdamAdHocTeam Sep 18, 2024
02d6b81
push to dev
AdamAdHocTeam Sep 18, 2024
6e601ca
Finalize changes
thewatermethod Sep 19, 2024
905a9b2
Merge remote-tracking branch 'origin/al-ttahub-3316-3317-overview-wid…
thewatermethod Sep 19, 2024
d37a0b0
Change baffling ARIA label
thewatermethod Sep 19, 2024
5769041
updates and fixes per Matt
AdamAdHocTeam Sep 19, 2024
09c5492
Remove deprecated tests
thewatermethod Sep 20, 2024
b0be4c5
Add some tests
thewatermethod Sep 20, 2024
5d7b915
Add some tests for hooks
thewatermethod Sep 20, 2024
d376bc4
Add more tests
thewatermethod Sep 20, 2024
99be080
e2e test fixes
thewatermethod Sep 20, 2024
4cd2475
Merge branch 'main' into al-ttahub-3316-3317-overview-widgets
AdamAdHocTeam Sep 20, 2024
5965987
hook up drawers for both the recipients with no tta and recipents wit…
AdamAdHocTeam Sep 20, 2024
03156f6
hook up param css and fix a font weight that was being applied
AdamAdHocTeam Sep 20, 2024
1b8a204
Merge remote-tracking branch 'origin/main' into mb/TTAHUB-3343/3348/3…
thewatermethod Sep 21, 2024
550786d
Add filters to QA dash
thewatermethod Sep 23, 2024
dfef9fa
Merge branch 'al-ttahub-3304-recipients-with-class-scores-details-pag…
thewatermethod Sep 23, 2024
6e76bbd
Merge pull request #2380 from HHS/al-ttahub-3341-filter-drawer-with-n…
AdamAdHocTeam Sep 23, 2024
36e96b1
Merge remote-tracking branch 'origin/main' into mb/TTAHUB-3346/qa-das…
thewatermethod Sep 23, 2024
f1f94ae
Add drawers and filters to last page
thewatermethod Sep 23, 2024
da3115d
Update failing tests
thewatermethod Sep 23, 2024
ef3596f
fix invalid HTML attr
thewatermethod Sep 23, 2024
0a03b18
Merge branch 'mb/TTAHUB-3346/qa-dashboard' into mb/TTAHUB-other-help-…
thewatermethod Sep 23, 2024
6bc2ddb
Merge branch 'al-ttahub-3316-3317-overview-widgets' into mb/TTAHUB-33…
thewatermethod Sep 23, 2024
78c7143
Merge remote-tracking branch 'origin/al-ttahub-3316-3317-overview-wid…
thewatermethod Sep 23, 2024
3faeff5
Merge branch 'mb/TTAHUB-3346/qa-dashboard' into mb/TTAHUB-other-help-…
thewatermethod Sep 23, 2024
0d27c0f
implement datarow component
AdamAdHocTeam Sep 23, 2024
bdaf491
Accidentally removed subtitle2
thewatermethod Sep 23, 2024
26d03e1
Merge branch 'mb/TTAHUB-3346/qa-dashboard' into mb/TTAHUB-other-help-…
thewatermethod Sep 23, 2024
1c8a646
Fix test, order content in widget correctly
thewatermethod Sep 23, 2024
d752090
left align card with widget title
AdamAdHocTeam Sep 23, 2024
bdfcca2
fix other widgets
AdamAdHocTeam Sep 23, 2024
0ec8213
Merge branch 'al-ttahub-3316-3317-overview-widgets' into al-ttahub-33…
AdamAdHocTeam Sep 24, 2024
d8db522
Merge remote-tracking branch 'origin/al-ttahub-3316-3317-overview-wid…
thewatermethod Sep 24, 2024
82e7411
merge latest
AdamAdHocTeam Sep 24, 2024
724a447
audit vuln
AdamAdHocTeam Sep 24, 2024
cee3b5c
remove console logs
AdamAdHocTeam Sep 24, 2024
6105e96
Merge branch 'main' into al-ttahub-3316-3317-overview-widgets
AdamAdHocTeam Sep 24, 2024
8016710
audit vulns
AdamAdHocTeam Sep 24, 2024
6e16687
try audits again
AdamAdHocTeam Sep 24, 2024
bc6e2d2
Merge remote-tracking branch 'origin/al-ttahub-3316-3317-overview-wid…
thewatermethod Sep 24, 2024
9d5d498
Put back test that should not have been removed
thewatermethod Sep 24, 2024
39e5bdb
Merge remote-tracking branch 'origin/al-ttahub-3316-3317-overview-wid…
thewatermethod Sep 24, 2024
c0eb174
Merge branch 'mb/TTAHUB-3346/qa-dashboard' into mb/TTAHUB-other-help-…
thewatermethod Sep 24, 2024
9b81816
Merge pull request #2359 from HHS/al-ttahub-3304-recipients-with-clas…
AdamAdHocTeam Sep 24, 2024
55da958
Merge remote-tracking branch 'origin/al-ttahub-3316-3317-overview-wid…
thewatermethod Sep 25, 2024
a12cd92
Merge pull request #2371 from HHS/mb/TTAHUB-3346/qa-dashboard
thewatermethod Sep 25, 2024
1b9631d
put on dev for UX
AdamAdHocTeam Sep 25, 2024
a73580e
Fix for font inheritance
thewatermethod Sep 25, 2024
8ac6156
Fix tests
thewatermethod Sep 25, 2024
205e32f
Merge pull request #2382 from HHS/mb/TTAHUB-other-help-drawers-qa-das…
thewatermethod Sep 25, 2024
cb73832
Merge remote-tracking branch origin/al-ttahub-3316-3317-overview-wid…
thewatermethod Sep 26, 2024
fe54ec0
Merge pull request #2381 from HHS/mb/TTAHUB-3344/add-feeds
thewatermethod Sep 26, 2024
1b46bda
Merge remote-tracking branch origin/main into al-ttahub-3316-3317-ove…
thewatermethod Sep 26, 2024
dc3a717
remove unwanted goal links and update css for column spacing of recip…
AdamAdHocTeam Sep 26, 2024
542ada0
fix test'
AdamAdHocTeam Sep 26, 2024
b570ddb
update font size of badge
AdamAdHocTeam Sep 26, 2024
87a0423
increase font
AdamAdHocTeam Sep 27, 2024
0cb2a11
Merge branch 'main' into al-ttahub-3316-3317-overview-widgets
AdamAdHocTeam Sep 30, 2024
0032e07
Update tag prop to be correct
thewatermethod Sep 30, 2024
9e3cb52
Update tag name
thewatermethod Oct 1, 2024
f887d55
Adjust CSS
thewatermethod Oct 2, 2024
a15cd22
tweak graph formatting
thewatermethod Oct 3, 2024
49eac29
Merge branch 'TTAHUB-3361/ssdi-refactor' into al-ttahub-3316-3317-ove…
AdamAdHocTeam Oct 8, 2024
9a1061b
Merge branch 'al-ttahub-3316-3317-overview-widgets' of https://github…
AdamAdHocTeam Oct 8, 2024
8f0adb2
merge main
AdamAdHocTeam Oct 9, 2024
a0b4657
Merge branch 'main' into al-ttahub-3316-3317-overview-widgets
AdamAdHocTeam Oct 10, 2024
6c1c575
Merge branch 'main' into al-ttahub-3316-3317-overview-widgets
AdamAdHocTeam Oct 15, 2024
65fbdc9
merge main
AdamAdHocTeam Oct 16, 2024
68a3daa
merge main
AdamAdHocTeam Oct 21, 2024
3e8e9da
lint
AdamAdHocTeam Oct 21, 2024
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
56 changes: 56 additions & 0 deletions frontend/src/pages/QADashboard/__tests__/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/* eslint-disable max-len */
import '@testing-library/jest-dom';
import React from 'react';
import { SCOPE_IDS } from '@ttahub/common';
import { Router } from 'react-router-dom';
import { createMemoryHistory } from 'history';
import {
render,
screen,
} from '@testing-library/react';
import fetchMock from 'fetch-mock';

import QADashboard from '../index';
import UserContext from '../../../UserContext';
import AriaLiveContext from '../../../AriaLiveContext';

const history = createMemoryHistory();
const mockAnnounce = jest.fn();

const defaultUser = {
homeRegionId: 14,
permissions: [{
regionId: 1,
scopeId: SCOPE_IDS.READ_ACTIVITY_REPORTS,
}, {
regionId: 2,
scopeId: SCOPE_IDS.READ_ACTIVITY_REPORTS,
}],
};

describe('Resource Dashboard page', () => {
afterEach(() => fetchMock.restore());
const renderQADashboard = (user) => {
render(
<UserContext.Provider value={{ user }}>
<AriaLiveContext.Provider value={{ announce: mockAnnounce }}>
<Router history={history}>
<QADashboard user={user} />
</Router>
</AriaLiveContext.Provider>
</UserContext.Provider>,
);
};

it('renders correctly', async () => {
renderQADashboard(defaultUser);

// Header
expect(await screen.findByText('Quality assurance dashboard')).toBeVisible();

// Overview
expect(await screen.findByText('Recipients with no TTA')).toBeVisible();
expect(await screen.findByText('Recipients with OHS standard FEI goal')).toBeVisible();
expect(await screen.findByText('Recipients with OHS standard CLASS goal')).toBeVisible();
});
});
21 changes: 20 additions & 1 deletion frontend/src/pages/QADashboard/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import React from 'react';
import React, { useState } from 'react';
import { Helmet } from 'react-helmet';
import { Grid, Alert } from '@trussworks/react-uswds';
import QAOverview from '../../widgets/QualityAssuranceDashboardOverview';

export default function QADashboard() {
const [error] = useState(null);
thewatermethod marked this conversation as resolved.
Show resolved Hide resolved

return (
<>
<Helmet>
Expand All @@ -11,6 +15,21 @@ export default function QADashboard() {
<h1 className="landing margin-top-0 margin-bottom-3">
Quality assurance dashboard
</h1>
<Grid row>
{error && (
<Alert className="margin-bottom-2" type="error" role="alert">
{error}
</Alert>
)}
</Grid>
<QAOverview
data={{
recipientsWithNoTTA: { pct: '2.52%', filterApplicable: true },
recipientsWithOhsStandardFeiGoals: { pct: '73.25%', filterApplicable: false },
recipientsWithOhsStandardClass: { pct: '14.26%', filterApplicable: false },
}}
loading={false}
/>
</div>
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe('Recipient Record - TTA History', () => {

it('renders the TTA History page appropriately', async () => {
act(() => renderTTAHistory());
const overview = document.querySelector('.smart-hub--dashboard-overview');
const overview = document.querySelector('.smart-hub--dashboard-overview-container');
expect(overview).toBeTruthy();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('Training report Dashboard page', () => {
expect(fetchMock.calls(hoursOfTrainingUrl)).toHaveLength(1);
expect(fetchMock.calls(sessionsByTopicUrl)).toHaveLength(1);

expect(document.querySelector('.smart-hub--dashboard-overview')).toBeTruthy();
expect(document.querySelector('.smart-hub--dashboard-overview-container')).toBeTruthy();

expect(screen.getByText('Reasons in Training Reports')).toBeInTheDocument();
expect(screen.getByText('Hours of training by National Center')).toBeInTheDocument();
Expand Down
8 changes: 0 additions & 8 deletions frontend/src/pages/ResourcesDashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,6 @@ export default function ResourcesDashboard() {
<ResourcesDashboardOverview
data={resourcesData.resourcesDashboardOverview}
loading={isLoading}
fields={[
'Reports with resources',
'ECLKC Resources',
'Recipients reached',
'Participants reached',
'Reports citing iPD courses',
]}
showTooltips
/>
<ResourceUse
data={resourcesData.resourcesUse}
Expand Down
188 changes: 88 additions & 100 deletions frontend/src/widgets/DashboardOverview.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {
} from '@fortawesome/free-solid-svg-icons';
import withWidgetData from './withWidgetData';
import './DashboardOverview.css';
import Loader from '../components/Loader';
import Tooltip from '../components/Tooltip';
import colors from '../colors';
import { DashboardOverviewContainer } from './DashboardOverviewContainer';
import Tooltip from '../components/Tooltip';

export function Field({
label,
Expand Down Expand Up @@ -62,116 +62,104 @@ Field.defaultProps = {
showTooltip: false,
};

const DASHBOARD_FIELDS = {
'Activity reports': {
render: (data, showTooltip) => (
<Field
key="activity-reports"
showTooltip={showTooltip}
tooltipText="The number of approved activity reports."
icon={faChartColumn}
iconColor={colors.success}
backgroundColor={colors.successLighter}
label="Activity reports"
data={data.numReports}
/>
),
const getDashboardFields = (data, showTooltip) => ([
{
lookUpKey: 'Activity reports',
key: 'activity-reports',
showTooltip,
tooltipText: 'The number of approved activity reports.',
icon: faChartColumn,
iconColor: colors.success,
backgroundColor: colors.successLighter,
label1: 'Activity reports',
data: data.numReports,
},
'Training reports': {
render: (data, showTooltip) => (
<Field
key="training-reports"
showTooltip={showTooltip}
tooltipText="Training reports with a completed session"
icon={faChartColumn}
iconColor={colors.success}
backgroundColor={colors.successLighter}
label={`across ${data.numReports} Training Reports`}
data={`${data.numSessions} sessions`}
/>
),
{
lookUpKey: 'Training reports',
key: 'training-reports',
showTooltip,
tooltipText: 'Training reports with a completed session',
icon: faChartColumn,
iconColor: colors.success,
backgroundColor: colors.successLighter,
label1: `across ${data.numReports} Training Reports`,
data: `${data.numSessions} sessions`,
},
'Grants served': {
render: (data, showTooltip) => (
<Field
key="grants-served"
showTooltip={showTooltip}
icon={faBuilding}
iconColor={colors.ttahubMediumBlue}
backgroundColor={colors.ttahubBlueLight}
label="Grants served"
tooltipText="Each grant is only counted once"
data={data.numGrants}
/>
),
{
lookUpKey: 'Grants served',
key: 'grants-served',
showTooltip,
icon: faBuilding,
iconColor: colors.ttahubMediumBlue,
backgroundColor: colors.ttahubBlueLight,
label1: 'Grants served',
tooltipText: 'Each grant is only counted once',
data: data.numGrants,
},
Participants: {
render: (data, showTooltip) => (
<Field
key="participants"
showTooltip={showTooltip}
tooltipText="The number of people in all activities"
icon={faUserFriends}
iconColor={colors.ttahubBlue}
backgroundColor={colors.ttahubBlueLighter}
label="Participants"
data={data.numParticipants}
/>
),
{
lookUpKey: 'Participants',
key: 'participants',
showTooltip,
tooltipText: 'The number of people in all activities',
icon: faUserFriends,
iconColor: colors.ttahubBlue,
backgroundColor: colors.ttahubBlueLighter,
label1: 'Participants',
data: data.numParticipants,
},
'Hours of TTA': {
render: (data, showTooltip) => (
<Field
key="hours-of-tta"
showTooltip={showTooltip}
tooltipText="Rounded to the nearest half hour"
icon={faClock}
iconColor={colors.ttahubOrange}
backgroundColor={colors.ttahubOrangeLight}
label="Hours of TTA"
data={data.sumDuration}
decimalPlaces={1}
/>
),
{
lookUpKey: 'Hours of TTA',
key: 'hours-of-tta',
showTooltip,
tooltipText: 'Rounded to the nearest half hour',
icon: faClock,
iconColor: colors.ttahubOrange,
backgroundColor: colors.ttahubOrangeLight,
label1: 'Hours of TTA',
data: data.sumDuration,
decimalPlaces: 1,
},
'In person activities': {
render: (data, showTooltip) => (
<Field
key="in-person-activities"
icon={faUser}
showTooltip={showTooltip}
tooltipText="Excludes virtual activities"
iconColor={colors.ttahubMagenta}
backgroundColor={colors.ttahubMagentaLight}
label="In person activities"
data={data.inPerson}
/>
),
{
lookUpKey: 'In person activities',
key: 'in-person-activities',
icon: faUser,
showTooltip,
tooltipText: 'Excludes virtual activities',
iconColor: colors.ttahubMagenta,
backgroundColor: colors.ttahubMagentaLight,
label1: 'In person activities',
data: data.inPerson,
},
'Recipients served': {
render: (data, showTooltip) => (
<Field
key="recipients-served"
icon={faUser}
showTooltip={showTooltip}
label={`${data.numRecipients} ${data.numRecipients === 1 ? 'Recipient' : 'Recipients'} of ${data.totalRecipients}`}
iconColor={colors.ttahubMagenta}
backgroundColor={colors.ttahubMagentaLight}
tooltipText="Recipients have at least one active grant"
data={data.recipientPercentage}
/>
),
{
lookUpKey: 'Recipients served',
key: 'recipients-served',
icon: faUser,
showTooltip,
label1: `${data.numRecipients} ${data.numRecipients === 1 ? 'Recipient' : 'Recipients'} of ${data.totalRecipients}`,
iconColor: colors.ttahubMagenta,
backgroundColor: colors.ttahubMagentaLight,
tooltipText: 'Recipients have at least one active grant',
data: data.recipientPercentage,
},
};
]);

export function DashboardOverviewWidget({
data, loading, fields, showTooltips,
}) {
// Get the fields we need while maintaining the order.
const fieldsToDisplay = fields.map(
(field) => getDashboardFields(
data, showTooltips,
).find(
(f) => f.lookUpKey === field,
),
).filter(Boolean);

return (
<Grid row className="smart-hub--dashboard-overview margin-bottom-3 position-relative">
<Loader loading={loading} loadingLabel="Overview loading" />
{ fields.map((field) => DASHBOARD_FIELDS[field].render(data, showTooltips, field)) }
</Grid>
<DashboardOverviewContainer
fieldData={fieldsToDisplay}
loading={loading}
/>
);
}

Expand Down
Loading