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
fix: show error toast if notebook title is empty (#195)
Muhammad Ali3a685d0d1cdd
diff --git a/apps/web/src/components/dialogs/add-notebook-dialog.js b/apps/web/src/components/dialogs/add-notebook-dialog.jsindex 9d0666735..475163784 100644--- a/apps/web/src/components/dialogs/add-notebook-dialog.js+++ b/apps/web/src/components/dialogs/add-notebook-dialog.js@@ -4,6 +4,7 @@ import * as Icon from "../icons";import Dialog from "./dialog";import { qclone } from "qclone";import Field from "../field";+import { showToast } from "../../utils/toast";class AddNotebookDialog extends React.Component {title = "";@@ -84,18 +85,19 @@ class AddNotebookDialog extends React.Component {}createNotebook() {- this.props.onDone(- {- title: this.title,- description: this.description,- topics: this.state.topics.map((topic) => {- if (topic.id) return topic;- return topic.title;- }),- id: this.id,- },- this.deletedTopics- );+ if (!this.title.trim())+ return showToast("error", "Notebook title cannot be empty.");++ const notebook = {+ title: this.title,+ description: this.description,+ topics: this.state.topics.map((topic) => {+ if (topic.id) return topic;+ return topic.title;+ }),+ id: this.id,+ };+ this.props.onDone(notebook, this.deletedTopics);}render() {