From 58b205a70e1d7613a3085527e40fe4adaea08e45 Mon Sep 17 00:00:00 2001 From: Jen Jones Arnesen Date: Tue, 8 Sep 2020 09:08:17 +0200 Subject: [PATCH 1/3] fix: add warning to items that have been shortened --- i18n/en.pot | 7 +++-- .../Dashboard/PrintLayoutDashboard.js | 1 + src/components/Item/AppItem/Item.js | 1 + src/components/Item/ItemHeader/ItemHeader.js | 18 ++++++++----- .../Item/ItemHeader/PrintWarning.js | 20 ++++++++++++++ .../ItemHeader/styles/PrintWarning.module.css | 11 ++++++++ src/components/Item/ListItem/Item.js | 1 + src/components/Item/MessagesItem/Item.js | 1 + src/components/Item/TextItem/Item.js | 26 +++++++++++++++++-- src/components/Item/VisualizationItem/Item.js | 1 + .../ItemGrid/PrintLayoutItemGrid.js | 1 + src/icons/Warning.js | 17 ++++++++++++ src/modules/printUtils.js | 2 +- 13 files changed, 96 insertions(+), 11 deletions(-) create mode 100644 src/components/Item/ItemHeader/PrintWarning.js create mode 100644 src/components/Item/ItemHeader/styles/PrintWarning.module.css create mode 100644 src/icons/Warning.js diff --git a/i18n/en.pot b/i18n/en.pot index db5290946..d0622c869 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-08-31T08:37:42.542Z\n" -"PO-Revision-Date: 2020-08-31T08:37:42.542Z\n" +"POT-Creation-Date: 2020-09-08T06:57:57.672Z\n" +"PO-Revision-Date: 2020-09-08T06:57:57.672Z\n" msgid "Untitled dashboard" msgstr "" @@ -102,6 +102,9 @@ msgstr "" msgid "Delete item" msgstr "" +msgid "This item has been shortened to fit on one page" +msgstr "" + msgid "Messages" msgstr "" diff --git a/src/components/Dashboard/PrintLayoutDashboard.js b/src/components/Dashboard/PrintLayoutDashboard.js index 0f73e7b26..8b5cc2720 100644 --- a/src/components/Dashboard/PrintLayoutDashboard.js +++ b/src/components/Dashboard/PrintLayoutDashboard.js @@ -96,6 +96,7 @@ export class PrintLayoutDashboard extends Component { // page (react-grid-layout units) this.props.items.forEach(item => { if (item.h > MAX_ITEM_GRID_HEIGHT) { + item.shortened = true this.props.updateDashboardItem( Object.assign({}, item, { h: MAX_ITEM_GRID_HEIGHT }) ) diff --git a/src/components/Item/AppItem/Item.js b/src/components/Item/AppItem/Item.js index 2ef13e594..e795a2c33 100644 --- a/src/components/Item/AppItem/Item.js +++ b/src/components/Item/AppItem/Item.js @@ -48,6 +48,7 @@ const AppItem = ({ dashboardMode, item, itemFilters }, context) => { title={appDetails.name} itemId={item.id} dashboardMode={dashboardMode} + hasWarning={item.shortened} />