-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into hv/fix/DHIS2-15685_…
…viewingEventShouldBePossibleWithoutSelectingOrgUnit
- Loading branch information
Showing
40 changed files
with
361 additions
and
128 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
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
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
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
File renamed without changes.
59 changes: 59 additions & 0 deletions
59
...core_modules/capture-core/components/Coordinates/PolygonCoordinates/PolygonCoordinates.js
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,59 @@ | ||
// @flow | ||
import React, { useState } from 'react'; | ||
import i18n from '@dhis2/d2-i18n'; | ||
import { withStyles } from '@material-ui/core/styles'; | ||
import { IconChevronUp16, IconChevronDown16, colors, spacers } from '@dhis2/ui'; | ||
|
||
type Props = $ReadOnly<{| | ||
coordinates: Array<Array<number>>, | ||
classes: { | ||
buttonContainer: string, | ||
viewButton: string, | ||
}, | ||
|}>; | ||
|
||
const styles = { | ||
buttonContainer: { | ||
display: 'flex', | ||
flexDirection: 'column', | ||
alignItems: 'center', | ||
}, | ||
viewButton: { | ||
background: 'none', | ||
border: 'none', | ||
cursor: 'pointer', | ||
color: colors.grey800, | ||
marginTop: spacers.dp8, | ||
display: 'flex', | ||
alignItems: 'center', | ||
'&:hover': { | ||
textDecoration: 'underline', | ||
color: 'black', | ||
}, | ||
}, | ||
}; | ||
|
||
const PolygonCoordinatesPlain = ({ coordinates, classes }: Props) => { | ||
const [showMore, setShowMore] = useState(false); | ||
return ( | ||
<> | ||
<div> | ||
{coordinates.slice(0, showMore ? coordinates.length : 1).map((coordinatePair, index) => ( | ||
// eslint-disable-next-line react/no-array-index-key | ||
<div key={index}> | ||
{`${i18n.t('lat')}: ${coordinatePair[1]}`}<br /> | ||
{`${i18n.t('long')}: ${coordinatePair[0]}`} | ||
</div> | ||
))} | ||
</div> | ||
<div className={classes.buttonContainer}> | ||
<button className={classes.viewButton} onClick={() => setShowMore(!showMore)}> | ||
{showMore ? i18n.t('Show less') : i18n.t('Show more')} | ||
{showMore ? <IconChevronUp16 /> : <IconChevronDown16 />} | ||
</button> | ||
</div> | ||
</> | ||
); | ||
}; | ||
|
||
export const PolygonCoordinates = withStyles(styles)(PolygonCoordinatesPlain); |
2 changes: 2 additions & 0 deletions
2
src/core_modules/capture-core/components/Coordinates/PolygonCoordinates/index.js
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,2 @@ | ||
// @flow | ||
export { PolygonCoordinates } from './PolygonCoordinates'; |
3 changes: 3 additions & 0 deletions
3
src/core_modules/capture-core/components/Coordinates/index.js
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,3 @@ | ||
// @flow | ||
export { MinimalCoordinates } from './MinimalCoordinates'; | ||
export { PolygonCoordinates } from './PolygonCoordinates'; |
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
Oops, something went wrong.