Skip to content

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

ui: minor fixes

thecodrrfc75aed6058f
diff --git a/apps/web/src/app.js b/apps/web/src/app.js
index 438461a7d..9b236280e 100644
--- a/apps/web/src/app.js
+++ b/apps/web/src/app.js
@@ -12,6 +12,7 @@ import NavigationMenu from "./components/navigationmenu";
import NavigationContainer from "./navigation/container";
import RootNavigator from "./navigation/navigators/rootnavigator";
import EditorNavigator from "./navigation/navigators/editornavigator";
+import { isMobile } from "./utils/dimensions";
function App() {
const [show, setShow] = usePersistentState("isContainerVisible", true);
@@ -39,11 +40,12 @@ function App() {
}, [openLastSession]);
useEffect(() => {
+ if (!isMobile()) return;
EditorNavigator.onNavigate = (route) => {
setShow(!!!route);
};
- // eslint-disable-next-line react-hooks/exhaustive-deps
- },[]);
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, []);
return (
<ThemeProvider>
@@ -70,7 +72,10 @@ function App() {
variant="columnFill"
/>
</Animated.Flex>
- <Flex width={[show ? 0 : "100%", 0, "100%"]} className="EditorNavigator" />
+ <Flex
+ width={[show ? 0 : "100%", 0, "100%"]}
+ className="EditorNavigator"
+ />
</Flex>
<Box id="dialogContainer" />
<Box id="snackbarContainer" />
diff --git a/apps/web/src/components/editor/header.js b/apps/web/src/components/editor/header.js
index b592273e4..08d59073c 100644
--- a/apps/web/src/components/editor/header.js
+++ b/apps/web/src/components/editor/header.js
@@ -37,6 +37,7 @@ function Header() {
alignItems="center"
sx={{
paddingTop: [1, 2, 2],
+ paddingBottom: 0,
}}
>
<Icon.ChevronLeft
diff --git a/apps/web/src/navigation/index.js b/apps/web/src/navigation/index.js
index dfcba6128..1def974dd 100644
--- a/apps/web/src/navigation/index.js
+++ b/apps/web/src/navigation/index.js
@@ -3,9 +3,10 @@ import ReactDOM from "react-dom";
import Animated from "../components/animated";
import { AnimatePresence } from "framer-motion";
import { store as selectionStore } from "../stores/selection-store";
-import {store as appStore} from "../stores/app-store";
+import { store as appStore } from "../stores/app-store";
import Route from "./route";
import Config from "../utils/config";
+import { isMobile } from "../utils/dimensions";
class Navigator {
constructor(root, routes, options = {}) {
@@ -48,7 +49,7 @@ class Navigator {
navigate(routeName, params = {}, force = false) {
let route = this.getRoute(routeName);
-
+
this.onNavigate(route);
if (!force && (!route || this.lastRoute === route)) {
@@ -71,7 +72,7 @@ class Navigator {
}
// exit selection mode on navigate
selectionStore.toggleSelectionMode(false);
-
+
ReactDOM.render(
<AnimatePresence exitBeforeEnter={true}>
<Animated.Flex
@@ -96,7 +97,7 @@ class Navigator {
</AnimatePresence>,
root
);
- appStore.toggleSideMenu(false);
+ if (isMobile()) appStore.toggleSideMenu(false);
return true;
}
diff --git a/apps/web/src/stores/editor-store.js b/apps/web/src/stores/editor-store.js
index 47ead7dd4..b3eace400 100644
--- a/apps/web/src/stores/editor-store.js
+++ b/apps/web/src/stores/editor-store.js
@@ -37,13 +37,14 @@ class EditorStore extends BaseStore {
openLastSession = async () => {
// Do not reopen last session on mobile
- if(isMobile()) return;
-
+ if (isMobile()) return;
+
const id = localStorage.getItem("lastOpenedNote");
- if (!id) {
+ const note = db.notes.note(id);
+ if (!id || !note) {
return EditorNavigator.navigate("editor");
}
- await this.openSession(db.notes.note(id).data);
+ await this.openSession(note.data);
};
openSession = async (note) => {