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
add support for tag delete & rename
ammarahm-ed1eea0c32405a
diff --git a/apps/mobile/src/components/ActionSheetComponent/index.js b/apps/mobile/src/components/ActionSheetComponent/index.jsindex b8454e807..92f15f253 100644--- a/apps/mobile/src/components/ActionSheetComponent/index.js+++ b/apps/mobile/src/components/ActionSheetComponent/index.js@@ -43,7 +43,7 @@ import {SIZE} from '../../utils/SizeUtils';import {sleep, timeConverter} from '../../utils/TimeUtils';import {Button} from '../Button';import {presentDialog} from '../Dialog/functions';-import { PressableButton } from '../PressableButton';+import {PressableButton} from '../PressableButton';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';import {ActionSheetColorsSection} from './ActionSheetColorsSection';@@ -165,7 +165,7 @@ export const ActionSheetComponent = ({},{name: 'Pin',- title: note.pinned ? 'Unpin from top' : 'Pin to top',+ title: note.pinned ? 'Unpin' : 'Pin to top',icon: note.pinned ? 'pin-off-outline' : 'pin-outline',func: async () => {if (!note.id) return;@@ -201,7 +201,7 @@ export const ActionSheetComponent = ({},{name: 'Favorite',- title: !note.favorite ? 'Add to favorites' : 'Remove from favorites',+ title: !note.favorite ? 'Favorite' : 'Unfavorite',icon: note.favorite ? 'star-off' : 'star-outline',func: async () => {if (!note.id) return;@@ -404,6 +404,31 @@ export const ActionSheetComponent = ({nopremium: true,id: notesnook.ids.dialogs.actionsheet.pinMenu,},+ {+ name: 'Edit Tag',+ title: 'Edit tag',+ icon: 'square-edit-outline',+ func: async () => {+ close();+ await sleep(300);+ presentDialog({+ title: 'Edit tag',+ paragraph: 'Change the title of the tag',+ positivePress: async value => {+ await db.tags.rename(note.id,value);+ Navigation.setRoutesToUpdate([+ Navigation.routeNames.Notes,+ Navigation.routeNames.NotesPage,+ Navigation.routeNames.Tags+ ]);+ },+ input: true,+ defaultValue: note.title,+ inputPlaceholder: 'Enter tag title',+ positiveText: 'Save',+ });+ },+ },{name: 'Share',title: 'Share',@@ -468,6 +493,24 @@ export const ActionSheetComponent = ({type: 'error',func: async () => {close();+ if (note.type === 'tag') {+ await sleep(300);+ presentDialog({+ title: 'Delete tag',+ paragraph: 'This tag will be removed from all notes.',+ positivePress: async value => {+ await db.tags.remove(note.id);+ Navigation.setRoutesToUpdate([+ Navigation.routeNames.Notes,+ Navigation.routeNames.NotesPage,+ Navigation.routeNames.Tags+ ]);+ },+ positiveText: 'Delete',+ positiveType: 'errorShade',+ });+ return;+ }if (note.locked) {await sleep(300);openVault({@@ -513,7 +556,7 @@ export const ActionSheetComponent = ({},];- let columnsCount = rowItems.length < 5 ? rowItems.length : 5;+ let columnItemWidth = DDS.isTab ? (400 - 24) / rowItems.length : (w - 24) / 5;const _renderRowItem = rowItem => (<ViewonPress={rowItem.func}@@ -521,17 +564,15 @@ export const ActionSheetComponent = ({testID={'icon-' + rowItem.name}style={{alignItems: 'center',- width: DDS.isTab- ? (400 - 24) / rowItems.length- : (w - 24) / columnsCount,- marginBottom: 5,+ width: columnItemWidth,+ marginBottom: 10,}}><PressableButtononPress={rowItem.func}- type="grayBg"+ type={rowItem.on ? 'accent' : 'grayBg'}customStyle={{- height: (w - 24) / columnsCount - 12,- width: (w - 24) / columnsCount - 12,+ height: columnItemWidth - 12,+ width: columnItemWidth - 12,borderRadius: 5,justifyContent: 'center',alignItems: 'center',@@ -542,13 +583,17 @@ export const ActionSheetComponent = ({<Iconname={rowItem.icon}size={DDS.isTab ? SIZE.xl : SIZE.lg}- color={rowItem.name === 'Delete' ? colors.errorText : colors.accent}+ color={+ rowItem.on+ ? colors.light+ : rowItem.name === 'Delete' || rowItem.name === 'PermDelete'+ ? colors.errorText+ : colors.icon+ }/></PressableButton>- <Paragraph size={SIZE.sm} style={{textAlign: 'center'}}>- {rowItem.title}- </Paragraph>+ <Paragraph style={{textAlign: 'center'}}>{rowItem.title}</Paragraph></View>);@@ -779,10 +824,11 @@ export const ActionSheetComponent = ({paddingTop: 20,}}columnWrapperStyle={{- justifyContent: 'flex-start',+ justifyContent: rowItems.length < 5 ? 'space-around' : 'flex-start',}}contentContainerStyle={{alignSelf: 'center',+ width: rowItems.length < 5 ? '100%' : null,}}renderItem={({item, index}) => _renderRowItem(item)}/>diff --git a/apps/mobile/src/components/TagItem/index.js b/apps/mobile/src/components/TagItem/index.jsindex 641592659..601317a98 100644--- a/apps/mobile/src/components/TagItem/index.js+++ b/apps/mobile/src/components/TagItem/index.js@@ -1,6 +1,6 @@import React from 'react';import {useWindowDimensions, View} from 'react-native';-import { notesnook } from '../../../e2e/test.ids';+import {notesnook} from '../../../e2e/test.ids';import {PressableButton} from '../../components/PressableButton';import {useTracked} from '../../provider';import Navigation from '../../services/Navigation';@@ -20,7 +20,7 @@ const TagItem = ({item, index}) => {{...item,type: 'tag',- get:'tagged'+ get: 'tagged',},{heading: '#' + item.title,@@ -39,7 +39,7 @@ const TagItem = ({item, index}) => {opacity={1}customStyle={{paddingHorizontal: 12,- height: 80 * fontScale,+ height: 80 * fontScale,flexDirection: 'row',alignItems: 'center',borderBottomWidth: 1.5,@@ -48,10 +48,9 @@ const TagItem = ({item, index}) => {justifyContent: 'space-between',}}><View- style={{- maxWidth:"92%"- }}- >+ style={{+ maxWidth: '92%',+ }}><Heading size={SIZE.md}><Headingsize={SIZE.md}@@ -81,7 +80,7 @@ const TagItem = ({item, index}) => {name="dots-horizontal"size={SIZE.xl}onPress={() => {- let rowItems = ['Add Shortcut to Menu', 'Remove Shortcut from Menu'];+ let rowItems = ['Add Shortcut', 'Delete', 'Edit Tag'];ActionSheetEvent(item, false, false, rowItems);}}testID={notesnook.ids.tag.menu}diff --git a/apps/mobile/src/components/TagsDialog/index.js b/apps/mobile/src/components/TagsDialog/index.jsindex 8f9cf851d..80f1bfc56 100644--- a/apps/mobile/src/components/TagsDialog/index.js+++ b/apps/mobile/src/components/TagsDialog/index.js@@ -156,7 +156,7 @@ const TagsDialog = () => {overScrollMode="never"scrollToOverflowEnabled={false}keyboardDismissMode="none"- keyboardShouldPersistTaps="never"+ keyboardShouldPersistTaps="always"onMomentumScrollEnd={() => {actionSheetRef.current?.handleChildScrollEnd();}}>diff --git a/apps/mobile/src/utils/Colors.js b/apps/mobile/src/utils/Colors.jsindex 7e14e58ac..5335e8bcf 100644--- a/apps/mobile/src/utils/Colors.js+++ b/apps/mobile/src/utils/Colors.js@@ -11,7 +11,7 @@ export const ACCENT = {export const COLORS_NOTE = {red: '#f44336',orange: '#FF9800',- yellow: '#FFD600',+ yellow: '#F9D71C',green: '#4CAF50',blue: '#2196F3',purple: '#673AB7',