Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

refactoring

ammarahm-ed6002586463ff
diff --git a/apps/mobile/src/components/Menu/index.js b/apps/mobile/src/components/Menu/index.js
index 1cb77e88b..c4d75c850 100644
--- a/apps/mobile/src/components/Menu/index.js
+++ b/apps/mobile/src/components/Menu/index.js
@@ -1,4 +1,4 @@
-import React, { useEffect } from 'react';
+import React, {useEffect} from 'react';
import {
Platform,
SafeAreaView,
@@ -23,22 +23,22 @@ import {
SIZE,
WEIGHT,
} from '../../common/common';
-import { useTracked } from '../../provider';
-import { ACTIONS } from '../../provider/actions';
-import { eSendEvent } from '../../services/eventManager';
-import { eClearSearch, eOpenModalMenu } from '../../services/events';
+import {useTracked} from '../../provider';
+import {ACTIONS} from '../../provider/actions';
+import {eSendEvent} from '../../services/eventManager';
+import {eClearSearch, eOpenModalMenu} from '../../services/events';
import NavigationService from '../../services/NavigationService';
-import { db, DDS, hexToRGBA, timeSince } from '../../utils/utils';
-import { sideMenuOverlayRef } from '../../utils/refs';
+import {db, DDS, hexToRGBA, timeSince} from '../../utils/utils';
+import {sideMenuOverlayRef} from '../../utils/refs';
export const Menu = ({
- close = () => { },
+ close = () => {},
hide,
- update = () => { },
+ update = () => {},
noTextMode = false,
}) => {
const [state, dispatch] = useTracked();
- const { colors, tags, colorNotes, user } = state;
+ const {colors, tags, colorNotes, user} = state;
// todo
@@ -46,11 +46,11 @@ export const Menu = ({
let newColors = setColorScheme(colors, accent);
StatusBar.setBarStyle(colors.night ? 'light-content' : 'dark-content');
- dispatch({ type: ACTIONS.THEME, colors: newColors });
+ dispatch({type: ACTIONS.THEME, colors: newColors});
}
useEffect(() => {
- dispatch({ type: ACTIONS.TAGS });
+ dispatch({type: ACTIONS.TAGS});
}, []);
const listItems = [
@@ -93,10 +93,10 @@ export const Menu = ({
icon: 'theme-light-dark',
func: () => {
if (!colors.night) {
- MMKV.setStringAsync('theme', JSON.stringify({ night: true }));
+ MMKV.setStringAsync('theme', JSON.stringify({night: true}));
changeColorScheme(COLOR_SCHEME_DARK);
} else {
- MMKV.setStringAsync('theme', JSON.stringify({ night: false }));
+ MMKV.setStringAsync('theme', JSON.stringify({night: false}));
changeColorScheme(COLOR_SCHEME_LIGHT);
}
@@ -137,10 +137,10 @@ export const Menu = ({
Platform.OS == 'ios'
? 0
: DDS.isTab
- ? noTextMode
- ? StatusBar.currentHeight
- : 0
- : StatusBar.currentHeight,
+ ? noTextMode
+ ? StatusBar.currentHeight
+ : 0
+ : StatusBar.currentHeight,
}}>
{DDS.isTab && noTextMode ? (
<TouchableOpacity
@@ -184,7 +184,7 @@ export const Menu = ({
)}
<ScrollView
- contentContainerStyle={{ minHeight: '50%' }}
+ contentContainerStyle={{minHeight: '50%'}}
style={{
paddingHorizontal: noTextMode ? 0 : 12,
}}
@@ -195,11 +195,11 @@ export const Menu = ({
key={item.name}
activeOpacity={opacity / 2}
onPress={() => {
- item.close === false ? null : close();
+ eSendEvent(eClearSearch);
+ item.func();
if (item.close) {
- eSendEvent(eClearSearch);
+ close();
}
- item.func();
}}
style={{
width: '100%',
@@ -246,8 +246,8 @@ export const Menu = ({
name={item.on ? 'toggle-right' : 'toggle-left'}
/>
) : (
- undefined
- )}
+ undefined
+ )}
</TouchableOpacity>
))}
</View>
@@ -512,8 +512,8 @@ export const Menu = ({
name={item.on ? 'toggle-switch' : 'toggle-switch-off'}
/>
) : (
- undefined
- )}
+ undefined
+ )}
</TouchableOpacity>
))}
</View>
@@ -542,8 +542,8 @@ export const Menu = ({
onPress={async () => {
//await db.sync();
console.log(await db.sync(), 'SYNCED');
- dispatch({ type: ACTIONS.NOTES });
- dispatch({ type: ACTIONS.PINNED });
+ dispatch({type: ACTIONS.NOTES});
+ dispatch({type: ACTIONS.PINNED});
}}
style={{
fontFamily: WEIGHT.regular,
@@ -590,70 +590,70 @@ export const Menu = ({
</View>
</View>
) : (
- <TouchableOpacity
- onPress={() => {
- DDS.isTab
- ? eSendEvent(eOpenLoginDialog)
- : NavigationService.navigate('Login');
+ <TouchableOpacity
+ onPress={() => {
+ DDS.isTab
+ ? eSendEvent(eOpenLoginDialog)
+ : NavigationService.navigate('Login');
- close();
- }}
- activeOpacity={opacity / 2}
+ close();
+ }}
+ activeOpacity={opacity / 2}
+ style={{
+ paddingVertical: 12,
+ marginVertical: 5,
+ marginTop: pv + 5,
+ borderRadius: 5,
+ width: '100%',
+ flexDirection: 'row',
+ alignItems: 'center',
+ justifyContent: noTextMode ? 'center' : 'flex-start',
+ backgroundColor: noTextMode ? 'transparent' : colors.shade,
+ paddingHorizontal: noTextMode ? 0 : 12,
+ }}>
+ <View
style={{
- paddingVertical: 12,
- marginVertical: 5,
- marginTop: pv + 5,
- borderRadius: 5,
- width: '100%',
- flexDirection: 'row',
+ width: 30,
+ backgroundColor: colors.accent,
+ height: 30,
+ borderRadius: 100,
alignItems: 'center',
- justifyContent: noTextMode ? 'center' : 'flex-start',
- backgroundColor: noTextMode ? 'transparent' : colors.shade,
- paddingHorizontal: noTextMode ? 0 : 12,
+ justifyContent: 'center',
}}>
+ <Icon
+ style={{
+ textAlign: 'center',
+ textAlignVertical: 'center',
+ }}
+ name="account-outline"
+ color="white"
+ size={SIZE.md}
+ />
+ </View>
+ {noTextMode ? null : (
<View
style={{
- width: 30,
- backgroundColor: colors.accent,
- height: 30,
- borderRadius: 100,
- alignItems: 'center',
- justifyContent: 'center',
+ marginLeft: 10,
}}>
- <Icon
- style={{
- textAlign: 'center',
- textAlignVertical: 'center',
- }}
- name="account-outline"
- color="white"
- size={SIZE.md}
- />
- </View>
- {noTextMode ? null : (
- <View
+ <Text
style={{
- marginLeft: 10,
+ fontFamily: WEIGHT.regular,
+ color: colors.icon,
+ fontSize: SIZE.xs,
}}>
- <Text
- style={{
- fontFamily: WEIGHT.regular,
- color: colors.icon,
- fontSize: SIZE.xs,
- }}>
- You are not logged in
+ You are not logged in
</Text>
- <Text
- style={{
- color: colors.accent,
- fontSize: SIZE.sm - 2,
- }}>
- Login to sync notes.
+ <Text
+ style={{
+ color: colors.accent,
+ fontSize: SIZE.sm - 2,
+ }}>
+ Login to sync notes.
</Text>
- </View>
- )}
- </TouchableOpacity>
- )}
+ </View>
+ )}
+ </TouchableOpacity>
+ )}
</View>
</SafeAreaView>
);
diff --git a/apps/mobile/src/services/Navigator.js b/apps/mobile/src/services/Navigator.js
index 9b066ed5f..f91e19751 100644
--- a/apps/mobile/src/services/Navigator.js
+++ b/apps/mobile/src/services/Navigator.js
@@ -46,9 +46,6 @@ export const TopLevelNavigator = createStackNavigator(
gesturesEnabled: false,
},
},
- Reminders: {
- screen: Reminders,
- },
Lists: {
screen: Lists,
},
@@ -61,9 +58,6 @@ export const TopLevelNavigator = createStackNavigator(
ListsEditor: {
screen: ListsEditor,
},
- ReminderEditor: {
- screen: ReminderEditor,
- },
Login: {
screen: Login,
},