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
show notebook > topic on note items
ammarahm-edfe03fab5ddc7
diff --git a/apps/mobile/src/components/NoteItem/index.js b/apps/mobile/src/components/NoteItem/index.jsindex 6ce5fdafa..5942d9eb6 100644--- a/apps/mobile/src/components/NoteItem/index.js+++ b/apps/mobile/src/components/NoteItem/index.js@@ -16,23 +16,17 @@ import {TimeSince} from '../Menu/TimeSince';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';-function navigateToNotebook(item) {- let notebook = item;- let routeName = 'Notebook';- let params = {- menu: false,- notebook: notebook,- title: notebook.title- };-+const navigateToTopic = topic => {+ let routeName = 'NotesPage';+ let params = {...topic, menu: false, get: 'topics'};let headerState = {- heading: notebook.title,- id: notebook.id,- type: notebook.type+ heading: topic.title,+ id: topic.id,+ type: topic.type};- eSendEvent(eOnNewTopicAdded, params);+ eSendEvent(refreshNotesPage, params);Navigation.navigate(routeName, params, headerState);-}+};function navigateToTag(item) {let tags = db.tags.all;@@ -84,6 +78,26 @@ const NoteItem = ({item, isTrash, tags}) => {const compactMode = settings.notesListMode === 'compact';const allTags = useTagStore(state => state.tags);+ function getNotebook() {+ if (isTrash || !item.notebooks) return [];+ let item_notebook = item.notebooks?.slice(0, 1)[0];++ notebook = db.notebooks.notebook(item_notebook.id);++ if (!notebook) return [];+ let topic = notebook.topics.topic(item_notebook.topics[0])?._topic;++ notebook = notebook.data;++ return [+ {+ title: `${notebook?.title} › ${topic?.title}`,+ notebook: notebook,+ topic: topic+ }+ ];+ }+return (<><View@@ -99,37 +113,30 @@ const NoteItem = ({item, isTrash, tags}) => {zIndex: 10,elevation: 10}}>- {!isTrash && item.notebooks- ? item.notebooks?.slice(0, 1)?.map(_item => {- let notebook = db.notebooks.notebook(_item.id);- notebook = notebook?.data;-- return notebook ? (- <Button- title={notebook.title}- key={_item}- height={20}- icon="book-outline"- type="grayBg"- fontSize={SIZE.xs + 1}- iconSize={SIZE.sm}- textStyle={{- marginRight: 0,- fontWeight: 'normal',- fontFamily: null- }}- style={{- borderRadius: 5,- marginRight: 5,- borderWidth: 0.5,- borderColor: colors.icon,- paddingHorizontal: 6- }}- onPress={() => navigateToNotebook(notebook)}- />- ) : null;- })- : null}+ {getNotebook().map(_item => (+ <Button+ title={_item.title}+ key={_item}+ height={20}+ icon="book-outline"+ type="grayBg"+ fontSize={SIZE.xs + 1}+ iconSize={SIZE.sm}+ textStyle={{+ marginRight: 0,+ fontWeight: 'normal',+ fontFamily: null+ }}+ style={{+ borderRadius: 5,+ marginRight: 5,+ borderWidth: 0.5,+ borderColor: colors.icon,+ paddingHorizontal: 6+ }}+ onPress={() => navigateToTopic(_item.topic)}+ />+ ))}{!isTrash && tags? tags.slice(0, 2)?.map(item => (<Button