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
cleanup
ammarahm-ed1b3cad3a0291
diff --git a/apps/mobile/src/components/NotesList/index.js b/apps/mobile/src/components/NotesList/index.jsindex aaa775173..6f468eeb4 100644--- a/apps/mobile/src/components/NotesList/index.js+++ b/apps/mobile/src/components/NotesList/index.js@@ -1,4 +1,4 @@-import React, {useEffect, useState, createRef} from 'react';+import React, { useEffect, useState, createRef } from 'react';import {ActivityIndicator,FlatList,@@ -8,26 +8,26 @@ import {Text,View,} from 'react-native';-import {SIZE, WEIGHT} from '../../common/common';-import {useTracked} from '../../provider';-import {ACTIONS} from '../../provider/actions';-import {eSendEvent} from '../../services/eventManager';-import {eScrollEvent, eClearSearch} from '../../services/events';-import {ToastEvent, hexToRGBA, DDS, db} from '../../utils/utils';-import {NotesPlaceHolder} from '../ListPlaceholders';+import { SIZE, WEIGHT } from '../../common/common';+import { useTracked } from '../../provider';+import { ACTIONS } from '../../provider/actions';+import { eSendEvent } from '../../services/eventManager';+import { eScrollEvent, eClearSearch } from '../../services/events';+import { ToastEvent, hexToRGBA, DDS, db } from '../../utils/utils';+import { NotesPlaceHolder } from '../ListPlaceholders';import NoteItem from '../NoteItem';import SelectionWrapper from '../SelectionWrapper';-import {useIsFocused} from 'react-navigation-hooks';+import { useIsFocused } from 'react-navigation-hooks';const sectionListRef = createRef();-export const NotesList = ({isGrouped = false}) => {+export const NotesList = ({ isGrouped = false }) => {const [state, dispatch] = useTracked();- const {colors, selectionMode, currentEditingNote, loading, notes} = state;+ const { colors, selectionMode, currentEditingNote, loading, notes } = state;const isFocused = useIsFocused();const [refreshing, setRefreshing] = useState(false);- const searchResults = {...state.searchResults};+ const searchResults = { ...state.searchResults };- const _renderItem = ({item, index}) => (+ const _renderItem = ({ item, index }) => (<SelectionWrapperindex={index}currentEditingNote={@@ -46,12 +46,12 @@ export const NotesList = ({isGrouped = false}) => {selectionMode={selectionMode}onLongPress={() => {if (!selectionMode) {- dispatch({type: ACTIONS.SELECTION_MODE, enabled: true});+ dispatch({ type: ACTIONS.SELECTION_MODE, enabled: true });}- dispatch({type: ACTIONS.SELECTED_ITEMS, item: item});+ dispatch({ type: ACTIONS.SELECTED_ITEMS, item: item });}}update={() => {- dispatch({type: ACTIONS.NOTES});+ dispatch({ type: ACTIONS.NOTES });}}item={item}index={index}@@ -77,8 +77,8 @@ export const NotesList = ({isGrouped = false}) => {: 135: 135 - 60: notes[0] && !selectionMode- ? 155- : 155 - 60,+ ? 155+ : 155 - 60,}}><PinnedItems /></View>@@ -115,23 +115,23 @@ export const NotesList = ({isGrouped = false}) => {{loading ? (<ActivityIndicator size={SIZE.xl} color={colors.accent} />) : (- <>- <NotesPlaceHolder colors={colors} />- <Text- style={{- color: colors.icon,- fontSize: SIZE.sm,- fontFamily: WEIGHT.regular,- marginTop: 35,- }}>- Notes you write will appear here.+ <>+ <NotesPlaceHolder colors={colors} />+ <Text+ style={{+ color: colors.icon,+ fontSize: SIZE.sm,+ fontFamily: WEIGHT.regular,+ marginTop: 35,+ }}>+ Notes you write will appear here.</Text>- </>- )}+ </>+ )}</View>);- const _renderSectionHeader = ({section: {title}}) => (+ const _renderSectionHeader = ({ section: { title } }) => (<Textstyle={{fontFamily: WEIGHT.bold,@@ -158,8 +158,8 @@ export const NotesList = ({isGrouped = false}) => {: 135: 135 - 60: notes[0] && !selectionMode- ? 155- : 155 - 60,+ ? 155+ : 155 - 60,flexDirection: 'row',alignItems: 'center',justifyContent: 'space-between',@@ -202,14 +202,14 @@ export const NotesList = ({isGrouped = false}) => {setRefreshing(true);try {await db.sync();- dispatch({type: ACTIONS.NOTES});- dispatch({type: ACTIONS.PINNED});- dispatch({type: ACTIONS.USER});+ dispatch({ type: ACTIONS.NOTES });+ dispatch({ type: ACTIONS.PINNED });+ dispatch({ type: ACTIONS.USER });setRefreshing(false);ToastEvent.show('Sync Complete', 'success');} catch (e) {setRefreshing(false);- ToastEvent.show('Sync failed, network error', 'error');+ ToastEvent.show(e.message, 'error');}}}refreshing={refreshing}@@ -233,31 +233,31 @@ export const NotesList = ({isGrouped = false}) => {renderItem={_renderItem}/>) : (- <FlatList- data={searchResults.type === 'notes' ? searchResults.results : []}- keyExtractor={_listKeyExtractor}- ListFooterComponent={_ListFooterComponent}- onScroll={_onScroll}- ListHeaderComponent={_ListHeaderComponent_S}- contentContainerStyle={{- width: '100%',- alignSelf: 'center',- minHeight: '100%',- }}- style={{- height: '100%',- }}- renderItem={_renderItem}- />- );+ <FlatList+ data={searchResults.type === 'notes' ? searchResults.results : []}+ keyExtractor={_listKeyExtractor}+ ListFooterComponent={_ListFooterComponent}+ onScroll={_onScroll}+ ListHeaderComponent={_ListHeaderComponent_S}+ contentContainerStyle={{+ width: '100%',+ alignSelf: 'center',+ minHeight: '100%',+ }}+ style={{+ height: '100%',+ }}+ renderItem={_renderItem}+ />+ );};const PinnedItems = () => {const [state, dispatch] = useTracked();- const {pinned, colors, selectionMode} = state;+ const { pinned, colors, selectionMode } = state;useEffect(() => {- dispatch({type: ACTIONS.PINNED});+ dispatch({ type: ACTIONS.PINNED });}, []);return (@@ -265,7 +265,7 @@ const PinnedItems = () => {<FlatListdata={pinned.notes}keyExtractor={(item, index) => item.id.toString()}- renderItem={({item, index}) =>+ renderItem={({ item, index }) =>item.type === 'note' ? (<SelectionWrapperindex={index}@@ -293,12 +293,12 @@ const PinnedItems = () => {selectionMode={selectionMode}onLongPress={() => {if (!selectionMode) {- dispatch({type: ACTIONS.SELECTION_MODE, enabled: true});+ dispatch({ type: ACTIONS.SELECTION_MODE, enabled: true });}- dispatch({type: ACTIONS.SELECTED_ITEMS, item: item});+ dispatch({ type: ACTIONS.SELECTED_ITEMS, item: item });}}update={() => {- dispatch({type: ACTIONS.NOTES});+ dispatch({ type: ACTIONS.NOTES });}}item={item}index={index}diff --git a/apps/mobile/src/provider/reducer.js b/apps/mobile/src/provider/reducer.jsindex 5044fae96..01ea81008 100644--- a/apps/mobile/src/provider/reducer.js+++ b/apps/mobile/src/provider/reducer.js@@ -1,6 +1,6 @@-import {history, db} from '../utils/utils';-import {ACTIONS} from './actions';-import {sideMenuRef} from '../utils/refs';+import { history, db } from '../utils/utils';+import { ACTIONS } from './actions';+import { sideMenuRef } from '../utils/refs';export const reducer = (state, action) => {switch (action.type) {@@ -11,7 +11,6 @@ export const reducer = (state, action) => {return {...state,notes: db.notes.group(),-notebooks: db.notebooks.all,trash: db.trash.all,pinned: {@@ -39,7 +38,7 @@ export const reducer = (state, action) => {case ACTIONS.THEME: {return {...state,- colors: {...action.colors},+ colors: { ...action.colors },};}case ACTIONS.USER: {@@ -58,7 +57,7 @@ export const reducer = (state, action) => {case ACTIONS.SETTINGS: {return {...state,- settings: {...action.settings},+ settings: { ...action.settings },};}case ACTIONS.TRASH: {@@ -168,7 +167,7 @@ export const reducer = (state, action) => {let results = action.results;return {...state,- searchResults: {...results},+ searchResults: { ...results },};}default:diff --git a/apps/mobile/src/views/Login/index.js b/apps/mobile/src/views/Login/index.jsindex a4911c385..138e58a07 100644--- a/apps/mobile/src/views/Login/index.js+++ b/apps/mobile/src/views/Login/index.js@@ -1,4 +1,4 @@-import React, {createRef, useEffect, useState} from 'react';+import React, { createRef, useEffect, useState } from 'react';import {BackHandler,SafeAreaView,@@ -7,14 +7,14 @@ import {View,ActivityIndicator,} from 'react-native';-import {TextInput} from 'react-native-gesture-handler';-import {useIsFocused} from 'react-navigation-hooks';+import { TextInput } from 'react-native-gesture-handler';+import { useIsFocused } from 'react-navigation-hooks';-import {opacity, pv, SIZE, WEIGHT} from '../../common/common';-import {Header} from '../../components/header';-import {useTracked} from '../../provider';-import {eSendEvent} from '../../services/eventManager';-import {eCloseSideMenu, refreshNotesPage} from '../../services/events';+import { opacity, pv, SIZE, WEIGHT } from '../../common/common';+import { Header } from '../../components/header';+import { useTracked } from '../../provider';+import { eSendEvent } from '../../services/eventManager';+import { eCloseSideMenu, refreshNotesPage } from '../../services/events';import * as Animatable from 'react-native-animatable';import {validateEmail,@@ -22,22 +22,22 @@ import {validateUsername,} from '../../services/validation';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';-import {ToastEvent, db, DDS} from '../../utils/utils';-import {ACTIONS} from '../../provider/actions';+import { ToastEvent, db, DDS } from '../../utils/utils';+import { ACTIONS } from '../../provider/actions';-export const Login = ({navigation}) => {+export const Login = ({ navigation }) => {const [state, dispatch] = useTracked();- const {colors, isLoginNavigator} = state;+ const { colors, isLoginNavigator } = state;const _email = createRef();const _pass = createRef();const [status, setStatus] = useState('Logging in...');const _username = createRef();const [loggingIn, setLoggingIn] = useState(false);const [email, setEmail] = useState('');- const [password, setPassword] = useState('loveyouall123');+ const [password, setPassword] = useState('google123');const [invalidEmail, setInvalidEmail] = useState(false);const [invalidPassword, setInvalidPassword] = useState(false);- const [username, setUsername] = useState('ammarahmed');+ const [username, setUsername] = useState('thecodrr');const [invalidUsername, setInvalidUsername] = useState(false);const isFocused = useIsFocused();@@ -94,17 +94,17 @@ export const Login = ({navigation}) => {}let user;- console.log(await db.user.get());+try {user = await db.user.get();console.log('user', user);- dispatch({type: ACTIONS.USER, user: user});- ToastEvent.show(`Logged in as ${user.username}`, 'success');+ dispatch({ type: ACTIONS.USER, user: user });+ ToastEvent.show(`Logged in as ${username}`, 'success');navigation.goBack();await db.sync();eSendEvent(refreshNotesPage);- dispatch({type: ACTIONS.ALL});+ dispatch({ type: ACTIONS.ALL });} catch (e) {console.log(e, 'getUSer');ToastEvent.show(e.message, 'error');