Skip to content

Commit 5083b50

Browse files
committed
Enter key will now be registered in multiple dialogs, added informational text to vault page
1 parent 4487590 commit 5083b50

File tree

11 files changed

+82
-17
lines changed

11 files changed

+82
-17
lines changed

src/components/CreatePasswordDialog/index.jsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ const CreatePasswordDialog = ({ open, onCreate, onClose }) => {
3939
handleClose();
4040
};
4141

42+
/**
43+
* Handle the key up event
44+
* @param e The event argument
45+
*/
46+
const handleKeyUp = (e) => {
47+
if (e.key === 'Enter' && password.length > 0 && title.length > 0) {
48+
create();
49+
}
50+
};
51+
4252
return (
4353
<Dialog
4454
open={open}
@@ -55,6 +65,7 @@ const CreatePasswordDialog = ({ open, onCreate, onClose }) => {
5565
error={title.length === 0}
5666
label={language.title}
5767
onChange={(e) => setTitle(e.target.value)}
68+
onKeyUp={handleKeyUp}
5869
autoComplete="off"
5970
variant="outlined"
6071
fullWidth
@@ -64,6 +75,7 @@ const CreatePasswordDialog = ({ open, onCreate, onClose }) => {
6475
value={description}
6576
label={language.description}
6677
onChange={(e) => setDescription(e.target.value)}
78+
onKeyUp={handleKeyUp}
6779
autoComplete="off"
6880
variant="outlined"
6981
fullWidth
@@ -73,6 +85,7 @@ const CreatePasswordDialog = ({ open, onCreate, onClose }) => {
7385
value={url}
7486
label={language.url}
7587
onChange={(e) => setUrl(e.target.value)}
88+
onKeyUp={handleKeyUp}
7689
autoComplete="off"
7790
variant="outlined"
7891
fullWidth
@@ -84,6 +97,7 @@ const CreatePasswordDialog = ({ open, onCreate, onClose }) => {
8497
error={password.length === 0}
8598
label={language.password}
8699
onChange={(e) => setPassword(e.target.value)}
100+
onKeyUp={handleKeyUp}
87101
autoComplete="off"
88102
variant="outlined"
89103
fullWidth

src/components/EditPasswordDialog/index.jsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@ const EditPasswordDialog = ({
3737
handleClose();
3838
};
3939

40+
/**
41+
* Handle the key up event
42+
* @param e The event argument
43+
*/
44+
const handleKeyUp = (e) => {
45+
if (e.key === 'Enter' && password.length > 0 && title.length > 0) {
46+
save();
47+
}
48+
};
49+
4050
return (
4151
<Dialog
4252
open={open}
@@ -53,6 +63,7 @@ const EditPasswordDialog = ({
5363
error={title.length === 0}
5464
label={language.title}
5565
onChange={(e) => setTitle(e.target.value)}
66+
onKeyUp={handleKeyUp}
5667
autoComplete="off"
5768
variant="outlined"
5869
fullWidth
@@ -62,6 +73,7 @@ const EditPasswordDialog = ({
6273
value={description}
6374
label={language.description}
6475
onChange={(e) => setDescription(e.target.value)}
76+
onKeyUp={handleKeyUp}
6577
autoComplete="off"
6678
variant="outlined"
6779
fullWidth
@@ -71,6 +83,7 @@ const EditPasswordDialog = ({
7183
value={url}
7284
label={language.url}
7385
onChange={(e) => setUrl(e.target.value)}
86+
onKeyUp={handleKeyUp}
7487
autoComplete="off"
7588
variant="outlined"
7689
fullWidth
@@ -82,6 +95,7 @@ const EditPasswordDialog = ({
8295
error={password.length === 0}
8396
label={language.password}
8497
onChange={(e) => setPassword(e.target.value)}
98+
onKeyUp={handleKeyUp}
8599
autoComplete="off"
86100
variant="outlined"
87101
fullWidth

src/components/EncryptionKeyDialog/index.jsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ const EncryptionKeyDialog = ({ open, onAccept, onClose }) => {
1717
* Close the dialog
1818
*/
1919
const handleClose = () => {
20+
setKey('');
2021
if (onClose) {
2122
onClose();
2223
}
23-
setKey('');
2424
};
2525

2626
/**
@@ -36,6 +36,24 @@ const EncryptionKeyDialog = ({ open, onAccept, onClose }) => {
3636
handleClose();
3737
};
3838

39+
/**
40+
* Change the key value
41+
* @param e The event argument
42+
*/
43+
const handleChange = (e) => {
44+
setKey(e.target.value);
45+
};
46+
47+
/**
48+
* Handle the key up event
49+
* @param e The event argument
50+
*/
51+
const handleKeyUp = (e) => {
52+
if (e.key === 'Enter') {
53+
accept();
54+
}
55+
};
56+
3957
return (
4058
<Dialog
4159
open={open}
@@ -52,7 +70,8 @@ const EncryptionKeyDialog = ({ open, onAccept, onClose }) => {
5270
type="password"
5371
error={key.length === 0}
5472
label={language.decryptionKey}
55-
onChange={(e) => setKey(e.target.value)}
73+
onChange={handleChange}
74+
onKeyUp={handleKeyUp}
5675
autoComplete="off"
5776
variant="outlined"
5877
fullWidth

src/languages/de_de.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,6 @@
9797
"search": "Suche",
9898
"editPassword": "Passwort bearbeiten",
9999
"close": "Schließen",
100-
"copy": "Kopieren"
100+
"copy": "Kopieren",
101+
"createOrOpenVault": "Erstellen oder öffnen Sie einen Tresor"
101102
}

src/languages/en_us.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,6 @@
9797
"search": "Search",
9898
"editPassword": "Edit password",
9999
"close": "Close",
100-
"copy": "Copy"
100+
"copy": "Copy",
101+
"createOrOpenVault": "Create or open a vault"
101102
}

src/languages/fr_fr.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,6 @@
9797
"search": "Rechercher",
9898
"editPassword": "Modifier le mot de passe",
9999
"close": "Fermer",
100-
"copy": "Copier"
100+
"copy": "Copier",
101+
"createOrOpenVault": "Créer ou ouvrir un coffre-fort"
101102
}

src/languages/jp_jp.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,6 @@
9797
"search": "サーチ",
9898
"editPassword": "パスワードを編集する",
9999
"close": "閉じる",
100-
"copy": "コピー"
100+
"copy": "コピー",
101+
"createOrOpenVault": "金庫を作成または開く"
101102
}

src/languages/nl_nl.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,6 @@
9797
"search": "Zoeken",
9898
"editPassword": "Wachtwoord bewerken",
9999
"close": "Sluiten",
100-
"copy": "Kopiëren"
100+
"copy": "Kopiëren",
101+
"createOrOpenVault": "Maak een nieuwe kluis of open een bestaande kluis"
101102
}

src/languages/ru_ru.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,6 @@
9797
"search": "Поиск",
9898
"editPassword": "Изменить пароль",
9999
"close": "Закрыть",
100-
"copy": "Копировать"
100+
"copy": "Копировать",
101+
"createOrOpenVault": "Создать или открыть сейф"
101102
}

src/languages/zh_cn.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,6 @@
9797
"search": "搜索",
9898
"editPassword": "编辑密码",
9999
"close": "关闭",
100-
"copy": "复制"
100+
"copy": "复制",
101+
"createOrOpenVault": "创建或打开保险库"
101102
}

0 commit comments

Comments
 (0)