Skip to content

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

fix: navigate out of empty color view

thecodrr5290a4911eff
diff --git a/apps/web/__e2e__/notebooks.issues.test.js b/apps/web/__e2e__/notebooks.issues.test.js
new file mode 100644
index 000000000..a2c9bd69b
--- /dev/null
+++ b/apps/web/__e2e__/notebooks.issues.test.js
@@ -0,0 +1,3 @@
+const { test } = require("@playwright/test");
+test.skip("TODO: pin 3 notebooks & make sure they can be unpinned");
+test.skip("TODO: pin 4 notebooks & make sure 4th pin shows an error");
diff --git a/apps/web/src/components/navigation-menu/navigation-item.js b/apps/web/src/components/navigation-menu/navigation-item.js
index 0073dceb8..68f806c87 100644
--- a/apps/web/src/components/navigation-menu/navigation-item.js
+++ b/apps/web/src/components/navigation-menu/navigation-item.js
@@ -43,7 +43,7 @@ function NavigationItem(props) {
>
<Icon
size={isTablet ? 18 : 15}
- color={props.selected ? "primary" : color || "icon"}
+ color={color || (props.selected ? "primary" : "icon")}
rotate={isLoading}
/>
{isNew && (
diff --git a/apps/web/src/views/notes.js b/apps/web/src/views/notes.js
index a281ecb63..2e67a4773 100644
--- a/apps/web/src/views/notes.js
+++ b/apps/web/src/views/notes.js
@@ -1,8 +1,8 @@
-import React from "react";
+import { useEffect } from "react";
import ListContainer from "../components/list-container";
import { useStore as useNotesStore } from "../stores/note-store";
import NotesPlaceholder from "../components/placeholders/notesplacholder";
-import { hashNavigate } from "../navigation";
+import { hashNavigate, navigate } from "../navigation";
import FavoritesPlaceholder from "../components/placeholders/favorites-placeholder";
import { groupArray } from "notes-core/utils/grouping";
import { db } from "../common/db";
@@ -11,6 +11,13 @@ function Notes() {
const context = useNotesStore((store) => store.context);
const refreshContext = useNotesStore((store) => store.refreshContext);
const type = context?.type === "favorite" ? "favorites" : "notes";
+
+ useEffect(() => {
+ if (!context || (context.type === "color" && context.notes.length <= 0)) {
+ navigate("/", true);
+ }
+ }, [context]);
+
if (!context) return null;
return (
<ListContainer