diff --git a/src/components/containers/App/App.js b/src/components/containers/App/App.js index 44b2466d..66c2a37a 100644 --- a/src/components/containers/App/App.js +++ b/src/components/containers/App/App.js @@ -22,6 +22,15 @@ import { image } from './HeaderImage'; import '../../../config/styles'; export class App extends Component { + + componentDidMount(){ + // Has High Contrast Mode been enabled? + if (document.cookie.split(';').filter((item) => item.includes('enabledHighContrast=true')).length) { + let bodyTag = document.getElementsByTagName("body")[0]; + bodyTag.classList.add("high-contrast"); + } + } + render() { const { requestError, patientsInfo } = this.props; const isTouchDevice = (this.props.isTouchDevice) ? 'touch-device' : ('ontouchstart' in window) ? 'touch-device' : 'is-not-touch-device'; diff --git a/src/components/containers/UserPanel/UserAccountPanel.js b/src/components/containers/UserPanel/UserAccountPanel.js index ee82a9a5..4e468fc8 100644 --- a/src/components/containers/UserPanel/UserAccountPanel.js +++ b/src/components/containers/UserPanel/UserAccountPanel.js @@ -57,9 +57,11 @@ export default class UserAccountPanel extends PureComponent {
{ - this.context.router.history.push(clientUrls.USER_PROFILE); - onClick('') + onClick={() => { + if (themeConfigs.isShowUserAccountPage) { + this.context.router.history.push(clientUrls.USER_PROFILE); + onClick(''); + } }} >{user.given_name} {user.family_name}
diff --git a/src/components/containers/UserPanel/UserPanel.js b/src/components/containers/UserPanel/UserPanel.js index 654dae98..5d610393 100644 --- a/src/components/containers/UserPanel/UserPanel.js +++ b/src/components/containers/UserPanel/UserPanel.js @@ -58,9 +58,11 @@ export default class UserPanel extends PureComponent { //TODO: Should we remember this in a cookie? if( bodyTag.classList.contains("high-contrast") ){ - bodyTag.classList.remove("high-contrast") + bodyTag.classList.remove("high-contrast"); + document.cookie = 'enabledHighContrast=false'; } else { - bodyTag.classList.add("high-contrast") + bodyTag.classList.add("high-contrast"); + document.cookie = 'enabledHighContrast=true'; } }; diff --git a/src/components/pages/Allergies/Allergies.js b/src/components/pages/Allergies/Allergies.js index a5eba8ef..3303c7b0 100644 --- a/src/components/pages/Allergies/Allergies.js +++ b/src/components/pages/Allergies/Allergies.js @@ -323,14 +323,11 @@ export default class Allergies extends PureComponent { const hiddenButtons = get(themeConfigs, 'buttonsToHide.allergies', []); return (
- {!(isDetailPanelVisible || isCreatePanelVisible) ? - - : null - } +
{(isPanelMain || expandedPanel === 'all') ? diff --git a/src/components/pages/Allergies/__tests__/__snapshots__/Allergies.test.js.snap b/src/components/pages/Allergies/__tests__/__snapshots__/Allergies.test.js.snap index 0043b151..bb7ee269 100644 --- a/src/components/pages/Allergies/__tests__/__snapshots__/Allergies.test.js.snap +++ b/src/components/pages/Allergies/__tests__/__snapshots__/Allergies.test.js.snap @@ -86,6 +86,12 @@ exports[`Component should renders correctly and testing context an
+
@@ -280,6 +286,12 @@ exports[`Component should renders correctly with allergiesDetail a
+
@@ -384,6 +396,12 @@ exports[`Component should renders correctly with allergiesDetail a
+
@@ -488,6 +506,12 @@ exports[`Component should renders correctly with allergiesDetail a
+
@@ -600,6 +624,12 @@ exports[`Component should renders correctly with allergiesDetail a
+
@@ -651,6 +681,12 @@ exports[`Component should renders correctly with allergiesDetail a
+
diff --git a/src/components/pages/Contacts/Contacts.js b/src/components/pages/Contacts/Contacts.js index 6651adda..5ab31632 100644 --- a/src/components/pages/Contacts/Contacts.js +++ b/src/components/pages/Contacts/Contacts.js @@ -247,14 +247,11 @@ export default class Contacts extends PureComponent { } return (
- {!(isDetailPanelVisible || isCreatePanelVisible) ? - - : null - } +
{(isPanelMain || expandedPanel === 'all') ? diff --git a/src/components/pages/Contacts/__tests__/__snapshots__/Contacts.test.js.snap b/src/components/pages/Contacts/__tests__/__snapshots__/Contacts.test.js.snap index 36ae51c9..02aa6e87 100644 --- a/src/components/pages/Contacts/__tests__/__snapshots__/Contacts.test.js.snap +++ b/src/components/pages/Contacts/__tests__/__snapshots__/Contacts.test.js.snap @@ -85,6 +85,12 @@ exports[`Component should renders correctly and testing context and
+
@@ -197,6 +203,12 @@ exports[`Component should renders correctly with contactsDetail and
+
@@ -299,6 +311,12 @@ exports[`Component should renders correctly with contactsDetail and
+
@@ -401,6 +419,12 @@ exports[`Component should renders correctly with diagnosisDetail an
+
@@ -513,6 +537,12 @@ exports[`Component should renders correctly with diagnosisDetail an
+
@@ -565,6 +595,12 @@ exports[`Component should renders correctly with diagnosisDetail an
+
diff --git a/src/components/pages/Diagnosis/Diagnosis.js b/src/components/pages/Diagnosis/Diagnosis.js index 518e0406..692906e8 100644 --- a/src/components/pages/Diagnosis/Diagnosis.js +++ b/src/components/pages/Diagnosis/Diagnosis.js @@ -315,14 +315,11 @@ export default class ProblemsDiagnosis extends PureComponent { const hiddenButtons = get(themeConfigs, 'buttonsToHide.diagnoses', []); return (
- {!(isDetailPanelVisible || isCreatePanelVisible) ? - - : null - } +
{(isPanelMain || expandedPanel === 'all') ? diff --git a/src/components/pages/Diagnosis/__tests__/__snapshots__/Diagnosis.test.js.snap b/src/components/pages/Diagnosis/__tests__/__snapshots__/Diagnosis.test.js.snap index 1efda822..798b47d8 100644 --- a/src/components/pages/Diagnosis/__tests__/__snapshots__/Diagnosis.test.js.snap +++ b/src/components/pages/Diagnosis/__tests__/__snapshots__/Diagnosis.test.js.snap @@ -87,6 +87,12 @@ exports[`Component should renders correctly and testing context an
+
@@ -281,6 +287,12 @@ exports[`Component should renders correctly with diagnosesDetail a
+
@@ -386,6 +398,12 @@ exports[`Component should renders correctly with diagnosesDetail a
+
@@ -491,6 +509,12 @@ exports[`Component should renders correctly with diagnosisDetail a
+
@@ -602,6 +626,12 @@ exports[`Component should renders correctly with diagnosisDetail a
+
@@ -651,6 +681,12 @@ exports[`Component should renders correctly with diagnosisDetail a
+
diff --git a/src/components/pages/Medications/Medications.js b/src/components/pages/Medications/Medications.js index b7311279..278bc8ae 100644 --- a/src/components/pages/Medications/Medications.js +++ b/src/components/pages/Medications/Medications.js @@ -356,14 +356,11 @@ export default class Medications extends PureComponent { const hiddenButtons = get(themeConfigs, 'buttonsToHide.medications', []); return (
- {!(isDetailPanelVisible || isCreatePanelVisible) ? - - : null - } +
{(isPanelMain || expandedPanel === 'all') ? diff --git a/src/components/pages/Medications/__tests__/__snapshots__/Medications.test.js.snap b/src/components/pages/Medications/__tests__/__snapshots__/Medications.test.js.snap index bb85aace..c1f0911f 100644 --- a/src/components/pages/Medications/__tests__/__snapshots__/Medications.test.js.snap +++ b/src/components/pages/Medications/__tests__/__snapshots__/Medications.test.js.snap @@ -150,6 +150,12 @@ exports[`Component should renders correctly and testing context
+
@@ -850,6 +856,12 @@ exports[`Component should renders correctly with medicationsDeta
+
@@ -1018,6 +1030,12 @@ exports[`Component should renders correctly with medicationsDeta
+
@@ -1186,6 +1204,12 @@ exports[`Component should renders correctly with medicationsDeta
+
@@ -1366,6 +1390,12 @@ exports[`Component should renders correctly with medicationsDeta
+
@@ -1421,6 +1451,12 @@ exports[`Component should renders correctly with medicationsDeta
+
diff --git a/src/components/presentational/Footer/Footer.js b/src/components/presentational/Footer/Footer.js index b1fee855..c2adf622 100644 --- a/src/components/presentational/Footer/Footer.js +++ b/src/components/presentational/Footer/Footer.js @@ -19,17 +19,32 @@ export default class Footer extends PureComponent { //TODO: Should we remember this in a cookie? if( bodyTag.classList.contains("high-contrast") ){ bodyTag.classList.remove("high-contrast"); + document.cookie = 'enabledHighContrast=false'; this.setState({ enabledHighContrast: false }); } else { - bodyTag.classList.add("high-contrast") + bodyTag.classList.add("high-contrast"); + document.cookie = 'enabledHighContrast=true'; this.setState({ enabledHighContrast: true }); } }; + componentDidMount(){ + // Has High Contrast Mode been enabled? + if (document.cookie.split(';').filter((item) => item.includes('enabledHighContrast=true')).length) { + this.setState({ + enabledHighContrast: true + }); + } else { + this.setState({ + enabledHighContrast: false + }); + } + } + render() { const { copyright, isShowSupportedBy } = this.props; const imageLocation = '/images/ripple-foundation-logo-footer.png'; diff --git a/src/index.html b/src/index.html index 9081c839..a617d913 100644 --- a/src/index.html +++ b/src/index.html @@ -19,6 +19,7 @@ + PulseTile