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
feat: add topic deletion
thecodrrcd5ee8e72493
diff --git a/apps/web/src/components/menu/index.js b/apps/web/src/components/menu/index.jsindex 6569b5d21..a0375124f 100644--- a/apps/web/src/components/menu/index.js+++ b/apps/web/src/components/menu/index.js@@ -33,7 +33,7 @@ function Menu(props) {</Text>{props.menuItems.map((item) =>- !item.visible && (+ (item.visible === undefined || item.visible === true) && (<Flexkey={item.title}onClick={(e) => {diff --git a/apps/web/src/components/note/index.js b/apps/web/src/components/note/index.jsindex 8bccfe942..26f5c00f8 100644--- a/apps/web/src/components/note/index.js+++ b/apps/web/src/components/note/index.js@@ -48,7 +48,7 @@ function menuItems(note, context) {onlyPro: true,},{- visible: context ? (context.type === "topic" ? true : false) : false,+ visible: context && context.type === "topic",title: "Remove",onClick: async () => {confirm(diff --git a/apps/web/src/components/topic/index.js b/apps/web/src/components/topic/index.jsindex dfbeadba5..b5f14fdae 100644--- a/apps/web/src/components/topic/index.js+++ b/apps/web/src/components/topic/index.js@@ -1,6 +1,10 @@import React from "react";import ListItem from "../list-item";import { showEditTopicDialog } from "../dialogs/topicdialog";+import { confirm } from "../dialogs/confirm";+import * as Icon from "../icons";+import { db } from "../../common";+import { store } from "../../stores/notebook-store";const menuItems = (item) => [{@@ -8,11 +12,24 @@ const menuItems = (item) => [onClick: () => {showEditTopicDialog(item);},- visible: item.title === "General",+ visible: item.title !== "General",},{title: "Delete",+ visible: item.title !== "General",color: "red",+ onClick: () => {+ confirm(+ Icon.Trash,+ "Delete Topic",+ "Are you sure you want to delete this topic?"+ ).then(async (res) => {+ if (res) {+ await db.notebooks.notebook(item.notebookId).topics.delete(item.id);+ store.setSelectedNotebookTopics(item.notebookId);+ }+ });+ },},];