-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: upgrade toolbar (DHIS2-15667) (#2936)
Changes in the following files are functional changes needed for the new Analytics toolbar: src/components/app/AppMenu.js - add the HoverMenuBar component and onFileMenuAction callback, which updates the interpretations panel with changes (e.g. sharing, renaming, translating) if it is open AppLayout - onFileMenuAction and the interpretationRenderId. FileMenu - added onFileMenuAction Interpretations, InterpretationsPanel: - added renderId which triggers refetching the map info if it was changed by a file menu action InterpretationsToggle: use the new InterpretationsAndDetailsToggler from Analytics DownloadButton: needed different style to look nice with the new toolbar AddLayerButton: styled to fit into the new toolbar The new toolbar is a different height than the old one, which caused a bunch of layout issues due to the absolute positioning. Switched to flex where it made sense, and css changes accordingly. Only change to DownloadSettings is the addition of a wrapping div <div className={styles.downloadSettingsPanel}> MapPosition: resize due to open/close of the Layers or Details panel has a timeout added, since there is now a 100ms transition when open/close those Drawers
- Loading branch information
1 parent
b757770
commit e3a448d
Showing
37 changed files
with
632 additions
and
493 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
:root { | ||
--left-panel-width: 300px; | ||
--right-panel-width: 380px; | ||
|
||
--header-height: 48px; | ||
--toolbar-height: 32px; | ||
} |
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 |
---|---|---|
@@ -1,17 +1,24 @@ | ||
import { Toolbar, HoverMenuBar } from '@dhis2/analytics' | ||
import PropTypes from 'prop-types' | ||
import React from 'react' | ||
import DownloadButton from '../download/DownloadButton.js' | ||
import InterpretationsToggle from '../interpretations/InterpretationsToggle.js' | ||
import AddLayerButton from '../layers/overlays/AddLayerButton.js' | ||
import FileMenu from './FileMenu.js' | ||
import styles from './styles/AppMenu.module.css' | ||
|
||
const AppMenu = () => ( | ||
<div className={styles.appMenu}> | ||
const AppMenu = ({ onFileMenuAction }) => ( | ||
<Toolbar> | ||
<AddLayerButton /> | ||
<FileMenu /> | ||
<DownloadButton /> | ||
<HoverMenuBar> | ||
<FileMenu onFileMenuAction={onFileMenuAction} /> | ||
<DownloadButton /> | ||
</HoverMenuBar> | ||
<InterpretationsToggle /> | ||
</div> | ||
</Toolbar> | ||
) | ||
|
||
AppMenu.propTypes = { | ||
onFileMenuAction: PropTypes.func.isRequired, | ||
} | ||
|
||
export default AppMenu |
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,40 @@ | ||
import cx from 'classnames' | ||
import PropTypes from 'prop-types' | ||
import React from 'react' | ||
import { useSelector } from 'react-redux' | ||
import Interpretations from '../interpretations/Interpretations.js' | ||
import OrgUnitProfile from '../orgunits/OrgUnitProfile.js' | ||
import styles from './styles/DetailsPanel.module.css' | ||
|
||
const DetailsPanel = ({ interpretationsRenderCount }) => { | ||
const detailsPanelOpen = useSelector((state) => state.ui.rightPanelOpen) | ||
const viewOrgUnitProfile = useSelector((state) => state.orgUnitProfile) | ||
|
||
const getContent = () => { | ||
if (!detailsPanelOpen) { | ||
return null | ||
} | ||
|
||
return viewOrgUnitProfile ? ( | ||
<OrgUnitProfile /> | ||
) : ( | ||
<Interpretations renderCount={interpretationsRenderCount} /> | ||
) | ||
} | ||
|
||
return ( | ||
<div | ||
className={cx(styles.detailsPanel, { | ||
[styles.collapsed]: !detailsPanelOpen, | ||
})} | ||
> | ||
{getContent()} | ||
</div> | ||
) | ||
} | ||
|
||
DetailsPanel.propTypes = { | ||
interpretationsRenderCount: PropTypes.number.isRequired, | ||
} | ||
|
||
export default DetailsPanel |
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 |
---|---|---|
@@ -1,11 +1,15 @@ | ||
.appLayout { | ||
position: absolute; | ||
top: 48px; | ||
bottom: 0; | ||
left: 0; | ||
right: 0 | ||
.content { | ||
display: flex; | ||
flex-direction: row; | ||
height: calc(100vh - var(--header-height) - var(--toolbar-height)); | ||
} | ||
|
||
.downloadMode { | ||
top: 0; | ||
.downloadContent { | ||
margin-top: var(--header-height); | ||
height: calc(100vh - var(--header-height)); | ||
} | ||
|
||
.appMapAndTable { | ||
flex: auto; | ||
position: relative; | ||
} |
This file was deleted.
Oops, something went wrong.
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,7 @@ | ||
.detailsPanel { | ||
width: var(--right-panel-width); | ||
} | ||
|
||
.detailsPanel.collapsed { | ||
width: 0px; | ||
} |
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,27 +1,15 @@ | ||
.drawer { | ||
position: absolute; | ||
top: 38px; | ||
bottom: 0; | ||
background-color: #f4f6f8; | ||
height: auto; | ||
max-height: 100%; | ||
overflow-x: hidden; | ||
height: 100%; | ||
overflow-y: auto; | ||
z-index: 1190; | ||
} | ||
|
||
.left { | ||
left: 0; | ||
right: auto; | ||
border-right: 1px solid #e0e0e0; | ||
box-shadow: 1px 0 1px 0 rgba(0, 0, 0, 0.2); | ||
width: 300px; | ||
} | ||
|
||
.right { | ||
left: auto; | ||
right: 0; | ||
border-left: 1px solid #e0e0e0; | ||
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.2); | ||
width: 380px; | ||
} |
Oops, something went wrong.