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
create InfoBar component
ammarahm-ed9b70d495cb79
diff --git a/apps/mobile/src/components/NoteItem/index.js b/apps/mobile/src/components/NoteItem/index.jsindex 047aae715..9264fba27 100644--- a/apps/mobile/src/components/NoteItem/index.js+++ b/apps/mobile/src/components/NoteItem/index.js@@ -84,7 +84,6 @@ export default class NoteItem extends React.Component {activeOpacity={0.8}onLongPress={() => onLongPress()}onPress={async () => {- return;if (item.conflicted) {eSendEvent(eShowMergeDialog, item);diff --git a/apps/mobile/src/views/Editor/InfoBar.js b/apps/mobile/src/views/Editor/InfoBar.jsnew file mode 100644index 000000000..6f8932b98--- /dev/null+++ b/apps/mobile/src/views/Editor/InfoBar.js@@ -0,0 +1,66 @@+import React from 'react';+import {View, StatusBar, Text} from 'react-native';+import {db, timeConverter} from '../../utils/utils';+import {simpleDialogEvent} from '../../components/DialogManager/recievers';+import {TEMPLATE_INFO} from '../../components/DialogManager/templates';+import {SIZE, WEIGHT} from '../../common/common';++export default class InfoBar extends React.Component {+ constructor(props) {+ super(props);+ this.state = {+ dateEdited: null,+ };+ this.dateCreated = null;+ }+ setDateEdited(id) {+ console.log(id);+ this.setState({+ dateEdited: id,+ });+ }+ setDateCreated(dateCreated) {+ this.dateCreated = dateCreated;+ }++ render() {+ return (+ <View+ style={{+ paddingHorizontal: 12,+ marginTop: Platform.OS === 'ios' ? 45 : StatusBar.currentHeight + 45,+ width: '100%',+ position: 'absolute',+ justifyContent: 'flex-start',+ flexDirection: 'row',+ alignItems: 'center',+ paddingLeft: this.props.noMenu ? 12 : 12 + 50,+ zIndex: 999,+ }}>+ <Text+ onPress={() => {+ simpleDialogEvent(TEMPLATE_INFO(this.dateCreated));+ }}+ style={{+ color: this.props.colors.icon,+ fontSize: SIZE.xxs,+ textAlignVertical: 'center',+ fontFamily: WEIGHT.regular,+ }}>+ {timeConverter(this.state.dateEdited)}+ </Text>++ <Text+ style={{+ color: this.props.colors.icon,+ fontSize: SIZE.xxs,+ textAlignVertical: 'center',+ fontFamily: WEIGHT.regular,+ marginLeft: 10,+ }}>+ {this.state.dateEdited ? 'Saved' : ''}+ </Text>+ </View>+ );+ }+}diff --git a/apps/mobile/src/views/Editor/index.js b/apps/mobile/src/views/Editor/index.jsindex ffe60d1b7..60e23e916 100755--- a/apps/mobile/src/views/Editor/index.js+++ b/apps/mobile/src/views/Editor/index.js@@ -38,7 +38,9 @@ import {import {exitEditorAnimation} from '../../utils/animations';import {sideMenuRef} from '../../utils/refs';import {db, DDS, editing, timeConverter, ToastEvent} from '../../utils/utils';+import InfoBar from './InfoBar';+const InfoBarRef = createRef();const EditorWebView = createRef();let note = {};let id = null;@@ -291,6 +293,7 @@ const Editor = ({noMenu}) => {type: ACTIONS.CURRENT_EDITING_NOTE,id: id,});+ setDateEdited(db.notes.note(id).data.dateEdited);}if (content.text.length < 200 || saveCounter < 2) {@@ -299,9 +302,18 @@ const Editor = ({noMenu}) => {});eSendEvent(refreshNotesPage);}++ InfoBarRef.current?.setDateEdited(db.notes.note(id).data.dateEdited);+ InfoBarRef.current?.setDateCreated(db.notes.note(id).data.dateCreated);+saveCounter++;} else {if (id) {+ dispatch({+ type: ACTIONS.CURRENT_EDITING_NOTE,+ id: id,+ });+await db.vault.save({title,content: {@@ -311,6 +323,8 @@ const Editor = ({noMenu}) => {id: id,});}+ InfoBarRef.current?.setDateEdited(db.notes.note(id).data.dateEdited);+ InfoBarRef.current?.setDateCreated(db.notes.note(id).data.dateCreated);}};@@ -580,43 +594,7 @@ const Editor = ({noMenu}) => {</TouchableOpacity></View>- <View- style={{- paddingHorizontal: 12,- marginTop:- Platform.OS === 'ios' ? 45 : StatusBar.currentHeight + 45,- width: '100%',- position: 'absolute',- justifyContent: 'flex-start',- flexDirection: 'row',- alignItems: 'center',- paddingLeft: noMenu ? 12 : 12 + 50,- zIndex: 999,- }}>- <Text- onPress={() => {- simpleDialogEvent(TEMPLATE_INFO(note.dateCreated));- }}- style={{- color: colors.icon,- fontSize: SIZE.xxs,- textAlignVertical: 'center',- fontFamily: WEIGHT.regular,- }}>- {timeConverter(dateEdited)}- </Text>-- <Text- style={{- color: colors.icon,- fontSize: SIZE.xxs,- textAlignVertical: 'center',- fontFamily: WEIGHT.regular,- marginLeft: 10,- }}>- {dateEdited ? 'Saved' : ''}- </Text>- </View>+ <InfoBar ref={InfoBarRef} colors={colors} noMenu={noMenu} /><WebViewref={EditorWebView}onError={error => console.log(error)}