Skip to content

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

add settings views

ammarahm-edf0469f6089b8
diff --git a/apps/mobile/App.js b/apps/mobile/App.js
index 0e497c363..18060e6b9 100644
--- a/apps/mobile/App.js
+++ b/apps/mobile/App.js
@@ -31,7 +31,6 @@ import Editor from './src/views/Editor';
export const DDS = new DeviceDetectionService();
export const db = new Storage(StorageInterface);
-let overlayViewRef;
let sideMenuRef;
let editorRef;
let outColors;
diff --git a/apps/mobile/src/services/NavigationService.js b/apps/mobile/src/services/NavigationService.js
index a62d62f28..c9ddba7fd 100755
--- a/apps/mobile/src/services/NavigationService.js
+++ b/apps/mobile/src/services/NavigationService.js
@@ -21,6 +21,8 @@ import Settings from '../views/Settings';
import Signup from '../views/Signup';
import Tags from '../views/Tags';
import Trash from '../views/Trash';
+import AppearanceSettings from '../views/AppearanceSettings';
+import EditorSettings from '../views/EditorSettings';
const fade = props => {
const {position, scene} = props;
@@ -94,10 +96,15 @@ const TopLevelNavigator = createStackNavigator(
Notebook: {
screen: Notebook,
},
-
AccountSettings: {
screen: AccountSettings,
},
+ AppearanceSettings: {
+ screen: AppearanceSettings,
+ },
+ EditorSettings: {
+ screen: EditorSettings,
+ },
},
{
initialRouteName: 'Home',
diff --git a/apps/mobile/src/views/AppearanceSettings/index.js b/apps/mobile/src/views/AppearanceSettings/index.js
new file mode 100644
index 000000000..59f87f3b5
--- /dev/null
+++ b/apps/mobile/src/views/AppearanceSettings/index.js
@@ -0,0 +1,225 @@
+import React from 'react';
+import {
+ ScrollView,
+ StatusBar,
+ Text,
+ TouchableOpacity,
+ View,
+} from 'react-native';
+import FastStorage from 'react-native-fast-storage';
+import Icon from 'react-native-vector-icons/Feather';
+import {
+ ACCENT,
+ COLOR_SCHEME,
+ COLOR_SCHEME_DARK,
+ COLOR_SCHEME_LIGHT,
+ opacity,
+ pv,
+ setColorScheme,
+ SIZE,
+ WEIGHT,
+} from '../../common/common';
+import Container from '../../components/Container';
+import {useTracked} from '../../provider';
+import {ACTIONS} from '../../provider/actions';
+const AppearanceSettings = ({navigation}) => {
+ const [state, dispatch] = useTracked();
+ const {colors} = state;
+
+ ///
+ function changeColorScheme(colors = COLOR_SCHEME, accent = ACCENT) {
+ let newColors = setColorScheme(colors, accent);
+ StatusBar.setBarStyle(newColors.night ? 'light-content' : 'dark-content');
+
+ dispatch({type: ACTIONS.THEME, colors: newColors});
+ }
+
+ function changeAccentColor(accentColor) {
+ ACCENT.color = accentColor;
+ ACCENT.shade = accentColor + '12';
+ changeColorScheme();
+ }
+
+ return (
+ <Container
+ menu={true}
+ heading="Apperance "
+ canGoBack={false}
+ noSearch={true}
+ noSelectionHeader={true}
+ noBottomButton={true}>
+ <View
+ style={{
+ marginTop: Platform.OS == 'ios' ? 135 - 60 : 155 - 60,
+ }}
+ />
+ <View
+ style={{
+ paddingHorizontal: 12,
+ }}>
+ <View>
+ <View
+ style={{
+ marginTop: 10,
+ }}>
+ <Text
+ style={{
+ fontSize: SIZE.md,
+ fontFamily: WEIGHT.regular,
+ textAlignVertical: 'center',
+ color: colors.pri,
+ }}>
+ Accent Color
+ </Text>
+ </View>
+ <ScrollView
+ contentContainerStyle={{
+ flexDirection: 'row',
+ flexWrap: 'wrap',
+ marginTop: 10,
+ marginHorizontal: 0,
+ borderBottomWidth: 1,
+ paddingBottom: pv + 5,
+ borderBottomColor: colors.nav,
+ }}>
+ {[
+ '#e6194b',
+ '#3cb44b',
+ '#ffe119',
+ '#0560FF',
+ '#f58231',
+ '#911eb4',
+ '#46f0f0',
+ '#f032e6',
+ '#bcf60c',
+ '#fabebe',
+ ].map(item => (
+ <TouchableOpacity
+ key={item}
+ onPress={() => {
+ changeAccentColor(item);
+
+ FastStorage.setItem('accentColor', item);
+ }}
+ style={{
+ flexDirection: 'row',
+ justifyContent: 'center',
+ alignItems: 'center',
+ marginRight: 10,
+ marginVertical: 5,
+ }}>
+ <View
+ style={{
+ width: 35,
+ height: 35,
+ backgroundColor: item,
+ borderRadius: 100,
+ justifyContent: 'center',
+ alignItems: 'center',
+ }}>
+ {colors.accent === item ? (
+ <Icon size={SIZE.lg} color="white" name="check" />
+ ) : null}
+ </View>
+ </TouchableOpacity>
+ ))}
+ </ScrollView>
+ <TouchableOpacity
+ onPress={() => {
+ if (!colors.night) {
+ FastStorage.setItem('theme', JSON.stringify({night: true}));
+ changeColorScheme(COLOR_SCHEME_DARK);
+ } else {
+ FastStorage.setItem('theme', JSON.stringify({night: false}));
+
+ changeColorScheme(COLOR_SCHEME_LIGHT);
+ }
+ }}
+ activeOpacity={opacity}
+ style={{
+ width: '100%',
+ marginHorizontal: 0,
+ paddingVertical: pv + 5,
+ flexDirection: 'row',
+ alignItems: 'center',
+ justifyContent: 'space-between',
+ borderBottomWidth: 1,
+ borderBottomColor: colors.nav,
+ }}>
+ <Text
+ style={{
+ fontSize: SIZE.md,
+ fontFamily: WEIGHT.regular,
+ textAlignVertical: 'center',
+ color: colors.pri,
+ }}>
+ Dark Mode
+ </Text>
+ <Icon
+ size={SIZE.xl}
+ color={colors.night ? colors.accent : colors.icon}
+ name={colors.night ? 'toggle-right' : 'toggle-left'}
+ />
+ </TouchableOpacity>
+
+ <TouchableOpacity
+ onPress={() => {
+ if (!colors.night) {
+ FastStorage.setItem('theme', JSON.stringify({night: true}));
+ changeColorScheme(COLOR_SCHEME_DARK);
+ } else {
+ FastStorage.setItem('theme', JSON.stringify({night: false}));
+
+ changeColorScheme(COLOR_SCHEME_LIGHT);
+ }
+ }}
+ activeOpacity={opacity}
+ style={{
+ width: '100%',
+ marginHorizontal: 0,
+ paddingVertical: pv + 5,
+ flexDirection: 'row',
+ alignItems: 'center',
+ justifyContent: 'space-between',
+ borderBottomWidth: 1,
+ borderBottomColor: colors.nav,
+ }}>
+ <Text
+ style={{
+ fontSize: SIZE.md,
+ fontFamily: WEIGHT.regular,
+ textAlignVertical: 'center',
+ color: colors.pri,
+ }}>
+ Font Scaling
+ </Text>
+
+ <View
+ style={{
+ borderBottomWidth: 1,
+ borderColor: colors.nav,
+ paddingVertical: 1,
+ paddingHorizontal: 5,
+ }}>
+ <Text
+ style={{
+ fontSize: SIZE.sm,
+ fontFamily: WEIGHT.regular,
+ textAlignVertical: 'center',
+ color: colors.pri,
+ }}>
+ 1.0x
+ </Text>
+ </View>
+ </TouchableOpacity>
+ </View>
+ </View>
+ </Container>
+ );
+};
+
+AppearanceSettings.navigationOptions = {
+ header: null,
+};
+
+export default AppearanceSettings;
diff --git a/apps/mobile/src/views/EditorSettings/index.js b/apps/mobile/src/views/EditorSettings/index.js
new file mode 100644
index 000000000..1907d42a7
--- /dev/null
+++ b/apps/mobile/src/views/EditorSettings/index.js
@@ -0,0 +1,66 @@
+import React from 'react';
+import {Text, TouchableOpacity, View} from 'react-native';
+import Icon from 'react-native-vector-icons/Feather';
+import {opacity, pv, SIZE, WEIGHT} from '../../common/common';
+import Container from '../../components/Container';
+import {useTracked} from '../../provider';
+const EditorSettings = ({navigation}) => {
+ const [state, dispatch] = useTracked();
+ const {colors} = state;
+
+ return (
+ <Container
+ menu={true}
+ heading="Editor"
+ canGoBack={false}
+ noSearch={true}
+ noSelectionHeader={true}
+ noBottomButton={true}>
+ <View
+ style={{
+ marginTop: Platform.OS == 'ios' ? 135 - 60 : 155 - 60,
+ }}
+ />
+
+ <View
+ style={{
+ paddingHorizontal: 12,
+ }}>
+ <TouchableOpacity
+ activeOpacity={opacity}
+ style={{
+ width: '100%',
+ marginHorizontal: 0,
+ paddingVertical: pv,
+ flexDirection: 'row',
+ alignItems: 'center',
+ justifyContent: 'space-between',
+ borderBottomWidth: 1,
+ paddingBottom: pv + 5,
+ borderBottomColor: colors.nav,
+ }}>
+ <Text
+ style={{
+ fontSize: SIZE.md,
+ fontFamily: WEIGHT.regular,
+ textAlignVertical: 'center',
+ color: colors.pri,
+ }}>
+ Show toolbar on top
+ </Text>
+ <Icon
+ size={SIZE.xl}
+ color={colors.night ? colors.accent : colors.icon}
+ name={colors.night ? 'toggle-right' : 'toggle-left'}
+ />
+ </TouchableOpacity>
+ </View>
+ </Container>
+ );
+};
+
+EditorSettings.navigationOptions = {
+ header: null,
+};
+
+export default EditorSettings;
diff --git a/apps/mobile/src/views/Settings/index.js b/apps/mobile/src/views/Settings/index.js
index 80388c040..035d15b97 100644
--- a/apps/mobile/src/views/Settings/index.js
+++ b/apps/mobile/src/views/Settings/index.js
@@ -25,24 +25,10 @@ import {Header} from '../../components/header';
import {useTracked} from '../../provider';
import {ACTIONS} from '../../provider/actions';
import NavigationService from '../../services/NavigationService';
+import {w} from '../../utils/utils';
export const Settings = ({navigation}) => {
const [state, dispatch] = useTracked();
const {colors} = state;
-
- ///
- function changeColorScheme(colors = COLOR_SCHEME, accent = ACCENT) {
- let newColors = setColorScheme(colors, accent);
- StatusBar.setBarStyle(newColors.night ? 'light-content' : 'dark-content');
-
- dispatch({type: ACTIONS.THEME, colors: newColors});
- }
-
- function changeAccentColor(accentColor) {
- ACCENT.color = accentColor;
- ACCENT.shade = accentColor + '12';
- changeColorScheme();
- }
-
return (
<Container
menu={true}
@@ -60,10 +46,6 @@ export const Settings = ({navigation}) => {
/>
}
data={[
- {
- name: 'General',
- func: () => {},
- },
{
name: 'Account',
func: () => {
@@ -71,101 +53,16 @@ export const Settings = ({navigation}) => {
},
},
{
- name: 'Theme',
- customComponent: (
- <View>
- <ScrollView
- contentContainerStyle={{
- flexDirection: 'row',
- flexWrap: 'wrap',
- marginTop: 10,
- marginHorizontal: 20,
- }}>
- {[
- '#e6194b',
- '#3cb44b',
- '#ffe119',
- '#0560FF',
- '#f58231',
- '#911eb4',
- '#46f0f0',
- '#f032e6',
- '#bcf60c',
- '#fabebe',
- ].map(item => (
- <TouchableOpacity
- key={item}
- onPress={() => {
- changeAccentColor(item);
-
- FastStorage.setItem('accentColor', item);
- }}
- style={{
- flexDirection: 'row',
- justifyContent: 'flex-start',
- alignItems: 'center',
- marginRight: 10,
- marginVertical: 5,
- }}>
- <View
- style={{
- width: 45,
- height: 45,
- backgroundColor: item,
- borderRadius: 100,
- justifyContent: 'center',
- alignItems: 'center',
- }}>
- {colors.accent === item ? (
- <Icon size={SIZE.lg} color="white" name="check" />
- ) : null}
- </View>
- </TouchableOpacity>
- ))}
- </ScrollView>
- <TouchableOpacity
- onPress={() => {
- if (!colors.night) {
- FastStorage.setItem(
- 'theme',
- JSON.stringify({night: true}),
- );
- changeColorScheme(COLOR_SCHEME_DARK);
- } else {
- FastStorage.setItem(
- 'theme',
- JSON.stringify({night: false}),
- );
-
- changeColorScheme(COLOR_SCHEME_LIGHT);
- }
- }}
- activeOpacity={opacity}
- style={{
- width: '85%',
- marginHorizontal: '5%',
- paddingVertical: pv + 10,
- flexDirection: 'row',
- alignItems: 'center',
- justifyContent: 'space-between',
- }}>
- <Text
- style={{
- fontSize: SIZE.sm + 1,
- fontFamily: WEIGHT.regular,
- textAlignVertical: 'center',
- color: colors.pri,
- }}>
- Dark Mode
- </Text>
- <Icon
- size={SIZE.md}
- color={colors.night ? colors.accent : colors.icon}
- name={colors.night ? 'toggle-right' : 'toggle-left'}
- />
- </TouchableOpacity>
- </View>
- ),
+ name: 'Appearance',
+ func: () => {
+ NavigationService.navigate('AppearanceSettings');
+ },
+ },
+ {
+ name: 'Editor',
+ func: () => {
+ NavigationService.navigate('EditorSettings');
+ },
},
{
name: 'Terms of Service',
@@ -188,12 +85,13 @@ export const Settings = ({navigation}) => {
onPress={item.func}
style={{
borderBottomWidth: 1,
- width: item.step ? '85%' : '90%',
- marginHorizontal: '5%',
borderBottomColor: colors.nav,
+ width: item.step ? '85%' : w - 24,
+ marginHorizontal: 12,
+
paddingVertical: pv + 5,
- marginLeft: item.step ? '10%' : '5%',
+ marginLeft: item.step ? '10%' : 12,
}}>
<Text
style={{