Skip to content

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

feat: remove notebook favorite logic (#17)

Muhammad Alibe46cb81f425
diff --git a/apps/web/src/components/notebook/index.js b/apps/web/src/components/notebook/index.js
index 84a4aafeb..a784a6580 100644
--- a/apps/web/src/components/notebook/index.js
+++ b/apps/web/src/components/notebook/index.js
@@ -18,17 +18,6 @@ const menuItems = notebook => [
ev.emit("refreshNotebooks");
})
},
- {
- title: notebook.favorite ? "Unfavorite" : "Favorite",
- onClick: async () =>
- db.notebooks
- .notebook(notebook.id)
- .favorite()
- .then(() => {
- showSnack("Notebook favorited!", Icon.Check);
- ev.emit("refreshNotebooks");
- })
- },
{ title: "Edit" },
{ title: "Share" },
{
diff --git a/apps/web/src/views/Favorites.js b/apps/web/src/views/Favorites.js
index d5422dadd..7bbbf84de 100644
--- a/apps/web/src/views/Favorites.js
+++ b/apps/web/src/views/Favorites.js
@@ -15,10 +15,8 @@ const menuItems = item => [
"Are you sure you want to remove this item from favorites?"
).then(res => {
if (res) {
- (item.type === "note"
- ? db.notes.note(item.id)
- : db.notebooks.notebook(item.id)
- )
+ db.notes
+ .note(item.id)
.favorite()
.then(() => {
let itemType = item.type[0] + item.type.substring(1);
@@ -40,12 +38,10 @@ const menuItems = item => [
).then(res => {
if (res) {
let itemType = item.type[0] + item.type.substring(1);
- (itemType === "note" ? db.notes : db.notebooks)
- .delete(item.id)
- .then(() => {
- showSnack(itemType + " Deleted!", Icon.Trash);
- ev.emit(`refreshFavorites`);
- });
+ db.notes.delete(item.id).then(() => {
+ showSnack(itemType + " Deleted!", Icon.Trash);
+ ev.emit(`refreshFavorites`);
+ });
}
});
}