Skip to content

Commit 7ee2f11

Browse files
authored
fix: notification zindex and reset notification text (italia#309)
1 parent 47d98fa commit 7ee2f11

File tree

7 files changed

+24
-8
lines changed

7 files changed

+24
-8
lines changed

src/app/components/Editor.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,11 @@ export const Editor = (props) => {
198198
};
199199

200200
const handleReset = () => {
201-
notify("Reset", { state: "info" });
201+
notify(
202+
t("editor.form.reset.notification_title"),
203+
t("editor.form.reset.notification_text"),
204+
{ state: "info", dismissable: true },
205+
);
202206
localStorage.setItem("publiccode-editor", "{}");
203207
reset({}, { dirtyFields: true });
204208
setYaml(null);

src/app/components/Foot.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export const Footer = (props: Props): JSX.Element => {
5656
onClick={() => props.reset()}
5757
disabled={!props.languages || props.languages.length === 0}
5858
>
59-
{t("editor.form.reset")}
59+
{t("editor.form.reset.button")}
6060
</button>
6161
</div>
6262
{/* <div className="content__foot_item">

src/app/components/Layout.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import "../../asset/style.scss";
22
import { NotificationManager } from "design-react-kit";
3-
import { NOTIFICATION_TIMEOUT } from "../contents/constants";
3+
4+
const NOTIFICATION_TIMEOUT = 4_000;
45

56
interface Props {
67
children: React.ReactNode;
@@ -9,7 +10,7 @@ interface Props {
910

1011
const Layout = ({ children, isLoading }: Props): JSX.Element => (
1112
<div className={isLoading ? "wrapper loadingRemote" : "wrapper"}>
12-
<NotificationManager duration={NOTIFICATION_TIMEOUT} fix="top" />
13+
<NotificationManager duration={NOTIFICATION_TIMEOUT} fix="top" closeOnClick={false} style={{zIndex: 10}} />
1314
{children}
1415
</div>
1516
);

src/app/contents/constants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,5 @@ export const SAMPLE_YAML_URL = `https://raw.githubusercontent.com/italia/publicc
1313
export const elasticUrl = ELASTIC_URL || "";
1414
export const defaultCountry = DEFAULT_COUNTRY || "it";
1515
export const AUTOSAVE_TIMEOUT = 15000;
16-
export const NOTIFICATION_TIMEOUT = 3000;
1716
export const DEFAULT_BRANCH = "master";
1817
export const defaultBranch = { branch: DEFAULT_BRANCH };

src/i18n/locales/en.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
2222
"yamlloading": "Error loading yaml"
2323
},
2424
"form": {
25-
"reset": "Reset",
25+
"reset": {
26+
"button":"Reset",
27+
"notification_title": "All data cleared",
28+
"notification_text": "All entered data has been cleared"
29+
},
2630
"upload": "Upload",
2731
"validate": "Validate",
2832
"generate": "Generate",

src/i18n/locales/fr.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
2222
"yamlloading": "Error loading yaml"
2323
},
2424
"form": {
25-
"reset": "Reset",
25+
"reset": {
26+
"button":"Reset",
27+
"notification_title": "All data cleared",
28+
"notification_text": "All entered data has been cleared"
29+
},
2630
"upload": "Upload",
2731
"validate": "Validate",
2832
"generate": "Generate",

src/i18n/locales/it.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
2222
"yamlloading": "Errore nel caricamento dello yaml"
2323
},
2424
"form": {
25-
"reset": "Reset",
25+
"reset": {
26+
"button":"Reimposta",
27+
"notification_title": "Dati cancellati",
28+
"notification_text": "Tutti i dati inseriti sono stati cancellati"
29+
},
2630
"upload": "Carica",
2731
"validate": "Valida",
2832
"generate": "Genera",

0 commit comments

Comments
 (0)