Skip to content

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

web: don't show login button for logged in users

Abdullah Atta9ee13df74e6f
diff --git a/apps/web/src/components/navigation-menu/index.tsx b/apps/web/src/components/navigation-menu/index.tsx
index 30f330736..30422309d 100644
--- a/apps/web/src/components/navigation-menu/index.tsx
+++ b/apps/web/src/components/navigation-menu/index.tsx
@@ -241,7 +241,7 @@ function NavigationMenu(props: NavigationMenuProps) {
</Flex>
</FlexScrollContainer>
<Flex sx={{ flexDirection: "column" }}>
- {!isLoggedIn && (
+ {isLoggedIn === false && (
<NavigationItem
isTablet={isTablet}
title="Login"
diff --git a/apps/web/src/components/status-bar/index.js b/apps/web/src/components/status-bar/index.js
index 5e70bbc28..2876ead4d 100644
--- a/apps/web/src/components/status-bar/index.js
+++ b/apps/web/src/components/status-bar/index.js
@@ -93,7 +93,7 @@ function StatusBar() {
<SyncStatus />
</>
- ) : (
+ ) : isLoggedIn === false ? (
<Button
variant="statusitem"
onClick={() => hardNavigate("/login")}
@@ -109,7 +109,7 @@ function StatusBar() {
Not logged in
</Text>
</Button>
- )}
+ ) : null}
<Button
variant="statusitem"
onClick={() => showIssueDialog()}
diff --git a/apps/web/src/stores/user-store.js b/apps/web/src/stores/user-store.js
index 9c0cf6e6a..6103c8fe4 100644
--- a/apps/web/src/stores/user-store.js
+++ b/apps/web/src/stores/user-store.js
@@ -35,7 +35,7 @@ import { ANALYTICS_EVENTS, trackEvent } from "../utils/analytics";
import { logger } from "../utils/logger";
class UserStore extends BaseStore {
- isLoggedIn = false;
+ isLoggedIn = undefined;
isLoggingIn = false;
isSigningIn = false;
/**
@@ -50,7 +50,12 @@ class UserStore extends BaseStore {
});
db.user.getUser().then(async (user) => {
- if (!user) return false;
+ if (!user) {
+ this.set((state) => {
+ state.isLoggedIn = false;
+ });
+ return;
+ }
this.set((state) => {
state.user = user;
state.isLoggedIn = true;