From 5869fefa7d65c9bf10be5a397035c49074ab0e79 Mon Sep 17 00:00:00 2001 From: eirikhaugstulen Date: Wed, 30 Oct 2024 12:37:09 +0100 Subject: [PATCH] fix: revert removal of back button --- i18n/en.pot | 7 ++- .../ViewEventComponent/ViewEvent.component.js | 59 ++++++++++++++----- 2 files changed, 48 insertions(+), 18 deletions(-) diff --git a/i18n/en.pot b/i18n/en.pot index 882feced4a..099774e402 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: 2024-10-17T17:11:55.065Z\n" -"PO-Revision-Date: 2024-10-17T17:11:55.065Z\n" +"POT-Creation-Date: 2024-10-30T11:37:11.048Z\n" +"PO-Revision-Date: 2024-10-30T11:37:11.048Z\n" msgid "Choose one or more dates..." msgstr "Choose one or more dates..." @@ -906,6 +906,9 @@ msgstr "Indicators" msgid "Warnings" msgstr "Warnings" +msgid "Show all events" +msgstr "Show all events" + msgid "Event could not be loaded. Are you sure it exists?" msgstr "Event could not be loaded. Are you sure it exists?" diff --git a/src/core_modules/capture-core/components/Pages/ViewEvent/ViewEventComponent/ViewEvent.component.js b/src/core_modules/capture-core/components/Pages/ViewEvent/ViewEventComponent/ViewEvent.component.js index a7c717c802..76d7d1b2dd 100644 --- a/src/core_modules/capture-core/components/Pages/ViewEvent/ViewEventComponent/ViewEvent.component.js +++ b/src/core_modules/capture-core/components/Pages/ViewEvent/ViewEventComponent/ViewEvent.component.js @@ -1,10 +1,13 @@ // @flow import React, { Component } from 'react'; +import i18n from '@dhis2/d2-i18n'; import { withStyles } from '@material-ui/core/styles'; -import { spacers } from '@dhis2/ui'; +import { Button, IconChevronLeft24, spacers } from '@dhis2/ui'; import { EventDetails } from '../EventDetailsSection/EventDetailsSection.container'; import { RightColumnWrapper } from '../RightColumn/RightColumnWrapper.component'; import type { ProgramStage } from '../../../../metaData'; +import { DiscardDialog } from '../../../Dialogs/DiscardDialog.component'; +import { defaultDialogProps } from '../../../Dialogs/DiscardDialog.constants'; import type { UserFormField } from '../../../FormFields/UserField'; import { EventBreadcrumb } from '../../../Breadcrumbs/EventBreadcrumb'; import { pageKeys } from '../../../Breadcrumbs/EventBreadcrumb/EventBreadcrumb'; @@ -69,6 +72,14 @@ class ViewEventPlain extends Component { warningOpen: false, }; } + handleGoBackToAllEvents = () => { + const { isUserInteractionInProgress, onBackToAllEvents } = this.props; + if (!isUserInteractionInProgress) { + onBackToAllEvents(); + } else { + this.setState({ warningOpen: true }); + } + } render() { const { @@ -96,22 +107,38 @@ class ViewEventPlain extends Component { onBackToViewEvent={onBackToViewEvent} onBackToMainPage={onBackToAllEvents} /> -
- - +
+ +
+ + +
+ { this.setState({ warningOpen: false }); }} + onDestroy={() => this.props.onBackToAllEvents()} + open={this.state.warningOpen} + />
);