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: show topic on note & move tags to bottom
thecodrr0b805caeb19f
diff --git a/apps/web/src/common/list-profiles.js b/apps/web/src/common/list-profiles.jsindex 6d764b1c3..6f636702a 100644--- a/apps/web/src/common/list-profiles.js+++ b/apps/web/src/common/list-profiles.js@@ -22,10 +22,15 @@ const NotesProfile = createProfile(// TODO doing all this here could be a potential performance issue.let tags = item.tags;- let notebook = item.notebooks && item.notebooks[0];- if (tags) tags = tags.map((t) => db.tags.tag(t)).slice(0, 2);- if (notebook) {- notebook = db.notebooks.notebook(notebook.id)?.data;+ if (tags) tags = tags.map((t) => db.tags.tag(t)).slice(0, 3);+ if (context?.type !== "topic" && item.notebooks?.length) {+ const noteNotebook = item.notebooks[0];+ const _notebook = db.notebooks.notebook(noteNotebook.id);+ var notebook = _notebook?.data;++ const topicId = noteNotebook.topics[0];+ const topic = _notebook?.topics.topic(topicId);+ notebook.topic = topic?._topic;}return (diff --git a/apps/web/src/components/icon-tag/index.js b/apps/web/src/components/icon-tag/index.jsindex a37f74c81..7189c43b7 100644--- a/apps/web/src/components/icon-tag/index.js+++ b/apps/web/src/components/icon-tag/index.js@@ -21,7 +21,7 @@ function IconTag({ text, title, icon: Icon, onClick, styles, testId }) {bg: "hover",filter: "brightness(95%)",},- maxWidth: 150,+ maxWidth: "100%",px: 1,mr: 1,cursor: onClick ? "pointer" : "default",diff --git a/apps/web/src/components/note/index.js b/apps/web/src/components/note/index.jsindex ce9893ccd..0900c9819 100644--- a/apps/web/src/components/note/index.js+++ b/apps/web/src/components/note/index.js@@ -1,5 +1,5 @@import React, { useMemo } from "react";-import { Flex, Text } from "rebass";+import { Button, Flex } from "rebass";import * as Icon from "../icons";import TimeAgo from "../time-ago";import ListItem from "../list-item";@@ -59,31 +59,21 @@ function Note(props) {}}}header={- (tags?.length || notebook) && (- <Flex alignSelf="flex-start" justifySelf="flex-start" mb={1}>- {notebook && (- <IconTag- onClick={() => {- navigate(`/notebooks/${notebook.id}/`);- }}- text={notebook.title}- icon={Icon.Notebook}- />- )}- {tags.map((tag) => {- return (- <IconTag- key={tag.id}- text={tag.alias}- icon={Icon.Tag}- onClick={() => {- if (!tag.id) return showToast("Tag not found.");- navigate(`/tags/${tag.id}`);- }}- />- );- })}- </Flex>+ notebook && (+ <IconTag+ styles={{+ container: {+ alignSelf: "flex-start",+ justifySelf: "flex-start",+ mb: 1,+ },+ }}+ onClick={() => {+ navigate(`/notebooks/${notebook.id}/${notebook.topic.id}`);+ }}+ text={`${notebook.title} › ${notebook.topic.title}`}+ icon={Icon.Notebook}+ />)}footer={@@ -116,22 +106,21 @@ function Note(props) {) : (<>{note.conflicted && (- <Text- display="flex"- mr={1}- fontSize="subBody"- color="error"- fontWeight="bold"- sx={{ borderRadius: "default" }}- >- <Icon.Alert size={15} color="error" sx={{ mr: "2px" }} />{" "}- Conflicted- </Text>+ <Icon.Alert size={15} color="error" sx={{ mr: 1 }} />)}- <TimeAgo live={false} datetime={note.dateCreated} mr={1} />++ <TimeAgo+ sx={{ flexShrink: 0 }}+ locale="en_short"+ live={false}+ datetime={note.dateCreated}+ mr={1}+ />+{note.pinned && !props.context && (<Icon.Pin size={13} color={primary} sx={{ mr: 1 }} />)}+{note.locked && (<Icon.Locksize={13}@@ -140,9 +129,34 @@ function Note(props) {data-test-id={`note-${index}-locked`}/>)}+{note.favorite && (<Icon.Star color={primary} size={15} sx={{ mr: 1 }} />)}++ {tags?.map((tag) => {+ return (+ <Button+ key={tag.id}+ variant="anchor"+ mr={1}+ color="fontTertiary"+ title={`Go to #${tag.alias}`}+ onClick={(e) => {+ e.stopPropagation();+ if (!tag.id) return showToast("Tag not found.");+ navigate(`/tags/${tag.id}`);+ }}+ sx={{+ maxWidth: `calc(100% / ${tags.length})`,+ overflow: "hidden",+ textOverflow: "ellipsis",+ }}+ >+ #{tag.alias}+ </Button>+ );+ })}</>)}</Flex>