Skip to content

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

fix: minor user experience bugs

thecodrre99f93ae5985
diff --git a/apps/web/src/app.js b/apps/web/src/app.js
index bd20fea75..d8e39eba1 100644
--- a/apps/web/src/app.js
+++ b/apps/web/src/app.js
@@ -17,10 +17,6 @@ import { EV } from "notes-core/common";
import useTablet from "./utils/use-tablet";
import { showBuyDialog } from "./components/dialogs/buy-dialog";
import Banner from "./components/banner";
-import {
- showAccountDeletedNotice,
- showPasswordChangedNotice,
-} from "./components/dialogs/confirm";
import StatusBar from "./components/statusbar";
import useRoutes from "./utils/use-routes";
import useHashRoutes from "./utils/use-hash-routes";
@@ -73,12 +69,6 @@ function App() {
return { type, result: false };
}
});
- EV.subscribe("user:deleted", async () => {
- await showAccountDeletedNotice();
- });
- EV.subscribe("user:passwordChanged", async () => {
- await showPasswordChangedNotice();
- });
}, []);
useEffect(() => {
diff --git a/apps/web/src/components/dialogs/confirm.js b/apps/web/src/components/dialogs/confirm.js
index 831718c1e..7841f0800 100644
--- a/apps/web/src/components/dialogs/confirm.js
+++ b/apps/web/src/components/dialogs/confirm.js
@@ -99,28 +99,28 @@ export function showLogoutConfirmation() {
});
}
-export function showAccountDeletedNotice() {
- return confirm(Icon.Logout, {
- title: `Account deleted`,
- message:
- "You deleted your account from another device. You have been logged out.",
- yesText: `Okay`,
- });
-}
+// export function showAccountDeletedNotice() {
+// return confirm(Icon.Logout, {
+// title: `Account deleted`,
+// message:
+// "You deleted your account from another device. You have been logged out.",
+// yesText: `Okay`,
+// });
+// }
-export function showPasswordChangedNotice() {
- return confirm(Icon.Logout, {
- title: `Account password changed`,
- message:
- "Your account password was changed, please login again using the new password.",
- yesText: `Okay`,
- });
-}
+// export function showPasswordChangedNotice() {
+// return confirm(Icon.Logout, {
+// title: `Account password changed`,
+// message:
+// "Your account password was changed, please login again using the new password.",
+// yesText: `Okay`,
+// });
+// }
export function showAccountLoggedOutNotice(reason) {
return confirm(Icon.Logout, {
- title: `You were logged out`,
- message: reason,
+ title: reason,
+ message: `You were logged out`,
yesText: `Okay`,
});
}
diff --git a/apps/web/src/stores/user-store.js b/apps/web/src/stores/user-store.js
index 9b32ac2dd..830c66bf0 100644
--- a/apps/web/src/stores/user-store.js
+++ b/apps/web/src/stores/user-store.js
@@ -8,6 +8,7 @@ import { EV } from "notes-core/common";
import { showLoadingDialog } from "../components/dialogs/loadingdialog";
import { Text } from "rebass";
import { showToast } from "../utils/toast";
+import { showAccountLoggedOutNotice } from "../components/dialogs/confirm";
class UserStore extends BaseStore {
isLoggedIn = false;
@@ -35,11 +36,11 @@ class UserStore extends BaseStore {
});
EV.subscribe("user:emailConfirmed", async () => {
showToast("success", "Email confirmed successfully!");
- await this.sync(true);
+ window.location.reload();
});
EV.subscribe("db:sync", () => this.sync(false));
- EV.subscribe("user:loggedOut", async () => {
+ EV.subscribe("user:loggedOut", async (reason) => {
this.set((state) => {
state.user = {};
state.isLoggedIn = false;
@@ -52,6 +53,9 @@ class UserStore extends BaseStore {
if (navigator.credentials.requireUserMediation)
await navigator.credentials.requireUserMediation();
}
+ if (!reason) {
+ await showAccountLoggedOutNotice(reason);
+ }
});
await this.sync();
return true;
diff --git a/apps/web/src/views/settings.js b/apps/web/src/views/settings.js
index 2cec50bb6..6b0bded95 100644
--- a/apps/web/src/views/settings.js
+++ b/apps/web/src/views/settings.js
@@ -254,7 +254,8 @@ function Settings(props) {
variant="list"
onClick={async () => {
if (await showLogoutConfirmation()) {
- await db.user.logout(true, "User's request.");
+ await db.user.logout(true);
+ showToast("success", "You have been logged out.");
}
}}
>
diff --git a/apps/web/yarn.lock b/apps/web/yarn.lock
index 9475e8193..62233b6f8 100644
--- a/apps/web/yarn.lock
+++ b/apps/web/yarn.lock
@@ -8987,7 +8987,7 @@ notes-core@../notes-core:
"notes-core@git+ssh://[email protected]:streetwriters/notesnook-core.git":
version "5.2.1"
- resolved "git+ssh://[email protected]:streetwriters/notesnook-core.git#5f4b4365dc3d24ccf15ea0272dc67fdfd79c4af9"
+ resolved "git+ssh://[email protected]:streetwriters/notesnook-core.git#d5209e9dca4b27f84b62e7748e9f8376183aad6e"
dependencies:
fast-sort "^2.0.1"
fuzzysearch "^1.0.3"