A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
fix: navigation issues on tablet and mobile
thecodrrdc7f1856a33a
diff --git a/apps/web/src/app.js b/apps/web/src/app.jsindex c509edfe8..70a8b9c2b 100644--- a/apps/web/src/app.js+++ b/apps/web/src/app.js@@ -5,6 +5,7 @@ import ThemeProvider from "./components/theme-provider";import { useStore } from "./stores/app-store";import { useStore as useUserStore } from "./stores/user-store";import { useStore as useNotesStore } from "./stores/note-store";+import { useStore as useEditorStore } from "./stores/editor-store";import Animated from "./components/animated";import NavigationMenu from "./components/navigationmenu";import routes from "./navigation/routes";@@ -35,6 +36,7 @@ function App() {const initUser = useUserStore((store) => store.init);const initNotes = useNotesStore((store) => store.init);const isEditorOpen = useStore((store) => store.isEditorOpen);+ const clearSession = useEditorStore((store) => store.clearSession);const toggleSideMenu = useStore((store) => store.toggleSideMenu);const setIsVaultCreated = useStore((store) => store.setIsVaultCreated);const version = useVersion();@@ -91,7 +93,9 @@ function App() {useEffect(() => {if (!isMobile && !isTablet) return;+ console.log("turning", isEditorOpen);setShow(!isEditorOpen);+ //setIsEditorOpen(!show);// if (isTablet) toggleSideMenu(!isEditorOpen);// if (!isEditorOpen && !isTablet && !isMobile) toggleSideMenu(true);// // eslint-disable-next-line react-hooks/exhaustive-deps@@ -119,7 +123,10 @@ function App() {><Flex flex={1} sx={{ overflow: "hidden" }}><NavigationMenu- toggleNavigationContainer={(state) => setShow(state || !show)}+ toggleNavigationContainer={(state) => {+ if (isMobile || isTablet) clearSession();+ else setShow(state || !show);+ }}/><Flex variant="rowFill"><Animated.Flexdiff --git a/apps/web/src/navigation/hash-routes.js b/apps/web/src/navigation/hash-routes.jsindex d18320604..db113c666 100644--- a/apps/web/src/navigation/hash-routes.js+++ b/apps/web/src/navigation/hash-routes.js@@ -14,11 +14,12 @@ import Unlock from "../components/unlock";import { store as appStore } from "../stores/app-store";import { store as editorStore } from "../stores/editor-store";import { store as noteStore } from "../stores/note-store";-import { isMobile } from "../utils/dimensions";+import { isMobile, isTablet } from "../utils/dimensions";const hashroutes = {"/": () => {closeOpenedDialog();+ if (isMobile() || isTablet()) editorStore.clearSession(false);},"/email/verify": () => {showEmailVerificationDialog();diff --git a/apps/web/src/stores/editor-store.js b/apps/web/src/stores/editor-store.jsindex dc6d9435f..13c833d5f 100644--- a/apps/web/src/stores/editor-store.js+++ b/apps/web/src/stores/editor-store.js@@ -143,7 +143,7 @@ class EditorStore extends BaseStore {noteStore.setSelectedNote(0);};- clearSession = () => {+ clearSession = (shouldNavigate = true) => {appStore.setIsEditorOpen(false);this.set((state) => {state.session = {@@ -152,7 +152,7 @@ class EditorStore extends BaseStore {};});noteStore.setSelectedNote(0);- hashNavigate(`/`);+ if (shouldNavigate) hashNavigate(`/`);};setSession = (set) => {