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: do not allow more than 3 notes/notebooks
thecodrr114b86a988fd
diff --git a/apps/web/src/components/note/index.js b/apps/web/src/components/note/index.jsindex c38842478..167897948 100644--- a/apps/web/src/components/note/index.js+++ b/apps/web/src/components/note/index.js@@ -33,7 +33,9 @@ function menuItems(note, context) {},{title: note.pinned ? "Unpin" : "Pin",- onClick: pin.bind(this, note),+ onClick: async () => {+ await pin(note);+ },onlyPro: true,},{diff --git a/apps/web/src/stores/note-store.js b/apps/web/src/stores/note-store.jsindex 0b4bbab38..3eb8a4981 100644--- a/apps/web/src/stores/note-store.js+++ b/apps/web/src/stores/note-store.js@@ -6,6 +6,7 @@ import Vault from "../common/vault";import BaseStore from ".";import { EV } from "notes-core/common";import Config from "../utils/config";+import { showToast } from "../utils/toast";class NoteStore extends BaseStore {notes = [];@@ -66,6 +67,11 @@ class NoteStore extends BaseStore {};pin = async (id) => {+ // TODO (hack) we probably shouldn't do this here.+ if (db.notes.pinned.length >= 3) {+ await showToast("error", "You cannot pin more than 3 notes.");+ return;+ }const note = db.notes.note(id);if (!this._syncEditor(note.id, "pinned", !note.data.pinned)) {await note.pin();diff --git a/apps/web/src/stores/notebook-store.js b/apps/web/src/stores/notebook-store.jsindex 3c886d409..d120a2858 100644--- a/apps/web/src/stores/notebook-store.js+++ b/apps/web/src/stores/notebook-store.js@@ -2,6 +2,7 @@ import { db } from "../common/index";import createStore from "../common/store";import { store as trashStore } from "./trash-store";import BaseStore from "./index";+import { showToast } from "../utils/toast";class NotebookStore extends BaseStore {notebooks = [];@@ -27,6 +28,10 @@ class NotebookStore extends BaseStore {};pin = async (notebookId) => {+ // TODO (hack) We probably shouldn't do this here.+ if (db.notebooks.pinned.length >= 3) {+ return await showToast("error", "You cannot pin more than 3 notebooks.");+ }await db.notebooks.notebook(notebookId).pin();this.refresh();};