Skip to content

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

feat:delete function in favorite

alihamuh69e26be0fb1c
diff --git a/apps/web/src/app.js b/apps/web/src/app.js
index 72d96d19e..e833eea2d 100644
--- a/apps/web/src/app.js
+++ b/apps/web/src/app.js
@@ -8,7 +8,7 @@ import theme from "./theme";
import { routes, navigate } from "./navigation";
import CheckBox from "./components/checkbox";
import * as Icon from "react-feather";
-import './App.css';
+import "./app.css";
const NavMenuItem = props => {
useEffect(() => {
@@ -18,7 +18,7 @@ const NavMenuItem = props => {
}, [props.item.key, props.selected]);
return (
<Button
- className='unselectable'
+ className="unselectable"
onClick={props.onSelected}
variant="nav"
sx={{
diff --git a/apps/web/src/views/Favorites.js b/apps/web/src/views/Favorites.js
index c344278bc..63719fe3e 100644
--- a/apps/web/src/views/Favorites.js
+++ b/apps/web/src/views/Favorites.js
@@ -16,7 +16,15 @@ const menuItems = item => [
},
{
title: "Delete",
- color: "red"
+ color: "red",
+ onClick: async () => {
+ item.type == "note"
+ ? db.deleteNotes([item])
+ : db.deleteNotebooks([item]).then(() => {
+ let itemType = item.type[0] + item.type.substring(1);
+ showSnack(itemType + " Deleted!", Icon.Trash);
+ });
+ }
}
];