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: remove favorites (shift to context)
thecodrr4ca4d3db18d8
diff --git a/apps/web/src/stores/note-store.js b/apps/web/src/stores/note-store.jsindex 13095ccd3..6ef6d470e 100644--- a/apps/web/src/stores/note-store.js+++ b/apps/web/src/stores/note-store.js@@ -15,7 +15,6 @@ function noteStore(set, get) {groupCounts: [],groups: []},- favorites: [],selectedNotes: [],selectedContext: {},selectedNote: 0,@@ -30,13 +29,7 @@ function noteStore(set, get) {state.notes = db.notes.group(undefined, true);});},- refreshList: function(listType) {- set(state => {- state[listType] = db.notes[listType];- });- },setSelectedContext: function(context) {- console.log("setting context");let notes = [];switch (context.type) {case "tag":@@ -50,6 +43,9 @@ function noteStore(set, get) {.notebook(context.notebook.id).topics.topic(context.value).all;break;+ case "favorites":+ notes = db.notes.favorites;+ break;default:return;}@@ -84,7 +80,6 @@ function noteStore(set, get) {favorite: async function(note) {await db.notes.note(note).favorite();setValue(set, note.id, "favorite", !note.favorite);- get().refreshList(LIST_TYPES.fav);},unlock: function(noteId) {showPasswordDialog("unlock_note", password => {diff --git a/apps/web/src/views/Favorites.js b/apps/web/src/views/Favorites.jsdeleted file mode 100644index 15e70ef83..000000000--- a/apps/web/src/views/Favorites.js+++ /dev/null@@ -1,33 +0,0 @@-import React, { useEffect } from "react";-import ListView from "../components/listview";-import { useStore, store, LIST_TYPES } from "../stores/note-store";-import { useStore as useEditorStore } from "../stores/editor-store";-import FavoritesPlaceholder from "../components/placeholders/favorites-placeholder";-const dropdownRefs = [];-const menuItems = item => [- {- title: "Unfavorite",- onClick: () => store.getState().favorite(item)- }-];--function Favorites() {- useEffect(() => store.getState().refreshList(LIST_TYPES.fav), []);- const items = useStore(store => store.favorites);- const openSession = useEditorStore(store => store.openSession);- return (- <ListView- type="Favorites"- placeholder={FavoritesPlaceholder}- items={items}- menu={{ menuItems, dropdownRefs }}- noType- button={undefined}- onClick={async item => {- await openSession(item);- }}- />- );-}--export default Favorites;