Skip to content

Commit 86eebd6

Browse files
committed
* Added a reset confirmation dialog
1 parent 85c8107 commit 86eebd6

File tree

12 files changed

+118
-11
lines changed

12 files changed

+118
-11
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import React from "react";
2+
import {useSelector} from "react-redux";
3+
import Dialog from "@material-ui/core/Dialog";
4+
import DialogTitle from "@material-ui/core/DialogTitle";
5+
import DialogContent from "@material-ui/core/DialogContent";
6+
import DialogContentText from "@material-ui/core/DialogContentText";
7+
import DialogActions from "@material-ui/core/DialogActions";
8+
import Button from "@material-ui/core/Button";
9+
10+
const ConfirmationDialog = ({open, title, content, onAccept, onCancel, onClose}) => {
11+
12+
const language = useSelector(state => state.MainReducer.languages[state.MainReducer.languageIndex]);
13+
14+
/**
15+
* Close the AlertDialog instance
16+
*/
17+
const handleClose = () => {
18+
if (onClose) onClose();
19+
};
20+
21+
/**
22+
* Accept the confirmation
23+
*/
24+
const accept = () => {
25+
if (onAccept) onAccept();
26+
handleClose();
27+
}
28+
29+
/**
30+
* Cancel the confirmation
31+
*/
32+
const cancel = () => {
33+
if (onCancel) onCancel();
34+
handleClose();
35+
}
36+
37+
return (
38+
<Dialog
39+
open={open}
40+
onClose={handleClose}
41+
aria-labelledby="alert-dialog-title"
42+
aria-describedby="alert-dialog-description"
43+
>
44+
<DialogTitle id="alert-dialog-title">{title}</DialogTitle>
45+
<DialogContent>
46+
<DialogContentText id="alert-dialog-description">
47+
{content}
48+
</DialogContentText>
49+
</DialogContent>
50+
<DialogActions>
51+
<Button onClick={cancel} color="primary">
52+
{language.no}
53+
</Button>
54+
<Button onClick={accept} color="primary" autoFocus>
55+
{language.yes}
56+
</Button>
57+
</DialogActions>
58+
</Dialog>
59+
);
60+
}
61+
62+
export default ConfirmationDialog;

src/languages/de_DE.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ const de_DE = () => {
7272
darkThemeDescription: "Schont die Augen.",
7373
export: "Export",
7474
yourTextHere: "Dein Text hier",
75-
filePath: "Dateipfad"
75+
filePath: "Dateipfad",
76+
yes: "Ja",
77+
no: "Nein",
78+
confirmation: "Bestätigung",
79+
confirmResetSettings: "Möchten Sie wirklich alle Einstellungen zurücksetzen?"
7680
}
7781
};
7882

src/languages/en_US.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ const en_US = () => {
7272
darkThemeDescription: "Easy on the eyes.",
7373
export: "Export",
7474
yourTextHere: "Your text here",
75-
filePath: "File path"
75+
filePath: "File path",
76+
yes: "Yes",
77+
no: "No",
78+
confirmation: "Confirmation",
79+
confirmResetSettings: "Are you sure you want to reset all settings?"
7680
}
7781
};
7882

src/languages/es_ES.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ const es_ES = () => {
7272
darkThemeDescription: "Fácil para los ojos.",
7373
export: "Exportar",
7474
yourTextHere: "Tu texto aqui",
75-
filePath: "Ruta de archivo"
75+
filePath: "Ruta de archivo",
76+
yes: "Sí",
77+
no: "No",
78+
confirmation: "Confirmación",
79+
confirmResetSettings: "¿Estás seguro de que quieres restablecer todos los ajustes?"
7680
}
7781
};
7882

src/languages/fr_FR.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ const fr_FR = () => {
7272
darkThemeDescription: "Facile sur les yeux.",
7373
export: "Exporter",
7474
yourTextHere: "Votre texte ici",
75-
filePath: "Chemin du fichier"
75+
filePath: "Chemin du fichier",
76+
yes: "Oui",
77+
no: "Non",
78+
confirmation: "Confirmation",
79+
confirmResetSettings: "Voulez-vous vraiment réinitialiser tous les paramètres?"
7680
}
7781
};
7882

src/languages/it_IT.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ const it_IT = () => {
7272
darkThemeDescription: "Facile per gli occhi.",
7373
export: "Esportare",
7474
yourTextHere: "Il tuo testo qui",
75-
filePath: "Percorso del file"
75+
filePath: "Percorso del file",
76+
yes: "Sì",
77+
no: "No",
78+
confirmation: "Conferma",
79+
confirmResetSettings: "Sei sicuro di voler ripristinare tutte le impostazioni?"
7680
}
7781
};
7882

src/languages/jp_JP.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ const jp_JP = () => {
7272
darkThemeDescription: "目に優しい。",
7373
export: "書き出す",
7474
yourTextHere: "ここにあなたのテキスト",
75-
filePath: "ファイルパス"
75+
filePath: "ファイルパス",
76+
yes: "はい",
77+
no: "番号",
78+
confirmation: "確認",
79+
confirmResetSettings: "すべての設定をリセットしてもよろしいですか?"
7680
}
7781
};
7882

src/languages/nl_NL.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ const nl_NL = () => {
7272
darkThemeDescription: "Makkelijk voor de ogen.",
7373
export: "Exporteren",
7474
yourTextHere: "Jouw text hier",
75-
filePath: "Bestandspad"
75+
filePath: "Bestandspad",
76+
yes: "Ja",
77+
no: "Nee",
78+
confirmation: "Bevestiging",
79+
confirmResetSettings: "Bent u zeker dat u alle instellingen wenst te resetten?"
7680
}
7781
};
7882

src/languages/pt_PT.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ const pt_PT = () => {
7272
darkThemeDescription: "Fácil para os olhos.",
7373
export: "Exportação",
7474
yourTextHere: "Seu texto aqui",
75-
filePath: "Caminho de arquivo"
75+
filePath: "Caminho de arquivo",
76+
yes: "Sim",
77+
no: "Não",
78+
confirmation: "Confirmação",
79+
confirmResetSettings: "Tem certeza de que deseja redefinir todas as configurações?"
7680
}
7781
};
7882

src/languages/ru_RU.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ const ru_RU = () => {
7272
darkThemeDescription: "Легко на глазах.",
7373
export: "экспорт",
7474
yourTextHere: "Здесь ваш текст",
75-
filePath: "Путь файла"
75+
filePath: "Путь файла",
76+
yes: "да",
77+
no: "нет",
78+
confirmation: "подтверждение",
79+
confirmResetSettings: "Вы уверены, что хотите сбросить все настройки?"
7680
}
7781
};
7882

0 commit comments

Comments
 (0)