From e9a54d150cfcd2f494aa42e0f66e2a794aaa8e88 Mon Sep 17 00:00:00 2001 From: Jen Jones Arnesen Date: Tue, 14 Sep 2021 18:21:54 +0200 Subject: [PATCH] fix: remove other action buttons when in edit mode print preview (#1974) To prevent the user from accidentally losing their changes while in print preview mode, remove all action buttons other than "Exit print preview". We realized there could be some confusion between "Exit print preview" and "Exit without saving". The Exit print preview button jumps left from the Print preview button, which is maybe not ideal. The files changed view looks like major changes were made, but the only change is the addition of the !props.isPrintPreviewView for all the buttons. Note that there are other checks for displaying those buttons as well, like access level for the Delete and Save buttons, so there is some added complexity and additional factors coming into play there. --- i18n/en.pot | 11 ++--- src/pages/edit/ActionsBar.js | 79 ++++++++++++++++++++---------------- 2 files changed, 49 insertions(+), 41 deletions(-) diff --git a/i18n/en.pot b/i18n/en.pot index e9abdc201..58ab4e2cb 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-09-14T10:06:01.370Z\n" -"PO-Revision-Date: 2021-09-14T10:06:01.370Z\n" +"POT-Creation-Date: 2021-09-14T13:34:35.765Z\n" +"PO-Revision-Date: 2021-09-14T13:34:35.765Z\n" msgid "Untitled dashboard" msgstr "Untitled dashboard" @@ -145,8 +145,8 @@ msgstr "Cannot save this dashboard while offline" msgid "Save changes" msgstr "Save changes" -msgid "Exit Print preview" -msgstr "Exit Print preview" +msgid "Exit print preview" +msgstr "Exit print preview" msgid "Print preview" msgstr "Print preview" @@ -340,9 +340,6 @@ msgstr "End of dashboard" msgid "Start of dashboard" msgstr "Start of dashboard" -msgid "Exit print preview" -msgstr "Exit print preview" - msgid "Print" msgstr "Print" diff --git a/src/pages/edit/ActionsBar.js b/src/pages/edit/ActionsBar.js index 052c6a8a6..670e02135 100644 --- a/src/pages/edit/ActionsBar.js +++ b/src/pages/edit/ActionsBar.js @@ -175,55 +175,64 @@ const EditBar = ({ dashboard, ...props }) => { const renderActionButtons = () => ( - - - + + + )} - - - - {dashboard.id && ( + {!props.isPrintPreviewView && ( )} - {dashboard.id && dashboard.access?.delete && ( - + {dashboard.id && !props.isPrintPreviewView && ( + )} + {dashboard.id && + !props.isPrintPreviewView && + dashboard.access?.delete && ( + + + + )} ) @@ -236,11 +245,13 @@ const EditBar = ({ dashboard, ...props }) => {
{dashboard.access?.update ? renderActionButtons() : null} - + {!props.isPrintPreviewView && ( + + )}
{dashboard.access?.update && filterSettingsDialog()}