-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into dependabot/npm_and_yarn/decode-uri-compone…
…nt-0.2.2 # Conflicts: # yarn.lock
- Loading branch information
Showing
34 changed files
with
1,466 additions
and
678 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { useDataQuery } from '@dhis2/app-runtime' | ||
import { INFO, NAMESPACE } from '../constants/data-store' | ||
import { infoDefault } from '../constants/info' | ||
|
||
export const getKeyInfo = { | ||
info: { | ||
resource: `dataStore/${NAMESPACE}/${INFO}`, | ||
}, | ||
} | ||
|
||
export const updateInfoMutation = { | ||
resource: `dataStore/${NAMESPACE}/${INFO}`, | ||
type: 'update', | ||
data: { ...infoDefault }, | ||
} | ||
|
||
const isUpdatedVersion = (currentVersion, updatedVersion) => | ||
currentVersion === updatedVersion | ||
|
||
export const useAndroidSettingsVersion = () => { | ||
const { data } = useDataQuery(getKeyInfo) | ||
|
||
return { | ||
isInfoUpdated: | ||
data && | ||
isUpdatedVersion( | ||
data.info?.androidSettingsVersion, | ||
infoDefault.androidSettingsVersion | ||
), | ||
isDatastoreUpdated: | ||
data && | ||
isUpdatedVersion( | ||
data.info?.dataStoreVersion, | ||
infoDefault.dataStoreVersion | ||
), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import i18n from '@dhis2/d2-i18n' | ||
import PropTypes from 'prop-types' | ||
import React from 'react' | ||
import { DISABLE_REFERRALS } from '../../constants' | ||
import { CheckboxField } from './CheckboxField' | ||
|
||
export const DisableReferral = ({ | ||
isTrackerProgram, | ||
handleChange, | ||
settings, | ||
}) => ( | ||
<> | ||
{isTrackerProgram && ( | ||
<CheckboxField | ||
name={DISABLE_REFERRALS} | ||
label={i18n.t('Disable TEI referrals')} | ||
onChange={handleChange} | ||
checked={settings[DISABLE_REFERRALS]} | ||
/> | ||
)} | ||
</> | ||
) | ||
|
||
DisableReferral.propTypes = { | ||
isTrackerProgram: PropTypes.bool, | ||
handleChange: PropTypes.func, | ||
settings: PropTypes.object, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import i18n from '@dhis2/d2-i18n' | ||
import cx from 'classnames' | ||
import PropTypes from 'prop-types' | ||
import React from 'react' | ||
import { DISABLE_REFERRALS } from '../../constants' | ||
import { CheckboxField } from './CheckboxField' | ||
import styles from './Field.module.css' | ||
|
||
export const GlobalProgramDisableReferral = ({ | ||
disable, | ||
settings, | ||
onChange, | ||
}) => { | ||
const handleChange = (e) => { | ||
onChange({ | ||
...settings, | ||
[e.name]: e.checked, | ||
}) | ||
} | ||
|
||
return ( | ||
<div className={cx(styles.rowBMargin24)}> | ||
<CheckboxField | ||
name={DISABLE_REFERRALS} | ||
label={i18n.t('Disable TEI referrals')} | ||
onChange={handleChange} | ||
disabled={disable} | ||
checked={settings[DISABLE_REFERRALS]} | ||
/> | ||
</div> | ||
) | ||
} | ||
|
||
GlobalProgramDisableReferral.propTypes = { | ||
disable: PropTypes.bool, | ||
settings: PropTypes.object, | ||
onChange: PropTypes.func, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import i18n from '@dhis2/d2-i18n' | ||
import cx from 'classnames' | ||
import PropTypes from 'prop-types' | ||
import React from 'react' | ||
import { COLLAPSIBLE_SECTIONS } from '../../constants' | ||
import { CheckboxField } from './CheckboxField' | ||
import styles from './Field.module.css' | ||
import { GlobalProgramDisableReferral } from './GlobalProgramDisableReferral' | ||
|
||
export const GlobalProgramHideSections = ({ disable, settings, onChange }) => { | ||
const handleChange = (e) => { | ||
onChange({ | ||
...settings, | ||
[e.name]: e.checked, | ||
}) | ||
} | ||
|
||
return ( | ||
<div className={cx(styles.rowBMargin24)}> | ||
<CheckboxField | ||
name={COLLAPSIBLE_SECTIONS} | ||
label={i18n.t('Do not collapse sections in form')} | ||
onChange={handleChange} | ||
disabled={disable} | ||
checked={settings[COLLAPSIBLE_SECTIONS]} | ||
/> | ||
</div> | ||
) | ||
} | ||
|
||
GlobalProgramDisableReferral.propTypes = { | ||
disable: PropTypes.bool, | ||
settings: PropTypes.object, | ||
onChange: PropTypes.func, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import i18n from '@dhis2/d2-i18n' | ||
import PropTypes from 'prop-types' | ||
import React from 'react' | ||
import { COLLAPSIBLE_SECTIONS } from '../../constants' | ||
import { CheckboxField } from './CheckboxField' | ||
|
||
export const HideFormSections = ({ settings, handleChange }) => ( | ||
<CheckboxField | ||
name={COLLAPSIBLE_SECTIONS} | ||
label={i18n.t('Do not collapse sections in form')} | ||
onChange={handleChange} | ||
checked={settings[COLLAPSIBLE_SECTIONS]} | ||
/> | ||
) | ||
|
||
HideFormSections.propTypes = { | ||
handleChange: PropTypes.func, | ||
settings: PropTypes.object, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { FieldSet, Legend } from '@dhis2/ui' | ||
import PropTypes from 'prop-types' | ||
import React from 'react' | ||
import styles from './Section.module.css' | ||
|
||
export const Section = ({ legend, children }) => ( | ||
<div className={styles.container}> | ||
<FieldSet> | ||
<Legend className={styles.legend}> | ||
<span> {legend} </span> | ||
</Legend> | ||
{children} | ||
</FieldSet> | ||
</div> | ||
) | ||
|
||
Section.propTypes = { | ||
legend: PropTypes.string, | ||
children: PropTypes.element.isRequired, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
.legend { | ||
display: inline-block; | ||
padding-bottom: var(--spacers-dp16); | ||
font-size: 15px; | ||
color: var(--colors-grey900); | ||
font-weight: 500; | ||
letter-spacing: 0.2px; | ||
} | ||
|
||
.container { | ||
padding: var(--spacers-dp16) 0; | ||
} | ||
|
||
.container:not(:last-child) { | ||
margin-bottom: var(--spacers-dp8); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './appearance-settings' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export const infoDefault = { | ||
dataStoreVersion: '2.0', | ||
androidSettingsVersion: '2.3.0', | ||
androidSettingsVersion: '2.3.1', | ||
} |
Oops, something went wrong.