mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-03 12:41:45 +02:00
feat: improve note locking/unlocking ux
This commit is contained in:
@@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user