diff --git a/CHANGELOG.md b/CHANGELOG.md index 536552860..191786317 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [31.14.11](https://github.com/dhis2/dashboard-app/compare/v31.14.10...v31.14.11) (2021-04-20) + + +### Bug Fixes + +* remove material-ui as direct dependency and update to latest ui design DHIS2-10143 ([#1704](https://github.com/dhis2/dashboard-app/issues/1704)) ([4f4cc50](https://github.com/dhis2/dashboard-app/commit/4f4cc50b209fed3e3a93194357540535b0ffc242)) + ## [31.14.10](https://github.com/dhis2/dashboard-app/compare/v31.14.9...v31.14.10) (2021-03-30) diff --git a/cypress/integration/common/common.js b/cypress/integration/common/common.js index 125ef9494..b8b48267b 100644 --- a/cypress/integration/common/common.js +++ b/cypress/integration/common/common.js @@ -5,7 +5,7 @@ import { chartSel } from '../../selectors/dashboardItem' import { dashboardTitleSel, dashboardChipSel, - newDashboardLinkSel, + newButtonSel, } from '../../selectors/viewDashboard' beforeEach(() => { @@ -26,7 +26,7 @@ Then('the {string} dashboard displays in view mode', title => { }) Given('I choose to create new dashboard', () => { - cy.get(newDashboardLinkSel, EXTENDED_TIMEOUT).click() + cy.get(newButtonSel, EXTENDED_TIMEOUT).click() }) When('I choose to edit dashboard', () => { diff --git a/cypress/integration/ui/error_scenarios/no_dashboards.js b/cypress/integration/ui/error_scenarios/no_dashboards.js index 6f8014da5..64f15a139 100644 --- a/cypress/integration/ui/error_scenarios/no_dashboards.js +++ b/cypress/integration/ui/error_scenarios/no_dashboards.js @@ -1,6 +1,6 @@ import { Given, Then } from 'cypress-cucumber-preprocessor/steps' import { EXTENDED_TIMEOUT } from '../../../support/utils' -import { newDashboardLinkSel } from '../../../selectors/viewDashboard' +import { newButtonSel } from '../../../selectors/viewDashboard' // Scenario: There are no dashboards Given('I open an app with no dashboards', () => { @@ -10,5 +10,5 @@ Given('I open an app with no dashboards', () => { Then('a message displays informing that there are no dashboards', () => { cy.contains('No dashboards found', EXTENDED_TIMEOUT).should('be.visible') - cy.get(newDashboardLinkSel).should('be.visible') + cy.get(newButtonSel).should('be.visible') }) diff --git a/cypress/integration/ui/responsive_dashboard/responsive_dashboard.js b/cypress/integration/ui/responsive_dashboard/responsive_dashboard.js index 0bac79e17..e1d3eb07c 100644 --- a/cypress/integration/ui/responsive_dashboard/responsive_dashboard.js +++ b/cypress/integration/ui/responsive_dashboard/responsive_dashboard.js @@ -1,7 +1,10 @@ import { When, Then } from 'cypress-cucumber-preprocessor/steps' import { EXTENDED_TIMEOUT } from '../../../support/utils' import { chartSel } from '../../../selectors/dashboardItem' -import { dashboardTitleSel } from '../../../selectors/viewDashboard' +import { + dashboardTitleSel, + newButtonSel, +} from '../../../selectors/viewDashboard' import { dimensionsModalSel } from '../../../selectors/dashboardFilter' const TEST_DASHBOARD_TITLE = 'TEST_DASHBOARD_TITLE' @@ -18,7 +21,7 @@ When('dashboard title is changed', () => { Then('the small screen view is shown', () => { //controlbar - no search dashboard field - cy.get('[data-test="link-new-dashboard"]').should('not.be.visible') + cy.get(newButtonSel).should('not.be.visible') //titlebar - only the More button and the title cy.get('button').contains('Edit').should('not.be.visible') @@ -36,7 +39,7 @@ When('I restore the wide screen', () => { }) Then('the wide screen view is shown', () => { - cy.get('[data-test="link-new-dashboard"]').should('be.visible') + cy.get(newButtonSel).should('be.visible') cy.get('button').contains('Edit').should('be.visible') cy.get('button').contains('Share').should('be.visible') diff --git a/cypress/selectors/viewDashboard.js b/cypress/selectors/viewDashboard.js index 0e1693082..c50700d2e 100644 --- a/cypress/selectors/viewDashboard.js +++ b/cypress/selectors/viewDashboard.js @@ -1,6 +1,6 @@ // Dashboards bar export const dashboardChipSel = '[data-test="dashboard-chip"]' -export const newDashboardLinkSel = '[data-test="link-new-dashboard"]' +export const newButtonSel = '[data-test="new-button"]' export const chipStarSel = '[data-test="dhis2-uicore-chip-icon"]' export const dashboardSearchInputSel = 'input:visible[placeholder="Search for a dashboard"]' diff --git a/i18n/en.pot b/i18n/en.pot index e579e88ba..b9e52ca80 100644 --- a/i18n/en.pot +++ b/i18n/en.pot @@ -5,8 +5,8 @@ msgstr "" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1)\n" -"POT-Creation-Date: 2021-04-21T12:59:59.325Z\n" -"PO-Revision-Date: 2021-04-21T12:59:59.325Z\n" +"POT-Creation-Date: 2021-04-23T09:46:24.658Z\n" +"PO-Revision-Date: 2021-04-23T09:46:24.658Z\n" msgid "Untitled dashboard" msgstr "" @@ -267,7 +267,7 @@ msgstr "" msgid "Create a new dashboard" msgstr "" -msgid "New" +msgid "Create a new dashboard" msgstr "" msgid "Search for a dashboard" diff --git a/package.json b/package.json index c36c35cc2..8fea63dbc 100644 --- a/package.json +++ b/package.json @@ -5,13 +5,13 @@ "private": true, "license": "BSD-3-Clause", "dependencies": { - "@dhis2/analytics": "^17.0.0", + "@dhis2/analytics": "^17.0.2", "@dhis2/app-runtime": "^2.8.0", "@dhis2/app-runtime-adapter-d2": "^1.0.2", "@dhis2/d2-i18n": "^1.1.0", "@dhis2/d2-ui-core": "^7.1.8", "@dhis2/d2-ui-interpretations": "^7.1.8", - "@dhis2/d2-ui-mentions-wrapper": "^7.1.8", + "@dhis2/d2-ui-mentions-wrapper": "^7.2.0", "@dhis2/d2-ui-rich-text": "^7.1.8", "@dhis2/d2-ui-sharing-dialog": "^7.1.8", "@dhis2/d2-ui-translation-dialog": "^7.1.8", diff --git a/src/pages/view/DashboardsBar/Content.js b/src/pages/view/DashboardsBar/Content.js index 7ce251d4c..fb725c474 100644 --- a/src/pages/view/DashboardsBar/Content.js +++ b/src/pages/view/DashboardsBar/Content.js @@ -1,9 +1,9 @@ -import React from 'react' +import React, { useState } from 'react' import { connect } from 'react-redux' import PropTypes from 'prop-types' import i18n from '@dhis2/d2-i18n' import cx from 'classnames' -import { Link, withRouter } from 'react-router-dom' +import { Redirect, withRouter } from 'react-router-dom' import { Button, Tooltip, colors, IconAdd24 } from '@dhis2/ui' import Chip from './Chip' @@ -25,6 +25,8 @@ const Content = ({ onChipClicked, onSearchClicked, }) => { + const [redirectUrl, setRedirectUrl] = useState(null) + const onSelectDashboard = () => { const id = getFilteredDashboards(dashboards, filterText)[0]?.id if (id) { @@ -32,6 +34,10 @@ const Content = ({ } } + const enterNewMode = () => { + setRedirectUrl('/new') + } + const getChips = () => getFilteredDashboards(dashboards, filterText).map(dashboard => ( ( -
- - - - - + + +
+ ) + if (redirectUrl) { + return + } + return (
)}
- + ) } diff --git a/src/pages/view/DashboardsBar/__tests__/__snapshots__/DashboardsBar.spec.js.snap b/src/pages/view/DashboardsBar/__tests__/__snapshots__/DashboardsBar.spec.js.snap index e67d3db55..348a56964 100644 --- a/src/pages/view/DashboardsBar/__tests__/__snapshots__/DashboardsBar.spec.js.snap +++ b/src/pages/view/DashboardsBar/__tests__/__snapshots__/DashboardsBar.spec.js.snap @@ -18,7 +18,7 @@ exports[`clicking "Show more" maximizes dashboards bar height 1`] = `
- -
+
- -
+ + - - + + + - - + + + - - + + + @@ -933,7 +905,7 @@ exports[`renders a DashboardsBar with selected item 1`] = `
- -
+
- -
+ + - - + + + - - + + + - - + `; exports[`Filter when filterText property is provided renders an input with correct value property 1`] = `
-
- + `; diff --git a/src/pages/view/DashboardsBar/styles/Content.module.css b/src/pages/view/DashboardsBar/styles/Content.module.css index 00360083b..387b5561f 100644 --- a/src/pages/view/DashboardsBar/styles/Content.module.css +++ b/src/pages/view/DashboardsBar/styles/Content.module.css @@ -2,9 +2,7 @@ display: inline; } -.newLink { - display: inline-block; - text-decoration: none; +.newButton { margin-right: var(--spacers-dp8); margin-top: var(--spacers-dp4); } @@ -14,7 +12,8 @@ } .controlsLarge { - display: inline; + position: relative; + top: var(--spacers-dp4); } @media only screen and (max-width: 480px) { diff --git a/src/pages/view/DashboardsBar/styles/Filter.module.css b/src/pages/view/DashboardsBar/styles/Filter.module.css index 11a3966f2..c45ed6154 100644 --- a/src/pages/view/DashboardsBar/styles/Filter.module.css +++ b/src/pages/view/DashboardsBar/styles/Filter.module.css @@ -82,10 +82,6 @@ margin-left: 8px; } -.container { - display: inline; -} - @media only screen and (max-width: 480px) { .input { width: 100%; diff --git a/yarn.lock b/yarn.lock index 84974f6fa..7e5e502de 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1549,10 +1549,10 @@ react-beautiful-dnd "^10.1.1" resize-observer-polyfill "^1.5.1" -"@dhis2/analytics@^17.0.0": - version "17.0.0" - resolved "https://registry.yarnpkg.com/@dhis2/analytics/-/analytics-17.0.0.tgz#ef635ab06a2526f8c61ed7a2996afbbe454bfc3c" - integrity sha512-i76hW5iuwNsWw4F+9qFOymOWkgj6YzqBoKVQ/lZC2mSYrqQWrrRRhKHaFBPKDm/chHo0kTF9Au0IaR3aBAKmbg== +"@dhis2/analytics@^17.0.2": + version "17.0.2" + resolved "https://registry.yarnpkg.com/@dhis2/analytics/-/analytics-17.0.2.tgz#5b818247837d50a8496dc5bc490dca0026e174ec" + integrity sha512-ukL6gMP72F6hMkjt/LEKS9faONpZnDYm0YBbTDPv1JfZt3eKrDeArEwfaWnieGE7BB3+RJkME7aNjuZkh/LnUg== dependencies: "@dhis2/d2-ui-favorites-dialog" "^7.1.5" "@dhis2/d2-ui-org-unit-dialog" "^7.1.5" @@ -1807,7 +1807,7 @@ prop-types "^15.5.10" react-portal "^4.1.5" -"@dhis2/d2-ui-mentions-wrapper@7.1.8", "@dhis2/d2-ui-mentions-wrapper@^7.1.8": +"@dhis2/d2-ui-mentions-wrapper@7.1.8": version "7.1.8" resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-mentions-wrapper/-/d2-ui-mentions-wrapper-7.1.8.tgz#000c3f6b4a0ab1cf0eafe9130a54a066f1080ea7" integrity sha512-OsLDwLltXo8ABLnO8jw2M6UTopFTJwzetC86oHMPg/WtukqsN0kJbmskVAVD6cO8yV5/w1TR059RKjWmm78Wbg== @@ -1816,6 +1816,15 @@ lodash "^4.17.10" prop-types "^15.6.2" +"@dhis2/d2-ui-mentions-wrapper@^7.2.0": + version "7.2.0" + resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-mentions-wrapper/-/d2-ui-mentions-wrapper-7.2.0.tgz#41b216cd5a2895a59cf02c42da9a9c244ee2ec61" + integrity sha512-WN21hMLT6x4E+FUL80BH9m7nfU26FplSd3jj3W1qj1QplfYUE1eABxQPxaDfPFAeFOyOaN4QZxKUY/KmirO9WA== + dependencies: + "@material-ui/core" "^3.3.1" + lodash "^4.17.10" + prop-types "^15.6.2" + "@dhis2/d2-ui-org-unit-dialog@^7.1.5": version "7.1.5" resolved "https://registry.yarnpkg.com/@dhis2/d2-ui-org-unit-dialog/-/d2-ui-org-unit-dialog-7.1.5.tgz#aa6b9257a25ff1a238f77a9638323b6cf0ee37d8"