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: minor fixes to tags & colors
thecodrrc604bf9a3d1d
diff --git a/apps/web/src/components/note/index.js b/apps/web/src/components/note/index.jsindex f5d88ff95..227fa2ac8 100644--- a/apps/web/src/components/note/index.js+++ b/apps/web/src/components/note/index.js@@ -17,7 +17,7 @@ import Vault from "../../common/vault";import IconTag from "../icon-tag";function Note(props) {- const { item, index, context } = props;+ const { tags, item, index, context } = props;const note = item;const selectedNote = useStore((store) => store.selectedNote);const viewMode = useStore((store) => store.viewMode);@@ -64,7 +64,7 @@ function Note(props) {}}}header={- (note.tags?.length || notebook) && (+ (tags?.length || notebook) && (<Flex alignSelf="flex-start" justifySelf="flex-start" mb={1}>{notebook && (<IconTag@@ -75,7 +75,7 @@ function Note(props) {icon={Icon.Notebook}/>)}- {note.tags?.slice(0, 2).map((tag) => {+ {tags?.slice(0, 2).map((tag) => {const tagItem = db.tags.tag(tag);if (!tagItem) return null;return (@@ -150,8 +150,9 @@ export default React.memo(Note, function (prevProps, nextProps) {prevItem.locked === nextItem.locked &&prevItem.conflicted === nextItem.conflicted &&prevItem.color === nextItem.color &&- prevProps.notebooks?.length === nextProps.notebooks?.length &&- prevProps.tags.length === nextProps.tags.length+ JSON.stringify(prevProps.notebooks) ===+ JSON.stringify(nextProps.notebooks) &&+ JSON.stringify(prevProps.tags) === JSON.stringify(nextProps.tags));});diff --git a/apps/web/src/components/tag/index.js b/apps/web/src/components/tag/index.jsindex 5a16bfa3a..d38fb549b 100644--- a/apps/web/src/components/tag/index.js+++ b/apps/web/src/components/tag/index.js@@ -3,12 +3,15 @@ import ListItem from "../list-item";import { hashNavigate, navigate } from "../../navigation";import { Text } from "rebass";import { store as appStore } from "../../stores/app-store";+import { store as tagStore } from "../../stores/tag-store";+import { store as editorStore } from "../../stores/editor-store";import { db } from "../../common/db";import * as Icon from "../icons";+import { showToast } from "../../utils/toast";const menuItems = [{- title: () => "Edit",+ title: () => "Rename tag",icon: Icon.Edit,onClick: ({ tag }) => {hashNavigate(`/tags/${tag.id}/edit`);@@ -20,16 +23,29 @@ const menuItems = [icon: Icon.Shortcut,onClick: ({ tag }) => appStore.pinItemToMenu(tag),},+ {+ color: "error",+ title: () => "Delete",+ icon: Icon.DeleteForver,+ onClick: async ({ tag }) => {+ if (tag.noteIds.includes(editorStore.get().session.id))+ editorStore.clearSession();++ await db.tags.remove(tag.id);+ showToast("success", "Tag deleted!");+ tagStore.refresh();+ },+ },];function Tag({ item, index }) {- const { id, title, alias, noteIds } = item;+ const { id, noteIds } = item;return (<ListItemitem={item}selectable={false}index={index}- title={<TagNode title={alias || title} />}+ title={<TagNode title={db.tags.alias(id)} />}footer={<Text mt={1} variant="subBody">{noteIds.length} notesdiff --git a/apps/web/src/navigation/routes.js b/apps/web/src/navigation/routes.jsindex dc9308cee..253c85619 100644--- a/apps/web/src/navigation/routes.js+++ b/apps/web/src/navigation/routes.js@@ -120,8 +120,9 @@ const routes = {"/tags/:tagId": ({ tagId }) => {const tag = db.tags.tag(tagId);if (!tag) return false;- const { title, id } = tag;+ const { id } = tag;notestore.setContext({ type: "tag", value: id });+ const title = db.tags.alias(id);return {key: "notes",type: "notes",@@ -141,7 +142,8 @@ const routes = {"/colors/:colorId": ({ colorId }) => {const color = db.colors.tag(colorId);if (!color) return navigate("/");- const { title, id } = color;+ const { id } = color;+ const title = db.colors.alias(id);notestore.setContext({ type: "color", value: id });return {key: "notes",