Skip to content

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

feat: make Remove shortcut from navmenu work

thecodrr8a725627726a
diff --git a/apps/web/src/components/navigation-menu/index.js b/apps/web/src/components/navigation-menu/index.js
index 4a991c693..3b4b5a0f9 100644
--- a/apps/web/src/components/navigation-menu/index.js
+++ b/apps/web/src/components/navigation-menu/index.js
@@ -9,7 +9,7 @@ import Animated from "../animated";
import NavigationItem from "./navigation-item";
import { hashNavigate, navigate } from "../../navigation";
import { toTitleCase } from "../../utils/string";
-import { COLORS } from "../../common";
+import { COLORS, db } from "../../common";
import useMobile from "../../utils/use-mobile";
import useTablet from "../../utils/use-tablet";
import { useLocation } from "wouter";
@@ -55,6 +55,7 @@ function NavigationMenu(props) {
const colors = useAppStore((store) => store.colors);
const pins = useAppStore((store) => store.menuPins);
const isSideMenuOpen = useAppStore((store) => store.isSideMenuOpen);
+ const refreshMenuPins = useAppStore((store) => store.refreshMenuPins);
const toggleSideMenu = useAppStore((store) => store.toggleSideMenu);
const isSyncing = useUserStore((store) => store.isSyncing);
const isLoggedIn = useUserStore((store) => store.isLoggedIn);
@@ -134,21 +135,18 @@ function NavigationMenu(props) {
}}
/>
))}
- {colors.map(
- (color) =>
- color?.title?.length && (
- <NavigationItem
- key={color.title}
- title={toTitleCase(color.title)}
- icon={Icon.Circle}
- selected={location === `/colors/${color.id}`}
- color={COLORS[color.title]}
- onClick={() => {
- navigate(`/colors/${color.id}`);
- }}
- />
- )
- )}
+ {colors.map((color) => (
+ <NavigationItem
+ key={color.id}
+ title={toTitleCase(color.title)}
+ icon={Icon.Circle}
+ selected={location === `/colors/${color.id}`}
+ color={COLORS[color.title]}
+ onClick={() => {
+ navigate(`/colors/${color.id}`);
+ }}
+ />
+ ))}
<Flex
flexDirection="column"
sx={{ borderTop: "1px solid", borderTopColor: "border" }}
@@ -158,7 +156,15 @@ function NavigationMenu(props) {
key={pin.id}
title={pin.title}
menu={{
- items: [{ title: "Remove shortcut", onClick: () => {} }],
+ items: [
+ {
+ title: "Remove shortcut",
+ onClick: async () => {
+ await db.settings.unpin(pin.id);
+ refreshMenuPins();
+ },
+ },
+ ],
data: pin,
}}
icon={
diff --git a/apps/web/yarn.lock b/apps/web/yarn.lock
index d10185354..2d0af2ff8 100644
--- a/apps/web/yarn.lock
+++ b/apps/web/yarn.lock
@@ -9001,7 +9001,7 @@ normalize-url@^3.0.0, normalize-url@^3.0.1:
"notes-core@git+ssh://[email protected]:streetwriters/notesnook-core.git":
version "5.3.2"
- resolved "git+ssh://[email protected]:streetwriters/notesnook-core.git#3f0b64bbf6a7f0eba3c19fd46dfe4ed06709426c"
+ resolved "git+ssh://[email protected]:streetwriters/notesnook-core.git#43760ff162e45eda017097c009be3162a4c4e890"
dependencies:
fast-sort "^2.0.1"
fuzzysearch "^1.0.3"