diff --git a/package.json b/package.json
index 7050e731e..3e11b440e 100644
--- a/package.json
+++ b/package.json
@@ -5,7 +5,7 @@
"private": true,
"license": "BSD-3-Clause",
"dependencies": {
- "@dhis2/analytics": "^24.1.1",
+ "@dhis2/analytics": "^24.2.5",
"@dhis2/app-runtime": "^3.4.4",
"@dhis2/app-runtime-adapter-d2": "^1.1.0",
"@dhis2/d2-i18n": "^1.1.0",
@@ -13,7 +13,6 @@
"@dhis2/d2-ui-interpretations": "^7.4.0",
"@dhis2/d2-ui-mentions-wrapper": "^7.3.3",
"@dhis2/d2-ui-rich-text": "^7.3.3",
- "@dhis2/d2-ui-translation-dialog": "^7.3.3",
"@dhis2/data-visualizer-plugin": "^39.2.10",
"@dhis2/ui": "^8.5.1",
"classnames": "^2.3.1",
diff --git a/src/components/DropdownButton/DropdownButton.js b/src/components/DropdownButton/DropdownButton.js
index 9fd11c576..ea4162c37 100644
--- a/src/components/DropdownButton/DropdownButton.js
+++ b/src/components/DropdownButton/DropdownButton.js
@@ -1,7 +1,7 @@
+import { OfflineTooltip } from '@dhis2/analytics'
import { Button, Layer, Popper } from '@dhis2/ui'
import PropTypes from 'prop-types'
import React, { useRef } from 'react'
-import OfflineTooltip from '../OfflineTooltip.js'
import { ArrowDown, ArrowUp } from './assets/Arrow.js'
import styles from './DropdownButton.module.css'
diff --git a/src/components/Item/VisualizationItem/ItemContextMenu/__tests__/__snapshots__/ViewAsMenuItems.spec.js.snap b/src/components/Item/VisualizationItem/ItemContextMenu/__tests__/__snapshots__/ViewAsMenuItems.spec.js.snap
index ebbffb307..1f2642a7f 100644
--- a/src/components/Item/VisualizationItem/ItemContextMenu/__tests__/__snapshots__/ViewAsMenuItems.spec.js.snap
+++ b/src/components/Item/VisualizationItem/ItemContextMenu/__tests__/__snapshots__/ViewAsMenuItems.spec.js.snap
@@ -35,7 +35,7 @@ exports[`renders disabled menu items when offline 1`] = `
class="jsx-3508410433 label"
>
View as Chart
@@ -68,7 +68,7 @@ exports[`renders disabled menu items when offline 1`] = `
class="jsx-3508410433 label"
>
View as Table
@@ -106,7 +106,7 @@ exports[`renders menu for active type CHART and type MAP 1`] = `
class="jsx-3508410433 label"
>
View as Table
@@ -139,7 +139,7 @@ exports[`renders menu for active type CHART and type MAP 1`] = `
class="jsx-3508410433 label"
>
View as Map
@@ -177,7 +177,7 @@ exports[`renders menu for active type CHART and type REPORT_TABLE 1`] = `
class="jsx-3508410433 label"
>
View as Table
@@ -210,7 +210,7 @@ exports[`renders menu for active type CHART and type REPORT_TABLE 1`] = `
class="jsx-3508410433 label"
>
View as Map
@@ -248,7 +248,7 @@ exports[`renders menu for active type EVENT_CHART and type EVENT_REPORT 1`] = `
class="jsx-3508410433 label"
>
View as Table
@@ -293,7 +293,7 @@ exports[`renders menu for active type EVENT_REPORT and type EVENT_CHART 1`] = `
class="jsx-3508410433 label"
>
View as Chart
@@ -338,7 +338,7 @@ exports[`renders menu for active type MAP and type CHART 1`] = `
class="jsx-3508410433 label"
>
View as Chart
@@ -371,7 +371,7 @@ exports[`renders menu for active type MAP and type CHART 1`] = `
class="jsx-3508410433 label"
>
View as Table
@@ -416,7 +416,7 @@ exports[`renders menu for active type MAP and type MAP without Thematic layer 1`
class="jsx-3508410433 label"
>
View as Chart
@@ -449,7 +449,7 @@ exports[`renders menu for active type MAP and type MAP without Thematic layer 1`
class="jsx-3508410433 label"
>
View as Table
@@ -494,7 +494,7 @@ exports[`renders menu for active type MAP and type MAP without Thematic layer wh
class="jsx-3508410433 label"
>
View as Chart
@@ -527,7 +527,7 @@ exports[`renders menu for active type MAP and type MAP without Thematic layer wh
class="jsx-3508410433 label"
>
View as Table
@@ -572,7 +572,7 @@ exports[`renders menu for active type REPORT_TABLE and type CHART 1`] = `
class="jsx-3508410433 label"
>
View as Chart
@@ -605,7 +605,7 @@ exports[`renders menu for active type REPORT_TABLE and type CHART 1`] = `
class="jsx-3508410433 label"
>
View as Map
diff --git a/src/components/MenuItemWithTooltip.js b/src/components/MenuItemWithTooltip.js
index ae785efaa..51dc8ed91 100644
--- a/src/components/MenuItemWithTooltip.js
+++ b/src/components/MenuItemWithTooltip.js
@@ -1,9 +1,9 @@
+import { OfflineTooltip } from '@dhis2/analytics'
import { useOnlineStatus } from '@dhis2/app-runtime'
import i18n from '@dhis2/d2-i18n'
import { MenuItem } from '@dhis2/ui'
import PropTypes from 'prop-types'
import React from 'react'
-import OfflineTooltip from './OfflineTooltip.js'
const MenuItemWithTooltip = ({
disabledWhenOffline,
diff --git a/src/components/OfflineTooltip.js b/src/components/OfflineTooltip.js
deleted file mode 100644
index 25de4a233..000000000
--- a/src/components/OfflineTooltip.js
+++ /dev/null
@@ -1,49 +0,0 @@
-import { useOnlineStatus } from '@dhis2/app-runtime'
-import i18n from '@dhis2/d2-i18n'
-import { Tooltip as UiTooltip } from '@dhis2/ui'
-import cx from 'classnames'
-import PropTypes from 'prop-types'
-import React from 'react'
-import classes from './styles/Tooltip.module.css'
-
-const Tooltip = ({ disabledWhenOffline, disabled, content, children }) => {
- const { offline } = useOnlineStatus()
-
- const notAllowed = disabled || (disabledWhenOffline && offline)
-
- return (
-
- {({ onMouseOver, onMouseOut, ref }) => (
- notAllowed && onMouseOver()}
- onMouseOut={() => notAllowed && onMouseOut()}
- ref={ref}
- >
- {children}
-
- )}
-
- )
-}
-
-Tooltip.propTypes = {
- children: PropTypes.node,
- content: PropTypes.string,
- disabled: PropTypes.bool,
- disabledWhenOffline: PropTypes.bool,
-}
-
-Tooltip.defaultProps = {
- disabled: false,
- disabledWhenOffline: true,
-}
-
-export default Tooltip
diff --git a/src/components/styles/Tooltip.module.css b/src/components/styles/Tooltip.module.css
deleted file mode 100644
index 5714dff5f..000000000
--- a/src/components/styles/Tooltip.module.css
+++ /dev/null
@@ -1,11 +0,0 @@
-.span {
- display: inline-flex;
- pointer-events: all;
-}
-.span > :global(button:disabled) {
- pointer-events: none;
-}
-
-.notAllowed {
- cursor: not-allowed;
-}
diff --git a/src/pages/edit/ActionsBar.js b/src/pages/edit/ActionsBar.js
index 87f497d80..f914cdcfe 100644
--- a/src/pages/edit/ActionsBar.js
+++ b/src/pages/edit/ActionsBar.js
@@ -1,7 +1,6 @@
+import { OfflineTooltip, TranslationDialog } from '@dhis2/analytics'
import { useOnlineStatus, useDataEngine, useAlert } from '@dhis2/app-runtime'
-import { useD2 } from '@dhis2/app-runtime-adapter-d2'
import i18n from '@dhis2/d2-i18n'
-import TranslationDialog from '@dhis2/d2-ui-translation-dialog'
import { Button, ButtonStrip } from '@dhis2/ui'
import PropTypes from 'prop-types'
import React, { useState } from 'react'
@@ -18,7 +17,6 @@ import {
import { acClearPrintDashboard } from '../../actions/printDashboard.js'
import { acClearSelected } from '../../actions/selected.js'
import ConfirmActionDialog from '../../components/ConfirmActionDialog.js'
-import OfflineTooltip from '../../components/OfflineTooltip.js'
import {
sGetEditDashboardRoot,
sGetIsPrintPreviewView,
@@ -41,8 +39,9 @@ const deleteFailedMessage = i18n.t(
'Failed to delete dashboard. You might be offline or not have access to edit this dashboard.'
)
+const fieldsToTranslate = ['name', 'description']
+
const EditBar = ({ dashboard, ...props }) => {
- const { d2 } = useD2()
const dataEngine = useDataEngine()
const { online } = useOnlineStatus()
const [translationDlgIsOpen, setTranslationDlgIsOpen] = useState(false)
@@ -159,23 +158,13 @@ const EditBar = ({ dashboard, ...props }) => {
}
const translationDialog = () =>
- dashboard.id ? (
+ translationDlgIsOpen ? (
- console.log('translation update error', err)
- }
+ onClose={toggleTranslationDialog}
+ objectToTranslate={dashboard}
+ fieldsToTranslate={fieldsToTranslate}
onTranslationSaved={Function.prototype}
- insertTheme={true}
- isOnline={online}
/>
) : null
diff --git a/src/pages/edit/LayoutModal.js b/src/pages/edit/LayoutModal.js
index c7be6aa99..27273aa0c 100644
--- a/src/pages/edit/LayoutModal.js
+++ b/src/pages/edit/LayoutModal.js
@@ -1,3 +1,4 @@
+import { OfflineTooltip } from '@dhis2/analytics'
import { useOnlineStatus } from '@dhis2/app-runtime'
import i18n from '@dhis2/d2-i18n'
import {
@@ -13,7 +14,6 @@ import {
import cx from 'classnames'
import PropTypes from 'prop-types'
import React, { useEffect, useState } from 'react'
-import OfflineTooltip from '../../components/OfflineTooltip.js'
import { GRID_COLUMNS } from '../../modules/gridUtil.js'
import { LayoutFixedIcon } from './assets/LayoutFixed.js'
import { LayoutFreeflowIcon } from './assets/LayoutFreeflow.js'
diff --git a/src/pages/edit/TitleBar.js b/src/pages/edit/TitleBar.js
index 1db2f506f..d423f6ab4 100644
--- a/src/pages/edit/TitleBar.js
+++ b/src/pages/edit/TitleBar.js
@@ -1,3 +1,4 @@
+import { OfflineTooltip } from '@dhis2/analytics'
import { useOnlineStatus } from '@dhis2/app-runtime'
import i18n from '@dhis2/d2-i18n'
import { InputField, TextAreaField, Radio, Button } from '@dhis2/ui'
@@ -12,7 +13,6 @@ import {
acSetItemConfigInsertPosition,
acSetDashboardCode,
} from '../../actions/editDashboard.js'
-import OfflineTooltip from '../../components/OfflineTooltip.js'
import { orObject } from '../../modules/util.js'
import {
sGetEditDashboardRoot,
diff --git a/src/pages/edit/__tests__/ActionsBar.spec.js b/src/pages/edit/__tests__/ActionsBar.spec.js
index 0eaa2209c..966031416 100644
--- a/src/pages/edit/__tests__/ActionsBar.spec.js
+++ b/src/pages/edit/__tests__/ActionsBar.spec.js
@@ -29,13 +29,17 @@ jest.mock('@dhis2/ui', () => {
/* eslint-enable react/prop-types */
/* eslint-disable react/prop-types */
-jest.mock(
- '../../../components/OfflineTooltip.js',
- () =>
- function Mock({ children }) {
+jest.mock('@dhis2/analytics', () => {
+ const originalModule = jest.requireActual('@dhis2/analytics')
+
+ return {
+ __esModule: true,
+ ...originalModule,
+ OfflineTooltip: function Mock({ children }) {
return {children}
- }
-)
+ },
+ }
+})
/* eslint-enable react/prop-types */
jest.mock(
@@ -46,14 +50,6 @@ jest.mock(
}
)
-jest.mock(
- '@dhis2/d2-ui-translation-dialog',
- () =>
- function Mock() {
- return
- }
-)
-
/* eslint-disable react/prop-types */
jest.mock(
'../../../components/ConfirmActionDialog',
diff --git a/src/pages/edit/__tests__/__snapshots__/ActionsBar.spec.js.snap b/src/pages/edit/__tests__/__snapshots__/ActionsBar.spec.js.snap
index 906718f98..f1559e690 100644
--- a/src/pages/edit/__tests__/__snapshots__/ActionsBar.spec.js.snap
+++ b/src/pages/edit/__tests__/__snapshots__/ActionsBar.spec.js.snap
@@ -125,9 +125,6 @@ exports[`renders Translate, Delete, and Discard buttons when delete access 1`] =
-
`;
@@ -209,8 +206,5 @@ exports[`renders the ActionsBar without Delete when no delete access 1`] = `
-
`;
diff --git a/src/pages/edit/__tests__/__snapshots__/TitleBar.spec.js.snap b/src/pages/edit/__tests__/__snapshots__/TitleBar.spec.js.snap
index 556647040..046eb32d6 100644
--- a/src/pages/edit/__tests__/__snapshots__/TitleBar.spec.js.snap
+++ b/src/pages/edit/__tests__/__snapshots__/TitleBar.spec.js.snap
@@ -66,7 +66,7 @@ exports[`TitleBar renders correctly when no name or description 1`] = `
Freeflow