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
minor fixes and refactoring
ammarahm-ed37eca899564d
diff --git a/apps/mobile/src/components/ActionSheetComponent/index.js b/apps/mobile/src/components/ActionSheetComponent/index.jsindex 15d428feb..7c5f40da2 100644--- a/apps/mobile/src/components/ActionSheetComponent/index.js+++ b/apps/mobile/src/components/ActionSheetComponent/index.js@@ -125,10 +125,10 @@ export const ActionSheetComponent = ({const localRefresh = (type, nodispatch = false) => {if (!note || !note.dateCreated) return;let toAdd;+ console.log(type);switch (type) {case 'note': {toAdd = db.getNote(note.dateCreated);-break;}case 'notebook': {@@ -136,10 +136,13 @@ export const ActionSheetComponent = ({break;}case 'topic': {+ console.log(note, 'topics');toAdd = db.getTopic(note.notebookId, note.title);+ console.log(toAdd, 'heree');break;}}+ if (!toAdd || !toAdd.dateCreated) return;if (!nodispatch) {dispatch({type: type});@@ -410,7 +413,7 @@ export const ActionSheetComponent = ({const _renderColumnItem = item =>(note.dateCreated && columnItems.includes(item.name)) ||- item.name === 'Dark Mode' ? (+ (item.name === 'Dark Mode' && columnItems.includes(item.name)) ? (<TouchableOpacitykey={item.name}activeOpacity={opacity}diff --git a/apps/mobile/src/components/Dialog/index.js b/apps/mobile/src/components/Dialog/index.jsindex 22131af99..3206fb18b 100644--- a/apps/mobile/src/components/Dialog/index.js+++ b/apps/mobile/src/components/Dialog/index.js@@ -32,16 +32,16 @@ export class Dialog extends Component {if (item.type === 'note') {await db.deleteNotes(item.dateCreated);- ToastEvent.show('Note moved to trash', 'success', 3000);+ ToastEvent.show('Note moved to trash', 'error', 3000);updateEvent({type: item.type});} else if (item.type === 'topic') {await db.deleteTopicFromNotebook(notebookID, item.title);updateEvent({type: 'notebook'});- ToastEvent.show('Topic moved to trash', 'success', 3000);+ ToastEvent.show('Topic deleted', 'error', 3000);} else if (item.type === 'notebook') {await db.deleteNotebooks(item.dateCreated);updateEvent({type: item.type});- ToastEvent.show('Notebook moved to trash', 'success', 3000);+ ToastEvent.show('Notebook moved to trash', 'error', 3000);}this.setState({@@ -60,7 +60,7 @@ export class Dialog extends Component {case dialogActions.ACTION_EMPTY_TRASH: {await db.clearTrash();updateEvent({type: ACTIONS.TRASH});- ToastEvent.show('Trash cleared', 'success', 1000, () => {}, '');+ ToastEvent.show('Trash cleared', 'error', 1000, () => {}, '');this.setState({visible: false,});@@ -76,6 +76,13 @@ export class Dialog extends Component {}case dialogActions.ACTION_TRASH: {db.restoreItem(item.dateCreated);+ ToastEvent.show(+ item.type.slice(0, 1).toUpperCase() ++ item.type.slice(1) ++ ' restored',+ 'success',+ 3000,+ );updateEvent({type: ACTIONS.TRASH});this.hide();}diff --git a/apps/mobile/src/components/NoteItem/index.js b/apps/mobile/src/components/NoteItem/index.jsindex 80f0c0c72..4a6eed24d 100644--- a/apps/mobile/src/components/NoteItem/index.js+++ b/apps/mobile/src/components/NoteItem/index.js@@ -137,7 +137,7 @@ export default class NoteItem extends React.Component {numberOfLines={1}style={{color: colors.pri,- fontSize: SIZE.md,+ fontSize: SIZE.sm + 1,fontFamily: WEIGHT.bold,maxWidth: '95%',marginBottom: 5,@@ -153,7 +153,7 @@ export default class NoteItem extends React.Component {<TextnumberOfLines={2}style={{- fontSize: SIZE.sm,+ fontSize: SIZE.sm - 1,color: colors.pri + 'B3',fontFamily: WEIGHT.regular,width: '100%',@@ -278,7 +278,7 @@ export default class NoteItem extends React.Component {isTrash? ['Remove', 'Restore']: ['Add to', 'Share', 'Export', 'Delete'],- [],+ isTrash ? [] : ['Pin', 'Favorite', 'Add to Vault'],);}}><Icon name="more-horizontal" size={SIZE.lg} color={colors.icon} />diff --git a/apps/mobile/src/components/NotebookItem/index.js b/apps/mobile/src/components/NotebookItem/index.jsindex 10319e5dc..b10c442df 100644--- a/apps/mobile/src/components/NotebookItem/index.js+++ b/apps/mobile/src/components/NotebookItem/index.js@@ -6,6 +6,7 @@ import {useTracked} from '../../provider';import NavigationService from '../../services/NavigationService';import {ToastEvent, w} from '../../utils/utils';import {ActionSheetEvent, moveNoteHideEvent} from '../DialogManager';+import {db} from '../../../App';export const NotebookItem = ({item,@@ -65,6 +66,8 @@ export const NotebookItem = ({<TouchableOpacitystyle={{width: '75%',+ minHeight: 50,+ justifyContent: 'center',}}onLongPress={onLongPress}onPress={navigate}>@@ -72,9 +75,10 @@ export const NotebookItem = ({numberOfLines={1}style={{fontFamily: WEIGHT.bold,- fontSize: SIZE.md,+ fontSize: SIZE.sm + 1,color: colors.pri,maxWidth: '100%',+ marginBottom: 5,}}>{item.title}</Text>@@ -100,8 +104,8 @@ export const NotebookItem = ({flexDirection: 'row',alignItems: 'center',marginTop: 5,- width: '95%',- maxWidth: '95%',+ width: '80%',+ maxWidth: '80%',flexWrap: 'wrap',}}>{item && item.topics@@ -190,7 +194,7 @@ export const NotebookItem = ({</Text></View>)}- {isTopic ? (+ {isTopic && item.totalNotes > 0 ? (<Textstyle={{color: colors.icon,@@ -199,16 +203,18 @@ export const NotebookItem = ({fontFamily: WEIGHT.regular,marginTop: 5,}}>- {item && item.totalNotes && item.totalNotes.length == 1+ {item && item.totalNotes && item.totalNotes > 1? item.totalNotes + ' notes'- : item.totalNotes + ' note'}+ : item.totalNotes === 1+ ? item.totalNotes + ' note'+ : null}</Text>) : null}</TouchableOpacity>- {hideMore ? null : (+ {hideMore ||+ (item.title === 'General' && item.type === 'topic') ? null : (<TouchableOpacitystyle={{- width: w * 0.05,justifyContent: 'center',minHeight: 70,alignItems: 'center',@@ -221,7 +227,8 @@ export const NotebookItem = ({'Delete',];- let columnItems = ['Pin', 'Favorite'];+ let columnItems =+ item.type === 'topic' ? [] : ['Pin', 'Favorite'];ActionSheetEvent(item, false, false, rowItems, columnItems, {notebookID: notebookID,@@ -236,21 +243,33 @@ export const NotebookItem = ({activeOpacity={opacity}onPress={async () => {console.log(selectedItemsList, item);- /* if (!noteToMove.notebook.notebook) {++ /* let noteIds = [];+ selectedItemsList.forEach(item => noteIds.push(item.dateCreated));+ if (!noteToMove.notebook.notebook) {+ await db.moveNotes(null, {+ topic: item.title,+ id: item.notebookId,+ });await db.addNoteToTopic(notebookID,item.title,noteToMove.dateCreated,);} else if (selectedItemsList) {-++ await db.moveNotes(null, {+ topic: item.title,+ id: item.notebookId,+ });await db.moveNote(noteToMove.dateCreated, noteToMove.notebook, {notebook: notebookID,topic: item.title,- });- } */+ });++ }*/- // moveNoteHideEvent();+ moveNoteHideEvent();ToastEvent.show(`Note moved to ${item.title}`,diff --git a/apps/mobile/src/components/NotesList/index.js b/apps/mobile/src/components/NotesList/index.jsindex ab0f6e385..7f622d7ad 100644--- a/apps/mobile/src/components/NotesList/index.js+++ b/apps/mobile/src/components/NotesList/index.js@@ -140,7 +140,7 @@ export const NotesList = ({isGrouped = false}) => {<Textstyle={{fontFamily: WEIGHT.bold,- fontSize: SIZE.sm,+ fontSize: SIZE.xs + 1,color: colors.accent,paddingHorizontal: 12,width: '100%',diff --git a/apps/mobile/src/views/Editor/index.js b/apps/mobile/src/views/Editor/index.jsindex a6a14a676..2e581688e 100755--- a/apps/mobile/src/views/Editor/index.js+++ b/apps/mobile/src/views/Editor/index.js@@ -294,6 +294,70 @@ const Editor = ({navigation, noMenu}) => {link.click();}`;+ const timeConverter = timestamp => {+ var d = new Date(timestamp), // Convert the passed timestamp to milliseconds+ yyyy = d.getFullYear(),+ mm = ('0' + (d.getMonth() + 1)).slice(-2), // Months are zero based. Add leading 0.+ dd = ('0' + d.getDate()).slice(-2), // Add leading 0.+ currentDay = d.getDay(),+ hh = d.getHours(),+ h = hh,+ min = ('0' + d.getMinutes()).slice(-2), // Add leading 0.+ ampm = 'AM',+ time;+ let days = [+ 'Sunday',+ 'Monday',+ 'Tuesday',+ 'Wednesday',+ 'Thursday',+ 'Friday',+ 'Saturday',+ ];+ var months = [+ 'Jan',+ 'Feb',+ 'Mar',+ 'Apr',+ 'May',+ 'Jun',+ 'Jul',+ 'Aug',+ 'Sep',+ 'Oct',+ 'Nov',+ 'Dec',+ ];++ if (hh > 12) {+ h = hh - 12;+ ampm = 'PM';+ } else if (hh === 12) {+ h = 12;+ ampm = 'PM';+ } else if (hh == 0) {+ h = 12;+ }++ // ie: 2013-02-18, 8:35 AM+ time =+ days[currentDay] ++ ' ' ++ dd ++ ' ' ++ months[d.getMonth()] ++ ', ' ++ yyyy ++ ', ' ++ h ++ ':' ++ min ++ ' ' ++ ampm;++ return time;+ };+const _renderEditor = () => {return (<KeyboardAvoidingView@@ -305,8 +369,7 @@ const Editor = ({navigation, noMenu}) => {<Viewstyle={{marginTop: Platform.OS === 'ios' ? 0 : StatusBar.currentHeight,- }}- />+ }}></View>{noMenu ? null : (<TouchableOpacity@@ -330,7 +393,7 @@ const Editor = ({navigation, noMenu}) => {<Iconstyle={{marginLeft: -7,- marginTop: -3.5,+ marginTop: -1.5,}}name="chevron-left"color={colors.icon}@@ -405,6 +468,28 @@ const Editor = ({navigation, noMenu}) => {</TouchableOpacity></View>+ <View+ style={{+ paddingHorizontal: 12,+ marginTop:+ Platform.OS === 'ios' ? 45 : StatusBar.currentHeight + 45,+ width: '100%',+ position: 'absolute',+ justifyContent: 'space-between',+ flexDirection: 'row',+ alignItems: 'center',+ paddingLeft: noMenu ? 12 : 12 + 50,+ }}>+ <Text+ style={{+ color: colors.icon,+ fontSize: SIZE.xxs,+ textAlignVertical: 'center',+ fontFamily: WEIGHT.regular,+ }}>+ {timeConverter(timestamp)}+ </Text>+ </View><WebViewref={ref => (EditorWebView = ref)}onError={error => console.log(error)}