From 7ee2f11bbab69382d6a2b736165d468f1ebd9239 Mon Sep 17 00:00:00 2001 From: Fabio Bonelli Date: Thu, 1 Feb 2024 12:38:47 +0100 Subject: [PATCH] fix: notification zindex and reset notification text (#309) --- src/app/components/Editor.jsx | 6 +++++- src/app/components/Foot.tsx | 2 +- src/app/components/Layout.tsx | 5 +++-- src/app/contents/constants.ts | 1 - src/i18n/locales/en.json | 6 +++++- src/i18n/locales/fr.json | 6 +++++- src/i18n/locales/it.json | 6 +++++- 7 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/app/components/Editor.jsx b/src/app/components/Editor.jsx index 6d9a1ef2..bad7469c 100644 --- a/src/app/components/Editor.jsx +++ b/src/app/components/Editor.jsx @@ -198,7 +198,11 @@ export const Editor = (props) => { }; const handleReset = () => { - notify("Reset", { state: "info" }); + notify( + t("editor.form.reset.notification_title"), + t("editor.form.reset.notification_text"), + { state: "info", dismissable: true }, + ); localStorage.setItem("publiccode-editor", "{}"); reset({}, { dirtyFields: true }); setYaml(null); diff --git a/src/app/components/Foot.tsx b/src/app/components/Foot.tsx index 3bc8fb30..6a060662 100644 --- a/src/app/components/Foot.tsx +++ b/src/app/components/Foot.tsx @@ -56,7 +56,7 @@ export const Footer = (props: Props): JSX.Element => { onClick={() => props.reset()} disabled={!props.languages || props.languages.length === 0} > - {t("editor.form.reset")} + {t("editor.form.reset.button")} {/*
diff --git a/src/app/components/Layout.tsx b/src/app/components/Layout.tsx index 2eca621c..9d7cdd67 100644 --- a/src/app/components/Layout.tsx +++ b/src/app/components/Layout.tsx @@ -1,6 +1,7 @@ import "../../asset/style.scss"; import { NotificationManager } from "design-react-kit"; -import { NOTIFICATION_TIMEOUT } from "../contents/constants"; + +const NOTIFICATION_TIMEOUT = 4_000; interface Props { children: React.ReactNode; @@ -9,7 +10,7 @@ interface Props { const Layout = ({ children, isLoading }: Props): JSX.Element => (
- + {children}
); diff --git a/src/app/contents/constants.ts b/src/app/contents/constants.ts index 2027bfdc..e3ad7d98 100644 --- a/src/app/contents/constants.ts +++ b/src/app/contents/constants.ts @@ -13,6 +13,5 @@ export const SAMPLE_YAML_URL = `https://raw.githubusercontent.com/italia/publicc export const elasticUrl = ELASTIC_URL || ""; export const defaultCountry = DEFAULT_COUNTRY || "it"; export const AUTOSAVE_TIMEOUT = 15000; -export const NOTIFICATION_TIMEOUT = 3000; export const DEFAULT_BRANCH = "master"; export const defaultBranch = { branch: DEFAULT_BRANCH }; diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index 76037c2d..155d8fe8 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -22,7 +22,11 @@ "yamlloading": "Error loading yaml" }, "form": { - "reset": "Reset", + "reset": { + "button":"Reset", + "notification_title": "All data cleared", + "notification_text": "All entered data has been cleared" + }, "upload": "Upload", "validate": "Validate", "generate": "Generate", diff --git a/src/i18n/locales/fr.json b/src/i18n/locales/fr.json index 3bd1c5bf..91bb31c8 100644 --- a/src/i18n/locales/fr.json +++ b/src/i18n/locales/fr.json @@ -22,7 +22,11 @@ "yamlloading": "Error loading yaml" }, "form": { - "reset": "Reset", + "reset": { + "button":"Reset", + "notification_title": "All data cleared", + "notification_text": "All entered data has been cleared" + }, "upload": "Upload", "validate": "Validate", "generate": "Generate", diff --git a/src/i18n/locales/it.json b/src/i18n/locales/it.json index 1b1c0afa..80481a00 100644 --- a/src/i18n/locales/it.json +++ b/src/i18n/locales/it.json @@ -22,7 +22,11 @@ "yamlloading": "Errore nel caricamento dello yaml" }, "form": { - "reset": "Reset", + "reset": { + "button":"Reimposta", + "notification_title": "Dati cancellati", + "notification_text": "Tutti i dati inseriti sono stati cancellati" + }, "upload": "Carica", "validate": "Valida", "generate": "Genera",