qpp-style 9.33.3 → 9.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/SideNav/Details/PracticeDetails.jsx +6 -0
- package/components/SideNav/UI/SideNavUI.jsx +74 -37
- package/components/SideNav/helpers.js +22 -28
- package/components/SideNav/index.js +7 -29
- package/dist/browser.js +1 -1
- package/dist/browser.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +1 -1
- package/jest.config.js +0 -7
- package/package.json +1 -3
- package/styles/qppds/components/sidebar/_details.scss +3 -0
- package/components/SideNav/Chart/ScoreChart.jsx +0 -268
- package/components/SideNav/Chart/__tests__/ScoreChart.test.js +0 -22
- package/components/SideNav/Chart/__tests__/__snapshots__/ScoreChart.test.js.snap +0 -173
- package/components/SideNav/Chart/index.js +0 -3
|
@@ -8,6 +8,7 @@ const PracticeDetails = ({
|
|
|
8
8
|
vgId,
|
|
9
9
|
cpcPlusId,
|
|
10
10
|
pcfId,
|
|
11
|
+
subgroupId,
|
|
11
12
|
}) => {
|
|
12
13
|
function renderId() {
|
|
13
14
|
if (cpcPlusId) {
|
|
@@ -20,6 +21,10 @@ const PracticeDetails = ({
|
|
|
20
21
|
return <p className="practice-tin">VG ID: {vgId}</p>;
|
|
21
22
|
} else if (practiceTin) {
|
|
22
23
|
return <p className="practice-tin">TIN: {practiceTin}</p>;
|
|
24
|
+
} else if (subgroupId) {
|
|
25
|
+
return (
|
|
26
|
+
<p className="practice-tin subgroup-id">Subgroup ID: {subgroupId}</p>
|
|
27
|
+
);
|
|
23
28
|
} else {
|
|
24
29
|
return;
|
|
25
30
|
}
|
|
@@ -36,6 +41,7 @@ const PracticeDetails = ({
|
|
|
36
41
|
PracticeDetails.propTypes = {
|
|
37
42
|
practiceName: PropTypes.string,
|
|
38
43
|
practiceTin: PropTypes.string,
|
|
44
|
+
subgroupId: PropTypes.string,
|
|
39
45
|
apmEntityId: PropTypes.string,
|
|
40
46
|
vgId: PropTypes.string,
|
|
41
47
|
cpcPlusId: PropTypes.string,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, { useState, useRef, useEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import axios from 'axios';
|
|
3
4
|
|
|
4
|
-
import {
|
|
5
|
+
import { setSideNavExpanded, isSideNavExpanded } from '../helpers';
|
|
5
6
|
import { LevelOneContent } from '../Content';
|
|
6
7
|
import {
|
|
7
8
|
NavLinkContainer,
|
|
@@ -11,23 +12,45 @@ import {
|
|
|
11
12
|
} from '../Links';
|
|
12
13
|
import AnimationGroup from '../AnimationGroup/AnimationGroup';
|
|
13
14
|
import { PracticeDetails, IndividualDetails } from '../Details';
|
|
14
|
-
import ScoreChart from '../Chart';
|
|
15
15
|
import SanitizedContent from '../../SanitizedContent';
|
|
16
16
|
import * as SvgComponents from '../../../lib/SvgComponents.jsx';
|
|
17
17
|
import CmsSwitchLink from '../Links/CmsSwitchLink';
|
|
18
|
-
import axios from 'axios';
|
|
19
18
|
import defaultMarkup from './default-markup';
|
|
20
19
|
|
|
20
|
+
// TODO: For an SSR version of the SideNavUI we would need to have
|
|
21
|
+
// the whole SideNav markup render on the server. Less reliance on
|
|
22
|
+
// window and document.
|
|
23
|
+
// We can have an API created where we send it certain parameters
|
|
24
|
+
// like items. All of the markup is then returned. The SideNav can
|
|
25
|
+
// just render the markup provided by the Frontend Server.
|
|
26
|
+
// The only code left behind would be triggers to respond to
|
|
27
|
+
// toggling the sidenav's expand state
|
|
28
|
+
// Things to consider when implmenting an SSR version:
|
|
29
|
+
// 1. any buttons will need event listeners to trigger actions.
|
|
30
|
+
// 2. we need a feature flag to roll this out since it will be
|
|
31
|
+
// a breaking change.
|
|
32
|
+
// 3. we may want to consider creating a web component since they
|
|
33
|
+
// are server friendly. https://css-tricks.com/using-web-components-with-next-or-any-ssr-framework/
|
|
34
|
+
// 4. If you do use web components be sure to come up with a
|
|
35
|
+
// strategy to register the web component before React loads
|
|
36
|
+
// the markup on the page. Then the web component renders
|
|
37
|
+
// immediately.
|
|
21
38
|
const SideNavUI = ({
|
|
22
39
|
config,
|
|
23
40
|
isAltStyle,
|
|
41
|
+
isExpanded,
|
|
24
42
|
items,
|
|
25
43
|
onCollapsed,
|
|
26
44
|
onExpanded,
|
|
27
|
-
performanceYear,
|
|
28
45
|
}) => {
|
|
29
|
-
const
|
|
30
|
-
const [
|
|
46
|
+
const isExpandedPropSet = isExpanded !== undefined;
|
|
47
|
+
const [isExpandedState, setIsExpandedState] = useState(() => {
|
|
48
|
+
if (isExpandedPropSet) {
|
|
49
|
+
return isExpanded;
|
|
50
|
+
}
|
|
51
|
+
return isSideNavExpanded(window.document);
|
|
52
|
+
});
|
|
53
|
+
const [sideNavContent, setSideNavContent] = useState('<nav></nav>');
|
|
31
54
|
|
|
32
55
|
const collapseRef = useRef(null);
|
|
33
56
|
|
|
@@ -38,7 +61,7 @@ const SideNavUI = ({
|
|
|
38
61
|
};
|
|
39
62
|
|
|
40
63
|
const expand = () => {
|
|
41
|
-
|
|
64
|
+
setSideNavExpanded(window.document, 'true');
|
|
42
65
|
setIsExpandedState(true);
|
|
43
66
|
changeExpandedClass('animation-group-exit', 'animation-group-enter');
|
|
44
67
|
if (onExpanded) {
|
|
@@ -47,7 +70,7 @@ const SideNavUI = ({
|
|
|
47
70
|
};
|
|
48
71
|
|
|
49
72
|
const collapse = () => {
|
|
50
|
-
|
|
73
|
+
setSideNavExpanded(window.document, 'false');
|
|
51
74
|
setIsExpandedState(false);
|
|
52
75
|
changeExpandedClass('animation-group-enter', 'animation-group-exit');
|
|
53
76
|
if (onCollapsed) {
|
|
@@ -60,6 +83,22 @@ const SideNavUI = ({
|
|
|
60
83
|
};
|
|
61
84
|
|
|
62
85
|
useEffect(() => {
|
|
86
|
+
// some applications use the isExpanded prop instead of reading the cookie
|
|
87
|
+
// this will ensure the application ignores the cookie
|
|
88
|
+
if (isExpandedPropSet) {
|
|
89
|
+
if (isExpanded) {
|
|
90
|
+
changeExpandedClass('animation-group-exit', 'animation-group-enter');
|
|
91
|
+
} else {
|
|
92
|
+
changeExpandedClass('animation-group-enter', 'animation-group-exit');
|
|
93
|
+
}
|
|
94
|
+
setIsExpandedState(isExpanded);
|
|
95
|
+
} else {
|
|
96
|
+
isSideNavExpanded(window.document);
|
|
97
|
+
}
|
|
98
|
+
}, [isExpanded, isExpandedPropSet]);
|
|
99
|
+
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
const initialExpandedState = isSideNavExpanded(window.document);
|
|
63
102
|
let cancelRequest = false;
|
|
64
103
|
const { origin } = window.location;
|
|
65
104
|
const isRunningLocally = origin.includes('localhost');
|
|
@@ -77,7 +116,24 @@ const SideNavUI = ({
|
|
|
77
116
|
}
|
|
78
117
|
}
|
|
79
118
|
if (!cancelRequest) {
|
|
80
|
-
|
|
119
|
+
const realInitialState = isExpandedPropSet
|
|
120
|
+
? isExpanded
|
|
121
|
+
: initialExpandedState;
|
|
122
|
+
if (realInitialState) {
|
|
123
|
+
setSideNavContent(sideNavMenuItems);
|
|
124
|
+
} else {
|
|
125
|
+
// TODO: we are replacing the class here because the server does not take into account the
|
|
126
|
+
// initial expand/collapse state of the sidenav.
|
|
127
|
+
// Once we have confirmation that everyone has installed this version of QPP-Style we can
|
|
128
|
+
// remove this if/else block (assuming the server has been updated to read the cookie and
|
|
129
|
+
// render the appropriate class for each link)
|
|
130
|
+
setSideNavContent(
|
|
131
|
+
sideNavMenuItems.replaceAll(
|
|
132
|
+
'animation-group-enter',
|
|
133
|
+
'animation-group-exit',
|
|
134
|
+
),
|
|
135
|
+
);
|
|
136
|
+
}
|
|
81
137
|
}
|
|
82
138
|
}
|
|
83
139
|
getSideNavConfig();
|
|
@@ -160,6 +216,7 @@ const SideNavUI = ({
|
|
|
160
216
|
{...(!item.vgId ? {} : { vgId: item.vgId })}
|
|
161
217
|
{...(!item.cpcPlusId ? {} : { cpcPlusId: item.cpcPlusId })}
|
|
162
218
|
{...(!item.pcfId ? {} : { pcfId: item.pcfId })}
|
|
219
|
+
{...(!item.subgroupId ? {} : { subgroupId: item.subgroupId })}
|
|
163
220
|
/>
|
|
164
221
|
</AnimationGroup>
|
|
165
222
|
),
|
|
@@ -201,15 +258,6 @@ const SideNavUI = ({
|
|
|
201
258
|
/>
|
|
202
259
|
</AnimationGroup>
|
|
203
260
|
),
|
|
204
|
-
chart: (
|
|
205
|
-
<AnimationGroup display={isExpandedState} key={key}>
|
|
206
|
-
<ScoreChart
|
|
207
|
-
chartData={item.chartData}
|
|
208
|
-
linkCallback={linkCallback}
|
|
209
|
-
performanceYear={performanceYear}
|
|
210
|
-
/>
|
|
211
|
-
</AnimationGroup>
|
|
212
|
-
),
|
|
213
261
|
switchLink: (
|
|
214
262
|
<AnimationGroup display={isExpandedState} key={key}>
|
|
215
263
|
<CmsSwitchLink
|
|
@@ -252,11 +300,6 @@ const SideNavUI = ({
|
|
|
252
300
|
}
|
|
253
301
|
};
|
|
254
302
|
|
|
255
|
-
// Set side nav expanded state in localStorage on initial render
|
|
256
|
-
useEffect(() => {
|
|
257
|
-
sideNavExpandedStorage.init();
|
|
258
|
-
}, []);
|
|
259
|
-
|
|
260
303
|
const content = !items?.length ? (
|
|
261
304
|
<LevelOneContent
|
|
262
305
|
levelOneContent={sideNavContent}
|
|
@@ -290,27 +333,21 @@ const SideNavUI = ({
|
|
|
290
333
|
};
|
|
291
334
|
|
|
292
335
|
SideNavUI.propTypes = {
|
|
293
|
-
currentLevel: PropTypes.number,
|
|
294
|
-
onExpanded: PropTypes.func,
|
|
295
|
-
onCollapsed: PropTypes.func,
|
|
296
|
-
chartData: PropTypes.object,
|
|
297
336
|
config: PropTypes.object,
|
|
298
|
-
items: PropTypes.object,
|
|
299
337
|
isAltStyle: PropTypes.bool,
|
|
300
|
-
|
|
301
|
-
|
|
338
|
+
isExpanded: PropTypes.bool,
|
|
339
|
+
items: PropTypes.object,
|
|
340
|
+
onCollapsed: PropTypes.func,
|
|
341
|
+
onExpanded: PropTypes.func,
|
|
302
342
|
};
|
|
303
343
|
|
|
304
344
|
SideNavUI.defaultProps = {
|
|
305
|
-
currentLevel: 1,
|
|
306
|
-
onExpanded: () => {},
|
|
307
|
-
onCollapsed: () => {},
|
|
308
|
-
chartData: {},
|
|
309
345
|
config: {},
|
|
310
|
-
items: null,
|
|
311
346
|
isAltStyle: false,
|
|
312
|
-
|
|
313
|
-
|
|
347
|
+
isExpanded: undefined,
|
|
348
|
+
items: null,
|
|
349
|
+
onCollapsed: () => {},
|
|
350
|
+
onExpanded: () => {},
|
|
314
351
|
};
|
|
315
352
|
|
|
316
353
|
export default SideNavUI;
|
|
@@ -347,34 +347,27 @@ const isImpersonationLink = (docCookie, linkLabel) => {
|
|
|
347
347
|
};
|
|
348
348
|
|
|
349
349
|
/**
|
|
350
|
-
*
|
|
350
|
+
* Sets the qpp_side_nav_expanded cookie value
|
|
351
|
+
* @param {Document} document object
|
|
352
|
+
* @param {string} value
|
|
353
|
+
* @returns {void}
|
|
351
354
|
*/
|
|
352
|
-
const
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
} else {
|
|
369
|
-
localStorage.setItem('qpp_side_nav_expanded', false);
|
|
370
|
-
}
|
|
371
|
-
},
|
|
372
|
-
get: function () {
|
|
373
|
-
return JSON.parse(localStorage.getItem('qpp_side_nav_expanded'));
|
|
374
|
-
},
|
|
375
|
-
remove: function () {
|
|
376
|
-
localStorage.removeItem('qpp_side_nav_expanded');
|
|
377
|
-
},
|
|
355
|
+
const setSideNavExpanded = (_document, value) => {
|
|
356
|
+
_document.cookie = cookie.serialize('qpp_side_nav_expanded', value);
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Check if sidenav is expanded
|
|
361
|
+
* @param {Document} document object
|
|
362
|
+
* @returns {boolean}
|
|
363
|
+
*/
|
|
364
|
+
const isSideNavExpanded = (_document) => {
|
|
365
|
+
const parsedCookies = cookie.parse(_document.cookie);
|
|
366
|
+
if (parsedCookies.qpp_side_nav_expanded === undefined) {
|
|
367
|
+
setSideNavExpanded(_document, 'true');
|
|
368
|
+
return true;
|
|
369
|
+
}
|
|
370
|
+
return parsedCookies.qpp_side_nav_expanded === 'true';
|
|
378
371
|
};
|
|
379
372
|
|
|
380
373
|
module.exports = {
|
|
@@ -397,5 +390,6 @@ module.exports = {
|
|
|
397
390
|
isImpersonating,
|
|
398
391
|
isImpersonationLink,
|
|
399
392
|
loadSideNavContent,
|
|
400
|
-
|
|
393
|
+
setSideNavExpanded,
|
|
394
|
+
isSideNavExpanded,
|
|
401
395
|
};
|
|
@@ -4,48 +4,26 @@ import { SideNavUI } from './UI';
|
|
|
4
4
|
|
|
5
5
|
const SideNav = (options = {}) => {
|
|
6
6
|
const {
|
|
7
|
-
rootElement,
|
|
8
|
-
onExpanded,
|
|
9
|
-
onCollapsed,
|
|
10
|
-
chartData,
|
|
11
|
-
currentLevel,
|
|
12
7
|
config,
|
|
13
|
-
feedbackPerformanceYear,
|
|
14
|
-
fbpPerformanceYear,
|
|
15
|
-
showDevPreDfpLink,
|
|
16
|
-
showPhysicianCompareLink,
|
|
17
|
-
showFacilityBasedPreviewLink,
|
|
18
|
-
showSelfNomination,
|
|
19
|
-
showApmIncentivePaymentLink,
|
|
20
|
-
items,
|
|
21
8
|
isAltStyle,
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
isExpanded,
|
|
10
|
+
items,
|
|
11
|
+
onCollapsed,
|
|
12
|
+
onExpanded,
|
|
13
|
+
rootElement,
|
|
24
14
|
} = options;
|
|
25
15
|
|
|
26
|
-
|
|
16
|
+
return render(
|
|
27
17
|
<SideNavUI
|
|
28
18
|
onExpanded={onExpanded}
|
|
29
19
|
onCollapsed={onCollapsed}
|
|
30
|
-
|
|
31
|
-
currentLevel={currentLevel}
|
|
20
|
+
isExpanded={isExpanded}
|
|
32
21
|
config={config}
|
|
33
|
-
feedbackPerformanceYear={feedbackPerformanceYear}
|
|
34
|
-
fbpPerformanceYear={fbpPerformanceYear}
|
|
35
|
-
showDevPreDfpLink={showDevPreDfpLink}
|
|
36
|
-
showPhysicianCompareLink={showPhysicianCompareLink}
|
|
37
|
-
showFacilityBasedPreviewLink={showFacilityBasedPreviewLink}
|
|
38
|
-
showSelfNomination={showSelfNomination}
|
|
39
|
-
showApmIncentivePaymentLink={showApmIncentivePaymentLink}
|
|
40
22
|
items={items}
|
|
41
23
|
isAltStyle={isAltStyle}
|
|
42
|
-
showReportsPortal={showReportsPortal}
|
|
43
|
-
showTargetedReviewLink={showTargetedReviewLink}
|
|
44
24
|
/>,
|
|
45
25
|
rootElement,
|
|
46
26
|
);
|
|
47
|
-
|
|
48
|
-
return { expand, collapse };
|
|
49
27
|
};
|
|
50
28
|
|
|
51
29
|
export default SideNav;
|