Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

feat: improve note locking/unlocking ux

thecodrr40e3403387cf
diff --git a/apps/web/src/common/vault.js b/apps/web/src/common/vault.js
index 1da7839e2..d62de5c57 100644
--- a/apps/web/src/common/vault.js
+++ b/apps/web/src/common/vault.js
@@ -6,7 +6,7 @@ class Vault {
static createVault() {
return showPasswordDialog("create_vault", async ({ password }) => {
await db.vault.create(password);
- await showToast("success", "Vault created.");
+ showToast("success", "Vault created.");
return true;
});
}
diff --git a/apps/web/src/stores/note-store.js b/apps/web/src/stores/note-store.js
index cac682574..896de624b 100644
--- a/apps/web/src/stores/note-store.js
+++ b/apps/web/src/stores/note-store.js
@@ -93,10 +93,11 @@ class NoteStore extends BaseStore {
};
unlock = async (id) => {
- await Vault.unlockNote(id).then(async () => {
+ return await Vault.unlockNote(id).then(async (res) => {
if (editorStore.get().session.id === id)
await editorStore.openSession(id);
this.refresh();
+ return res;
});
};
diff --git a/apps/web/src/views/settings.js b/apps/web/src/views/settings.js
index 5761ce2b6..14ae17070 100644
--- a/apps/web/src/views/settings.js
+++ b/apps/web/src/views/settings.js
@@ -297,21 +297,24 @@ function Settings(props) {
Vault
</Text>
- {!isVaultCreated && (
- <Button variant="list" onClick={Vault.createVault}>
- <TextWithTip
- text="Create vault"
- tip="Create a password-encrypted vault for your notes"
- />
- </Button>
- )}
-
- {isVaultCreated && (
+ {isVaultCreated ? (
<>
<Button variant="list" onClick={Vault.changeVaultPassword}>
<TextWithTip text="Change vault password" />
</Button>
</>
+ ) : (
+ <Button
+ variant="list"
+ onClick={async () => {
+ setIsVaultCreated(await Vault.createVault());
+ }}
+ >
+ <TextWithTip
+ text="Create vault"
+ tip="Create a password-encrypted vault for your notes"
+ />
+ </Button>
)}
<Text