From 981a29240a96eee92e7ccd1dd03ebc1ba3a4e605 Mon Sep 17 00:00:00 2001 From: Albina Date: Fri, 27 Sep 2024 13:19:58 +0300 Subject: [PATCH] OV-444: + add unsaved warning --- .../warning-modal/components/components.ts | 1 + .../components/unsaved-warning-content.tsx | 41 ++++++++++++++++ .../warning-modal/warning-modal.tsx | 13 +++-- frontend/src/bundles/studio/pages/studio.tsx | 48 ++++++++++++++++--- frontend/src/bundles/studio/store/slice.ts | 3 ++ 5 files changed, 93 insertions(+), 13 deletions(-) create mode 100644 frontend/src/bundles/studio/components/warning-modal/components/unsaved-warning-content.tsx diff --git a/frontend/src/bundles/studio/components/warning-modal/components/components.ts b/frontend/src/bundles/studio/components/warning-modal/components/components.ts index b6f205279..e2562a94a 100644 --- a/frontend/src/bundles/studio/components/warning-modal/components/components.ts +++ b/frontend/src/bundles/studio/components/warning-modal/components/components.ts @@ -1 +1,2 @@ +export { UnsavedWarningContent } from './unsaved-warning-content.js'; export { WarningContent } from './warning-content.js'; diff --git a/frontend/src/bundles/studio/components/warning-modal/components/unsaved-warning-content.tsx b/frontend/src/bundles/studio/components/warning-modal/components/unsaved-warning-content.tsx new file mode 100644 index 000000000..e4cdcc44c --- /dev/null +++ b/frontend/src/bundles/studio/components/warning-modal/components/unsaved-warning-content.tsx @@ -0,0 +1,41 @@ +import { + Button, + Flex, + Heading, + Text, +} from '~/bundles/common/components/components.js'; + +type Properties = { + onCancel: () => void; + onSubmit: () => void; +}; + +const UnsavedWarningContent: React.FC = ({ + onCancel, + onSubmit, +}) => { + return ( + <> + + Notice before you leave the page + + + + If you leave now all your unsaved changes will be lost. Please + save draft or submit to render before leaving. + + + +