From f27bc38e5cf47840971eb685f0ee705f174eadc0 Mon Sep 17 00:00:00 2001 From: HendrikThePendric Date: Tue, 5 Sep 2023 15:34:38 +0200 Subject: [PATCH] fix: show warning text below RichTextEditor when unable to show snapshot (DHIS2-15781) --- i18n/en.pot | 7 ++- src/__demo__/InterpretationsUnit.stories.js | 51 +++++++++++++++++++ .../InterpretationsUnit/InterpretationForm.js | 9 ++++ .../InterpretationsUnit.js | 8 +++ .../common/RichTextEditor/RichTextEditor.js | 9 +++- 5 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 src/__demo__/InterpretationsUnit.stories.js diff --git a/i18n/en.pot b/i18n/en.pot index 52645c02d..bfd246658 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: 2023-07-06T08:30:33.216Z\n" -"PO-Revision-Date: 2023-07-06T08:30:33.216Z\n" +"POT-Creation-Date: 2023-09-27T14:15:13.876Z\n" +"PO-Revision-Date: 2023-09-27T14:15:13.876Z\n" msgid "view only" msgstr "view only" @@ -374,6 +374,9 @@ msgstr "Hide interpretation" msgid "Write an interpretation" msgstr "Write an interpretation" +msgid "Other people viewing this interpretation in the future may see more data." +msgstr "Other people viewing this interpretation in the future may see more data." + msgid "Post interpretation" msgstr "Post interpretation" diff --git a/src/__demo__/InterpretationsUnit.stories.js b/src/__demo__/InterpretationsUnit.stories.js new file mode 100644 index 000000000..f1c786f57 --- /dev/null +++ b/src/__demo__/InterpretationsUnit.stories.js @@ -0,0 +1,51 @@ +import { CustomDataProvider } from '@dhis2/app-runtime' +import { storiesOf } from '@storybook/react' +import React from 'react' +import { InterpretationsUnit } from '../components/Interpretations/InterpretationsUnit/index.js' + +storiesOf('IntepretationsUnit', module).add('Default', () => { + return ( + + + + ) +}) + +storiesOf('IntepretationsUnit', module).add( + 'With no time dimensions warning', + () => { + return ( + + + + ) + } +) diff --git a/src/components/Interpretations/InterpretationsUnit/InterpretationForm.js b/src/components/Interpretations/InterpretationsUnit/InterpretationForm.js index 1fa8b471d..2b7e9d02c 100644 --- a/src/components/Interpretations/InterpretationsUnit/InterpretationForm.js +++ b/src/components/Interpretations/InterpretationsUnit/InterpretationForm.js @@ -14,6 +14,7 @@ export const InterpretationForm = ({ id, currentUser, disabled, + showNoTimeDimensionHelpText, onSave, }) => { const [showRichTextEditor, setShowRichTextEditor] = useState(false) @@ -51,6 +52,13 @@ export const InterpretationForm = ({ inputPlaceholder={inputPlaceholder} onChange={setInterpretationText} value={interpretationText} + helpText={ + showNoTimeDimensionHelpText + ? i18n.t( + 'Other people viewing this interpretation in the future may see more data.' + ) + : undefined + } />