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 tag & color titles
ammarahm-edeca9b9273eec
diff --git a/apps/mobile/src/components/Menu/ColorSection.js b/apps/mobile/src/components/Menu/ColorSection.jsindex bce3d11bb..9ebc69b94 100644--- a/apps/mobile/src/components/Menu/ColorSection.js+++ b/apps/mobile/src/components/Menu/ColorSection.js@@ -38,6 +38,7 @@ const ColorItem = ({item, index}) => {const {colors} = state;const setColorNotes = useMenuStore(state => state.setColorNotes);const [headerTextState, setHeaderTextState] = useState(null);+ const alias = db.colors.alias(item.title);const onHeaderStateChange = event => {if (event?.id === item.id) {@@ -62,7 +63,7 @@ const ColorItem = ({item, index}) => {get: 'colored'};Navigation.navigate('NotesPage', params, {- heading: item.title.slice(0, 1).toUpperCase() + item.title.slice(1),+ heading: alias.slice(0, 1).toUpperCase() + alias.slice(1),id: item.id,type: 'color'});@@ -75,7 +76,7 @@ const ColorItem = ({item, index}) => {title: 'Rename color',input: true,inputPlaceholder: 'Enter name for this color',- defaultValue: db.settings.getAlias(item.id) || item.title,+ defaultValue: alias,paragraph: 'You are renaming the color ' + item.title,positivePress: async value => {if (!value || value.trim().length === 0) return;@@ -132,13 +133,11 @@ const ColorItem = ({item, index}) => {</View>{headerTextState?.id === item.id ? (<Heading color={colors.heading} size={SIZE.md}>- {db.settings.getAlias(item.id) ||- item.title.slice(0, 1).toUpperCase() + item.title.slice(1)}+ {alias.slice(0, 1).toUpperCase() + alias.slice(1)}</Heading>) : (<Paragraph color={colors.pri} size={SIZE.md}>- {db.settings.getAlias(item.id) ||- item.title.slice(0, 1).toUpperCase() + item.title.slice(1)}+ {alias.slice(0, 1).toUpperCase() + alias.slice(1)}</Paragraph>)}</View>diff --git a/apps/mobile/src/components/Menu/TagsSection.js b/apps/mobile/src/components/Menu/TagsSection.jsindex 0806d1740..db31b7c89 100644--- a/apps/mobile/src/components/Menu/TagsSection.js+++ b/apps/mobile/src/components/Menu/TagsSection.js@@ -1,22 +1,20 @@-import React, {useEffect, useRef, useState} from 'react';-import {FlatList, View} from 'react-native';+import React, { useEffect, useRef, useState } from 'react';+import { FlatList, View } from 'react-native';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {useTracked} from '../../provider';-import {Actions} from '../../provider/Actions';-import {useMenuStore, useNoteStore} from '../../provider/stores';+import { useTracked } from '../../provider';+import { useMenuStore, useNoteStore } from '../../provider/stores';import {eSendEvent,eSubscribeEvent,- eUnSubscribeEvent,+ eUnSubscribeEvent} from '../../services/EventManager';import Navigation from '../../services/Navigation';-import {getElevation} from '../../utils';-import {db} from '../../utils/DB';-import {eOnNewTopicAdded, refreshNotesPage} from '../../utils/Events';-import {normalize, SIZE} from '../../utils/SizeUtils';+import { db } from '../../utils/DB';+import { eOnNewTopicAdded, refreshNotesPage } from '../../utils/Events';+import { normalize, SIZE } from '../../utils/SizeUtils';import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';-import {Button} from '../Button';-import {PressableButton} from '../PressableButton';+import { Button } from '../Button';+import { PressableButton } from '../PressableButton';import Seperator from '../Seperator';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';@@ -38,13 +36,13 @@ export const TagsSection = () => {params = {notebook: item,title: item.title,- menu: true,+ menu: true};Navigation.navigate('Notebook', params, {heading: item.title,id: item.id,- type: item.type,+ type: item.type});eSendEvent(eOnNewTopicAdded, params);} else if (item.type === 'tag') {@@ -52,12 +50,12 @@ export const TagsSection = () => {...item,type: 'tag',menu: true,- get: 'tagged',+ get: 'tagged'};Navigation.navigate('NotesPage', params, {- heading: '#' + item.title,+ heading: '#' + db.tags.alias(item.title),id: item.id,- type: item.type,+ type: item.type});eSendEvent(refreshNotesPage, params);} else {@@ -65,7 +63,7 @@ export const TagsSection = () => {Navigation.navigate('NotesPage', params, {heading: item.title,id: item.id,- type: item.type,+ type: item.type});eSendEvent(refreshNotesPage, params);}@@ -75,15 +73,15 @@ export const TagsSection = () => {return (<Viewstyle={{- flexGrow: 1,+ flexGrow: 1}}><FlatListdata={menuPins}style={{- flexGrow: 1,+ flexGrow: 1}}contentContainerStyle={{- flexGrow: 1,+ flexGrow: 1}}keyExtractor={(item, index) => item.id}renderItem={({item, index}) => (@@ -97,13 +95,13 @@ export const TagsSection = () => {const PinItem = ({item, index, onPress}) => {const [state, dispatch] = useTracked();const {colors} = state;-const setMenuPins = useMenuStore(state => state.setMenuPins);-+ const alias = item.type === 'tag' ? db.tags.alias(item.title) : item.title;const [visible, setVisible] = useState(false);const [headerTextState, setHeaderTextState] = useState(null);const color = headerTextState?.id === item.id ? colors.accent : colors.pri;const fwdRef = useRef();+const onHeaderStateChange = event => {if (event?.id === item.id) {setHeaderTextState(event);@@ -122,7 +120,7 @@ const PinItem = ({item, index, onPress}) => {const icons = {topic: 'book-open-outline',notebook: 'book-outline',- tag: 'pound',+ tag: 'pound'};return (@@ -148,7 +146,7 @@ const PinItem = ({item, index, onPress}) => {width="95%"height={50}customStyle={{- marginBottom: 30,+ marginBottom: 30}}/></ActionSheetWrapper>@@ -169,26 +167,26 @@ const PinItem = ({item, index, onPress}) => {justifyContent: 'space-between',alignItems: 'center',height: normalize(50),- marginBottom: 5,+ marginBottom: 5}}><Viewstyle={{flexDirection: 'row',alignItems: 'center',flexGrow: 1,- flex: 1,+ flex: 1}}><Viewstyle={{width: 30,- justifyContent: 'center',+ justifyContent: 'center'}}><Icon color={color} size={SIZE.lg - 2} name={icons[item.type]} /><Iconstyle={{position: 'absolute',bottom: -6,- left: -6,+ left: -6}}color={color}size={SIZE.xs}@@ -199,20 +197,20 @@ const PinItem = ({item, index, onPress}) => {style={{alignItems: 'flex-start',flexGrow: 1,- flex: 1,+ flex: 1}}>{headerTextState?.id === item.id ? (<Headingstyle={{- flexWrap: 'wrap',+ flexWrap: 'wrap'}}color={colors.heading}size={SIZE.md}>- {item.title}+ {alias}</Heading>) : (<Paragraph numberOfLines={1} color={colors.pri} size={SIZE.md}>- {item.title}+ {alias}</Paragraph>)}</View>diff --git a/apps/mobile/src/components/NoteItem/index.js b/apps/mobile/src/components/NoteItem/index.jsindex 0a743ecf6..f99462ae6 100644--- a/apps/mobile/src/components/NoteItem/index.js+++ b/apps/mobile/src/components/NoteItem/index.js@@ -124,7 +124,7 @@ const NoteItem = ({item, isTrash, tags}) => {{!isTrash && tags ?tags.slice(0, 2)?.map(item => (<Button- title={'#' + item}+ title={'#' + db.tags.alias(item)}key={item}height={20}textStyle={{diff --git a/apps/mobile/src/views/Notes/index.js b/apps/mobile/src/views/Notes/index.jsindex 4e3a1bd08..3a6c35479 100644--- a/apps/mobile/src/views/Notes/index.js+++ b/apps/mobile/src/views/Notes/index.js@@ -32,10 +32,11 @@ export const Notes = ({route, navigation}) => {const colors = state.colors;const [notes, setNotes] = useState([]);const loading = useNoteStore(state => state.loading);-let params = route.params ? route.params : null;+ const alias = param.type === "tag" ? db.tags.alias(params.title) : db.colors.alias(params.title)let ranAfterInteractions = false;+const runAfterInteractions = (time = 300) => {InteractionManager.runAfterInteractions(() => {Navigation.routeNeedsUpdate('NotesPage', () => {@@ -99,8 +100,8 @@ export const Notes = ({route, navigation}) => {Navigation.setHeaderState('NotesPage', params, {heading:params.type === 'tag'- ? '#' + params.title- : db.settings.getAlias(params.id) || params.title.slice(0, 1).toUpperCase() + params.title.slice(1),+ ? '#' + alias+ : alias.slice(0, 1).toUpperCase() + alias.slice(1),id: params.id,type: params.type});@@ -111,8 +112,8 @@ export const Notes = ({route, navigation}) => {eSendEvent(eScrollEvent, {name:params.type === 'tag'- ? '#' + params.title- : params.title.slice(0, 1).toUpperCase() + params.title.slice(1),+ ? '#' + alias+ : alias.slice(0, 1).toUpperCase() + alias.slice(1),type: 'in'});};@@ -131,8 +132,8 @@ export const Notes = ({route, navigation}) => {eSendEvent(eScrollEvent, {name:params.type === 'tag'- ? '#' + params.title- : params.title.slice(0, 1).toUpperCase() + params.title.slice(1),+ ? '#' + alias+ : alias.slice(0, 1).toUpperCase() + alias.slice(1),type: 'hide'});editing.actionAfterFirstSave = {@@ -152,7 +153,7 @@ export const Notes = ({route, navigation}) => {const updateSearch = () => {SearchService.update({placeholder: `Search in ${- params.type === 'tag' ? '#' + params.title : params.title+ params.type === 'tag' ? '#' + alias : alias}`,data: notes,noSearch: false,@@ -186,8 +187,8 @@ export const Notes = ({route, navigation}) => {const headerProps = {heading:params.type === 'tag'- ? '#' + params.title- : db.settings.getAlias(params.id) || params.title.slice(0, 1).toUpperCase() + params.title.slice(1),+ ? '#' + alias+ : alias.slice(0, 1).toUpperCase() + alias.slice(1),color: params.type === 'color' ? params.title.toLowerCase() : null,paragraph: route.params.type === 'topic' ? 'Edit topic' : null,onPress: () => {@@ -250,7 +251,7 @@ export const Notes = ({route, navigation}) => {/><ContainerTopSection><Header- title={db.settings.getAlias(params.id) || headerProps.heading}+ title={headerProps.heading}isBack={!params.menu}screen="NotesPage"action={_onPressBottomButton}