From 993981bb9bfd9c843859dfdbca2e624697d08a50 Mon Sep 17 00:00:00 2001 From: Jen Jones Arnesen Date: Wed, 26 Feb 2020 06:55:21 -0800 Subject: [PATCH] feat: condense item header options into a single menu (#568) All options in the dashboard item, for a visualization, are now moved to a single button with a dropdown menu. This includes the "View as" options for switching between Map, Table, Chart, as well as show/hideing the interpretations and open the Vis in the corresponding app. This commit also fixes wrapping issues when for the item title when the item is narrow. --- i18n/en.pot | 36 +- package.json | 2 +- src/components/App.js | 78 +-- src/components/Item/AppItem/Item.js | 2 +- src/components/Item/DeleteItemButton.js | 24 + src/components/Item/ItemHeader.js | 55 ++- src/components/Item/ItemHeaderButton.js | 27 -- src/components/Item/ListItem/Item.js | 2 +- src/components/Item/MessagesItem/Item.js | 6 +- src/components/Item/NotSupportedItem/Item.js | 8 +- src/components/Item/SpacerItem/Item.js | 9 +- src/components/Item/TextItem/Item.js | 2 +- src/components/Item/VisualizationItem/Item.js | 78 +-- .../VisualizationItem/ItemHeaderButtons.js | 272 +++++------ .../__tests__/ItemHeaderButtons.spec.js | 12 +- .../__tests__/__snapshots__/Item.spec.js.snap | 126 +---- .../ItemHeaderButtons.spec.js.snap | 456 ++++++++++++------ .../Item/VisualizationItem/assets/icons.js | 31 ++ .../Item/__tests__/ItemHeaderButton.spec.js | 15 - .../ItemHeaderButton.spec.js.snap | 88 ---- .../DeleteItemButton.module.css} | 4 +- .../Item/styles/ItemHeader.module.css | 28 ++ src/components/ItemGrid/DeleteItemButton.js | 29 -- src/components/ItemGrid/ItemGrid.css | 20 - src/components/ItemGrid/ItemGrid.js | 9 +- src/modules/itemTypes.js | 13 +- yarn.lock | 9 + 27 files changed, 714 insertions(+), 727 deletions(-) create mode 100644 src/components/Item/DeleteItemButton.js delete mode 100644 src/components/Item/ItemHeaderButton.js create mode 100644 src/components/Item/VisualizationItem/assets/icons.js delete mode 100644 src/components/Item/__tests__/ItemHeaderButton.spec.js delete mode 100644 src/components/Item/__tests__/__snapshots__/ItemHeaderButton.spec.js.snap rename src/components/Item/{ItemHeaderButton.css => styles/DeleteItemButton.module.css} (64%) create mode 100644 src/components/Item/styles/ItemHeader.module.css delete mode 100644 src/components/ItemGrid/DeleteItemButton.js diff --git a/i18n/en.pot b/i18n/en.pot index ab7b91dfb..a161cb591 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: 2020-02-12T20:02:08.021Z\n" -"PO-Revision-Date: 2020-02-12T20:02:08.021Z\n" +"POT-Creation-Date: 2020-02-25T15:24:49.055Z\n" +"PO-Revision-Date: 2020-02-25T15:24:49.055Z\n" msgid "Dashboard" msgstr "" @@ -64,12 +64,18 @@ msgstr[1] "" msgid "Remove" msgstr "" +msgid "Delete item" +msgstr "" + msgid "Messages" msgstr "" msgid "See all messages" msgstr "" +msgid "Item type \"{{type}}\" not supported" +msgstr "" + msgid "Spacer" msgstr "" @@ -88,6 +94,24 @@ msgstr "" msgid "No data to display" msgstr "" +msgid "Hide interpretations and details" +msgstr "" + +msgid "Show interpretations and details" +msgstr "" + +msgid "View as Chart" +msgstr "" + +msgid "View as Table" +msgstr "" + +msgid "View as Map" +msgstr "" + +msgid "Open in {{appName}} app" +msgstr "" + msgid "Confirm" msgstr "" @@ -130,7 +154,7 @@ msgstr "" msgid "Visualizations" msgstr "" -msgid "Visualizer" +msgid "Pivot tables" msgstr "" msgid "Pivot tables" @@ -145,15 +169,9 @@ msgstr "" msgid "Event reports" msgstr "" -msgid "Event Reports" -msgstr "" - msgid "Event charts" msgstr "" -msgid "Event Visualizer" -msgstr "" - msgid "Apps" msgstr "" diff --git a/package.json b/package.json index 91d5c8a10..6f75cca3b 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "@dhis2/d2-ui-translation-dialog": "^6.0.1", "@dhis2/data-visualizer-plugin": "^34.3.3", "@dhis2/prop-types": "^1.2.1", - "@dhis2/ui-core": "^4.9.1", + "@dhis2/ui-core": "^4.11.0", "@dhis2/ui-widgets": "^2.0.5", "@material-ui/core": "^3.9.2", "@material-ui/icons": "^3.0.2", diff --git a/src/components/App.js b/src/components/App.js index 509a8b9b7..46c53371d 100644 --- a/src/components/App.js +++ b/src/components/App.js @@ -4,6 +4,7 @@ import { connect } from 'react-redux'; import PropTypes from 'prop-types'; import i18n from '@dhis2/d2-i18n'; import { HeaderBar } from '@dhis2/ui-widgets'; +import { CssVariables } from '@dhis2/ui-core'; import { EDIT, VIEW, NEW } from './Dashboard/dashboardModes'; import { acReceivedUser } from '../actions/user'; @@ -30,44 +31,47 @@ export class App extends Component { render() { return ( -
-
- + <> + +
+
+ +
+ + + ( + + )} + /> + ( + + )} + /> + ( + + )} + /> + ( + + )} + /> + + +
- - - ( - - )} - /> - ( - - )} - /> - ( - - )} - /> - ( - - )} - /> - - - -
+ ); } } diff --git a/src/components/Item/AppItem/Item.js b/src/components/Item/AppItem/Item.js index bfb10f9a3..b96538f48 100644 --- a/src/components/Item/AppItem/Item.js +++ b/src/components/Item/AppItem/Item.js @@ -39,7 +39,7 @@ const AppItem = ({ item, itemFilters }, context) => { return appDetails && appDetails.name && appDetails.launchUrl ? ( - +