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
optimize design for iPad
thewisefarmerre1a74cb6a3c6
diff --git a/apps/mobile/App.js b/apps/mobile/App.jsindex d914fd4a4..fe3cdc5df 100644--- a/apps/mobile/App.js+++ b/apps/mobile/App.js@@ -15,9 +15,12 @@ import Icon from 'react-native-vector-icons/Ionicons';import ActionButton from 'react-native-action-button';import Storage from 'notes-core/api/database';import StorageInterface from './src/utils/storage';+import {RenderSideMenu} from './src/views/Home';+import * as Animatable from 'react-native-animatable';const App = () => {const [colors, setColors] = useState(COLOR_SCHEME);const [fab, setFab] = useState(true);+ const [sidebar, setSidebar] = useState('30%');useEffect(() => {DeviceEventEmitter.addListener('hide', () => {@@ -26,6 +29,13 @@ const App = () => {DeviceEventEmitter.addListener('show', () => {setFab(true);});+ DeviceEventEmitter.addListener('openSidebar', () => {+ setSidebar('30%');+ });+ DeviceEventEmitter.addListener('closeSidebar', () => {+ setSidebar('0%');+ });+if (Platform.OS === 'android') {StatusBar.setBackgroundColor('transparent');StatusBar.setTranslucent(true);@@ -38,11 +48,40 @@ const App = () => {DeviceEventEmitter.removeListener('show', () => {setFab(true);});+ DeviceEventEmitter.removeListener('openSidebar', () => {+ setSidebar('30%');+ });+ DeviceEventEmitter.removeListener('closeSidebar', () => {+ setSidebar('0%');+ });};- });+ }, []);+return (- <>+ <View+ style={{+ width: '100%',+ height: '100%',+ flexDirection: 'row',+ }}>+ <Animatable.View+ transition="width"+ duration={200}+ style={{+ width: sidebar,+ }}>+ <RenderSideMenu+ colors={colors}+ close={() => {+ setSidebar('0%');+ }}+ />+ </Animatable.View><AppContainer+ style={{+ width: '70%',+ height: '100%',+ }}ref={navigatorRef => {NavigationService.setTopLevelNavigator(navigatorRef);}}@@ -58,7 +97,9 @@ const App = () => {}}title=""hideShadow={true}- onPress={() => NavigationService.navigate('Editor')}>+ onPress={() => {+ NavigationService.navigate('Editor');+ }}><Iconname="md-create"style={{@@ -92,7 +133,7 @@ const App = () => {) : (undefined)}- </>+ </View>);};diff --git a/apps/mobile/ios/Notes.xcodeproj/project.pbxproj b/apps/mobile/ios/Notes.xcodeproj/project.pbxprojindex 57d8e615d..122945987 100644--- a/apps/mobile/ios/Notes.xcodeproj/project.pbxproj+++ b/apps/mobile/ios/Notes.xcodeproj/project.pbxproj@@ -484,9 +484,9 @@"${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Solid.ttf","${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Fontisto.ttf","${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Foundation.ttf",+ "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Ionicons.ttf","${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf","${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/MaterialIcons.ttf",- "${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Octicons.ttf","${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/SimpleLineIcons.ttf","${PODS_ROOT}/../../node_modules/react-native-vector-icons/Fonts/Zocial.ttf",);@@ -741,6 +741,7 @@);PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";PRODUCT_NAME = Notes;+ TARGETED_DEVICE_FAMILY = "1,2";VERSIONING_SYSTEM = "apple-generic";};name = Debug;@@ -760,6 +761,7 @@);PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";PRODUCT_NAME = Notes;+ TARGETED_DEVICE_FAMILY = "1,2";VERSIONING_SYSTEM = "apple-generic";};name = Release;diff --git a/apps/mobile/ios/Notes/Info.plist b/apps/mobile/ios/Notes/Info.plistindex 0e66fcbf1..4af190db7 100644--- a/apps/mobile/ios/Notes/Info.plist+++ b/apps/mobile/ios/Notes/Info.plist@@ -41,6 +41,7 @@<string></string><key>UIAppFonts</key><array>+ <string>Feather.ttf</string><string>Quicksand-SemiBold.ttf</string><string>Quicksand-Medium.ttf</string><string>Ionicons.ttf</string>diff --git a/apps/mobile/src/components/NoteItem/index.js b/apps/mobile/src/components/NoteItem/index.jsindex efeada9cc..7fa1986d7 100644--- a/apps/mobile/src/components/NoteItem/index.js+++ b/apps/mobile/src/components/NoteItem/index.js@@ -7,6 +7,7 @@ import {Dimensions,FlatList,TouchableWithoutFeedback,+ Platform,} from 'react-native';import {@@ -43,6 +44,8 @@ const NoteItem = props => {alignItems: 'center',flexDirection: 'row',padding: pv,+ width: Platform.isPad ? '95%' : '90%',+ alignSelf: 'center',}}><TouchableOpacityactiveOpacity={1}@@ -74,7 +77,7 @@ const NoteItem = props => {}}><Textstyle={{- fontSize: SIZE.xs + 1,+ fontSize: SIZE.xs + 2,color: colors.icon,fontFamily: WEIGHT.regular,width: '100%',@@ -87,7 +90,7 @@ const NoteItem = props => {<Textstyle={{color: colors.accent,- fontSize: SIZE.xxs,+ fontSize: SIZE.xxs + 2,textAlignVertical: 'center',fontFamily: WEIGHT.regular,}}>diff --git a/apps/mobile/src/components/Recents/index.js b/apps/mobile/src/components/Recents/index.jsindex 3b7bbc7bc..ae1c5ccad 100644--- a/apps/mobile/src/components/Recents/index.js+++ b/apps/mobile/src/components/Recents/index.js@@ -6,6 +6,7 @@ import {ScrollView,Dimensions,FlatList,+ Platform,} from 'react-native';import {@@ -25,39 +26,7 @@ import {getElevation} from '../../utils/utils';import NoteItem from '../NoteItem';import NavigationService from '../../services/NavigationService';import {storage} from '../../../App';-const w = Dimensions.get('window').width;-const h = Dimensions.get('window').height;-// example data--const data = [- {- title: 'One day about',- headline: 'Lorem Ipsum Lorem Ipsum has',- timestamp: '2 hours ago',- type: 'note',- },- {- title: 'Shopping List',- headline:- 'It is a long established fact that a reader will be distracted by the readable content of',- timestamp: '5 hours ago',- type: 'list',- },- {- title: 'Reminder',- headline:- 'Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a ',- timestamp: '2 days ago',- type: 'reminder',- },- {- title: 'Writing Notes for',- headline:- 'There are many variations of passages of Lorem Ipsum available, but the majority have ',- timestamp: '2 months ago',- },-];let blockdata = [{name: '',@@ -85,18 +54,16 @@ let blockdata = [export const RecentList = () => {const [colors, setColors] = useState(COLOR_SCHEME);const [notes, setNotes] = useState([]);-const fetchNotes = async () => {- return await storage.getNotes();+ let allNotes = await storage.getNotes();+ console.log(allNotes);+ if (allNotes) {+ setNotes(allNotes);+ }};-useEffect(() => {- fetchNotes().then(allNotes => {- if (allNotes) {- setNotes(allNotes);- }- });- });+ fetchNotes();+ }, []);return (<>@@ -124,7 +91,7 @@ export const RecentList = () => {<ScrollViewhorizontal={true}style={{- paddingHorizontal: '4%',+ paddingHorizontal: '2%',}}showsHorizontalScrollIndicator={false}contentContainerStyle={{@@ -177,7 +144,7 @@ export const RecentList = () => {</ScrollView><TouchableOpacitystyle={{- width: '90%',+ width: Platform.isPad ? '95%' : '90%',alignSelf: 'center',backgroundColor: 'red',padding: pv,diff --git a/apps/mobile/src/components/SearchInput/index.js b/apps/mobile/src/components/SearchInput/index.jsindex 43f740cd3..fde065134 100644--- a/apps/mobile/src/components/SearchInput/index.js+++ b/apps/mobile/src/components/SearchInput/index.js@@ -1,5 +1,5 @@import React, {Fragment, useEffect, useState} from 'react';-import {View, TextInput, Platform} from 'react-native';+import {View, TextInput, Platform, DeviceEventEmitter} from 'react-native';import {COLOR_SCHEME,SIZE,@@ -13,15 +13,16 @@ import {import Icon from 'react-native-vector-icons/Ionicons';import {getElevation} from '../../utils/utils';-export const Search = () => {+export const Search = props => {const [colors, setColors] = useState(COLOR_SCHEME);+return (<Viewstyle={{flexDirection: 'row',justifyContent: 'space-between',alignItems: 'center',- width: '90%',+ width: Platform.isPad ? '95%' : '90%',backgroundColor: '#f0f0f0',alignSelf: 'center',borderRadius: br,@@ -36,12 +37,16 @@ export const Search = () => {width: '90%',fontSize: SIZE.md,}}+ onChangeText={props.onChangeText}+ onSubmitEditing={props.onSubmitEditing}+ onFocus={props.onFocus}+ onBlur={props.onBlur}numberOfLines={1}placeholder="Search your notes"placeholderTextColor={colors.icon}/><Icon- style={{paddingRight: '2.5%'}}+ style={{paddingRight: Platform.isPad ? '1.25%' : '2.5%'}}name="ios-search"color={colors.icon}size={SIZE.xl}diff --git a/apps/mobile/src/components/header/index.js b/apps/mobile/src/components/header/index.jsnew file mode 100644index 000000000..88fb24423--- /dev/null+++ b/apps/mobile/src/components/header/index.js@@ -0,0 +1,41 @@+import React from 'react';+import {View, TouchableOpacity, Platform, Text} from 'react-native';+import Icon from 'react-native-vector-icons/Ionicons';+import {SIZE, WEIGHT} from '../../common/common';+import {h} from '../../utils/utils';++export const Header = ({heading, colors, canGoBack = true}) => {+ return (+ <View+ style={{+ flexDirection: 'row',+ justifyContent: 'flex-start',+ alignItems: 'center',+ paddingHorizontal: Platform.isPad ? '2.5%' : '5%',+ marginTop: Platform.OS == 'ios' ? h * 0.02 : h * 0.04,+ marginBottom: h * 0.04,+ }}>+ {canGoBack ? (+ <TouchableOpacity+ style={{+ paddingRight: 20,+ justifyContent: 'center',+ alignItems: 'center',+ }}>+ <Icon name="ios-arrow-back" size={SIZE.xl} />+ </TouchableOpacity>+ ) : (+ undefined+ )}++ <Text+ style={{+ fontSize: SIZE.xxl,+ color: colors.pri,+ fontFamily: WEIGHT.bold,+ }}>+ {heading}+ </Text>+ </View>+ );+};diff --git a/apps/mobile/src/utils/utils.js b/apps/mobile/src/utils/utils.jsindex 98768febf..0a49dc7f0 100755--- a/apps/mobile/src/utils/utils.js+++ b/apps/mobile/src/utils/utils.js@@ -1,3 +1,4 @@+import {Dimensions} from 'react-native';export const getElevation = elevation => {return {elevation,@@ -34,3 +35,6 @@ export function timeSince(date) {}return Math.floor(seconds) + ' secs ago';}++export const w = Dimensions.get('window').width;+export const h = Dimensions.get('window').height;diff --git a/apps/mobile/src/views/Editor/index.js b/apps/mobile/src/views/Editor/index.jsindex 5a4c79899..2ab95fefd 100755--- a/apps/mobile/src/views/Editor/index.js+++ b/apps/mobile/src/views/Editor/index.js@@ -73,6 +73,7 @@ const Editor = ({navigation}) => {}const saveNote = async () => {+ console.log(await storage.getNotes());if (title || content) {timestamp = await storage.addNote({title,@@ -83,79 +84,81 @@ const Editor = ({navigation}) => {};const _renderWebpage = () => {- <KeyboardAvoidingView- behavior={Platform.OS === 'ios' ? 'padding' : null}- style={{height: '100%'}}>- <View- style={{- height: '100%',- }}>- <TextInput- ref={titleRef}- placeholder="Untitled Note"- placeholderTextColor={colors.icon}+ return (+ <KeyboardAvoidingView+ behavior={Platform.OS === 'ios' ? 'padding' : null}+ style={{height: '100%'}}>+ <Viewstyle={{- width: '100%',- fontFamily: WEIGHT.bold,- fontSize: SIZE.xxl,- paddingHorizontal: '3%',- paddingVertical: 0,- marginTop: Platform.OS == 'ios' ? h * 0.01 : h * 0.04,- }}- onChangeText={value => {- title = value;- }}- onSubmitEditing={async () => await saveNote()}- />-- <WebView- ref={EditorWebView}- onError={error => console.log(error)}- onLoad={() => {- if (navigation.state.params.note) {- let note = navigation.state.params.note;-- post(JSON.stringify(note.content.delta));+ height: '100%',+ }}>+ <TextInput+ ref={titleRef}+ placeholder="Untitled Note"+ placeholderTextColor={colors.icon}+ style={{+ width: '100%',+ fontFamily: WEIGHT.bold,+ fontSize: SIZE.xxl,+ paddingHorizontal: '3%',+ paddingVertical: 0,+ marginTop: Platform.OS == 'ios' ? h * 0.01 : h * 0.04,+ }}+ onChangeText={value => {+ title = value;+ }}+ onSubmitEditing={async () => await saveNote()}+ />++ <WebView+ ref={EditorWebView}+ onError={error => console.log(error)}+ onLoad={() => {+ if (navigation.state.params && navigation.state.params.note) {+ let note = navigation.state.params.note;++ post(JSON.stringify(note.content.delta));+ }+ }}+ javaScriptEnabled+ onShouldStartLoadWithRequest={request => {+ if (request.url.includes('https')) {+ Linking.openURL(request.url);+ return false;+ } else {+ return true;+ }+ }}+ cacheEnabled={true}+ cacheMode="LOAD_CACHE_ELSE_NETWORK"+ domStorageEnabled+ scrollEnabled={false}+ bounces={true}+ scalesPageToFit={true}+ source={+ Platform.OS === 'ios'+ ? require('./web/texteditor.html')+ : {+ uri: 'file:///android_asset/texteditor.html',+ baseUrl: 'baseUrl:"file:///android_asset/',+ }}- }}- javaScriptEnabled- onShouldStartLoadWithRequest={request => {- if (request.url.includes('https')) {- Linking.openURL(request.url);- return false;- } else {- return true;- }- }}- cacheEnabled={true}- cacheMode="LOAD_CACHE_ELSE_NETWORK"- domStorageEnabled- scrollEnabled={false}- bounces={true}- scalesPageToFit={true}- source={- Platform.OS === 'ios'- ? require('./web/texteditor.html')- : {- uri: 'file:///android_asset/texteditor.html',- baseUrl: 'baseUrl:"file:///android_asset/',- }- }- style={{height: '100%', maxHeight: '100%'}}- onMessage={evt => {- if (evt.nativeEvent.data !== '') {- onChange(evt.nativeEvent.data);- }- }}- />- </View>- </KeyboardAvoidingView>;+ style={{height: '100%', maxHeight: '100%'}}+ onMessage={evt => {+ if (evt.nativeEvent.data !== '') {+ onChange(evt.nativeEvent.data);+ }+ }}+ />+ </View>+ </KeyboardAvoidingView>+ );};// EFFECTSuseEffect(() => {- if (navigation.state.params.note) {+ if (navigation.state.params && navigation.state.params.note) {let note = navigation.state.params.note;titleRef.current.setNativeProps({text: note.title,@@ -163,7 +166,7 @@ const Editor = ({navigation}) => {title = note.title;timestamp = note.dateCreated;}- });+ }, []);useEffect(() => {keyboardDidShowListener = Keyboard.addListener(@@ -178,7 +181,7 @@ const Editor = ({navigation}) => {keyboardDidShowListener.remove();keyboardDidHideListener.remove();};- });+ }, []);useEffect(() => {updateInterval = setInterval(async function() {@@ -189,7 +192,7 @@ const Editor = ({navigation}) => {clearInterval(updateInterval);updateInterval = null;};- });+ }, []);useEffect(() => {DeviceEventEmitter.emit('hide');@@ -197,22 +200,27 @@ const Editor = ({navigation}) => {return () => {DeviceEventEmitter.emit('show');};- });+ }, []);++ useEffect(() => {+ DeviceEventEmitter.emit('closeSidebar');+ return () => {+ DeviceEventEmitter.emit('openSidebar');+ };+ }, []);return (- <SafeAreaView style={{height: '100%'}}>- <NavigationEvents- onWillFocus={() => {- DeviceEventEmitter.emit('hide');- }}- />- {_renderWebpage()}- </SafeAreaView>+ <SafeAreaView style={{height: '100%'}}>{_renderWebpage()}</SafeAreaView>);};Editor.navigationOptions = {header: null,+ headerStyle: {+ backgroundColor: 'transparent',+ borderBottomWidth: 0,+ height: 0,+ },};export default Editor;diff --git a/apps/mobile/src/views/Folders/index.js b/apps/mobile/src/views/Folders/index.jsindex f1cd4e1c4..3ea19d820 100644--- a/apps/mobile/src/views/Folders/index.js+++ b/apps/mobile/src/views/Folders/index.js@@ -23,12 +23,9 @@ import {import Icon from 'react-native-vector-icons/Ionicons';import {Reminder} from '../../components/Reminder';import {ListItem} from '../../components/ListItem';-import {getElevation} from '../../utils/utils';+import {getElevation, h, w} from '../../utils/utils';import {FlatList} from 'react-native-gesture-handler';-const w = Dimensions.get('window').width;-const h = Dimensions.get('window').height;-export const Folders = ({navigation}) => {const [colors, setColors] = useState(COLOR_SCHEME);@@ -83,8 +80,8 @@ export const Folders = ({navigation}) => {<Viewstyle={{...getElevation(5),- width: w * 0.4,- height: w * 0.3,+ width: w * 0.7 * 0.4,+ height: w * 0.7 * 0.3,borderRadius: 5,backgroundColor: colors.accent,alignItems: 'flex-end',@@ -106,7 +103,7 @@ export const Folders = ({navigation}) => {fontFamily: WEIGHT.bold,fontSize: SIZE.md,color: colors.pri,- maxWidth: w * 0.4,+ maxWidth: w * 0.7 * 0.4,}}>{item.name}</Text>diff --git a/apps/mobile/src/views/ForgotPassword/index.js b/apps/mobile/src/views/ForgotPassword/index.jsindex 48703746e..e9a458004 100644--- a/apps/mobile/src/views/ForgotPassword/index.js+++ b/apps/mobile/src/views/ForgotPassword/index.js@@ -27,9 +27,7 @@ import {ListItem} from '../../components/ListItem';import {getElevation} from '../../utils/utils';import {FlatList, TextInput} from 'react-native-gesture-handler';import {NavigationEvents} from 'react-navigation';--const w = Dimensions.get('window').width;-const h = Dimensions.get('window').height;+import {Header} from '../../components/header';export const ForgotPassword = ({navigation}) => {const [colors, setColors] = useState(COLOR_SCHEME);@@ -39,7 +37,7 @@ export const ForgotPassword = ({navigation}) => {return () => {DeviceEventEmitter.emit('show');};- });+ }, []);return (<SafeAreaView>@@ -48,74 +46,16 @@ export const ForgotPassword = ({navigation}) => {DeviceEventEmitter.emit('hide');}}/>- <View- style={{- flexDirection: 'row',- justifyContent: 'flex-start',- alignItems: 'center',- paddingHorizontal: '5%',- marginTop: Platform.OS == 'ios' ? h * 0.02 : h * 0.04,- marginBottom: h * 0.04,- }}>- <TouchableOpacity- style={{- paddingRight: 20,- justifyContent: 'center',- alignItems: 'center',- }}>- <Icon name="ios-arrow-back" size={SIZE.xl} />- </TouchableOpacity>- <Text- style={{- fontSize: SIZE.xxl,- color: colors.pri,- fontFamily: WEIGHT.bold,- }}>- Recover Password- </Text>- </View>+ <Header colors={colors} heading={'Recover Password'} /><Viewstyle={{- justifyContent: 'space-between',- height: '80%',+ justifyContent: 'center',+ alignItems: 'center',+ width: '100%',}}>- <View>- <TextInput- style={{- padding: pv,- backgroundColor: colors.navbg,- marginHorizontal: '5%',- borderRadius: 5,- fontSize: SIZE.md,- fontFamily: WEIGHT.regular,- marginBottom: 20,- }}- placeholder="Email"- placeholderTextColor={colors.icon}- />-- <TouchableOpacity- activeOpacity={opacity}- style={{- padding: pv,- backgroundColor: colors.accent,- borderRadius: 5,- marginHorizontal: '5%',- marginBottom: 10,- alignItems: 'center',- }}>- <Text- style={{- fontSize: SIZE.md,- fontFamily: WEIGHT.medium,- color: 'white',- }}>- Recover- </Text>- </TouchableOpacity>- </View>+ {renderForgotPassword(colors)}</View></SafeAreaView>);@@ -126,3 +66,51 @@ ForgotPassword.navigationOptions = {};export default ForgotPassword;++const renderForgotPassword = colors => {+ return (+ <View+ style={{+ justifyContent: Platform.isPad ? 'center' : 'space-between',+ height: '80%',+ width: Platform.isPad ? '60%' : '100%',+ alignSelf: 'center',+ }}>+ <View>+ <TextInput+ style={{+ padding: pv,+ backgroundColor: colors.navbg,+ marginHorizontal: '5%',+ borderRadius: 5,+ fontSize: SIZE.md,+ fontFamily: WEIGHT.regular,+ marginBottom: 20,+ }}+ placeholder="Email"+ placeholderTextColor={colors.icon}+ />++ <TouchableOpacity+ activeOpacity={opacity}+ style={{+ padding: pv,+ backgroundColor: colors.accent,+ borderRadius: 5,+ marginHorizontal: '5%',+ marginBottom: 10,+ alignItems: 'center',+ }}>+ <Text+ style={{+ fontSize: SIZE.md,+ fontFamily: WEIGHT.medium,+ color: 'white',+ }}>+ Recover+ </Text>+ </TouchableOpacity>+ </View>+ </View>+ );+};diff --git a/apps/mobile/src/views/Home/index.js b/apps/mobile/src/views/Home/index.jsindex 1f8e1e6de..4cb6ace03 100755--- a/apps/mobile/src/views/Home/index.js+++ b/apps/mobile/src/views/Home/index.js@@ -9,8 +9,9 @@ import {SafeAreaView,Platform,FlatList,+ DeviceEventEmitter,} from 'react-native';-import NavigationService from '../../services/NavigationService';+import NavigationService, {HomeNav} from '../../services/NavigationService';import {COLOR_SCHEME,SIZE,@@ -24,38 +25,121 @@ import {import SideMenu from 'react-native-side-menu';import {styles} from './styles';-import Icon from 'react-native-vector-icons/Ionicons';+import Icon from 'react-native-vector-icons/Feather';import {Search} from '../../components/SearchInput';import {Reminder} from '../../components/Reminder';import {RecentList} from '../../components/Recents';-import {getElevation} from '../../utils/utils';-const w = Dimensions.get('window').width;-const h = Dimensions.get('window').height;+import {getElevation, w, h} from '../../utils/utils';+import {Header} from '../../components/header';+import {tsPropertySignature} from '@babel/types';+import {NavigationEvents} from 'react-navigation';export const Home = ({navigation}) => {const [loading, setLoading] = useState(true);const [colors, setColors] = useState(COLOR_SCHEME);const [isOpen, setOpen] = useState(false);- const RenderSideMenu = (- <SafeAreaView- style={{- height: '100%',- justifyContent: 'center',- }}>+ const [hidden, setHidden] = useState(false);++ let text = null;++ useEffect(() => {+ setTimeout(() => {+ setLoading(false);+ }, 1000);+ }, []);++ const onChangeText = value => {+ text = value;+ if (value.length > 2) {+ setHidden(true);+ }+ };+ const onSubmitEditing = () => {+ if (!text || text.length < 2) {+ setHidden(false);+ }+ };++ const onBlur = () => {+ if (text && text.length < 2) {+ setHidden(false);+ }+ };++ const onFocus = () => {};++ return Platform.isPad ? (+ <SafeAreaView style={[styles.container]}>+ <NavigationEvents+ onWillFocus={() => {+ DeviceEventEmitter.emit('openSidebar');+ }}+ />+ <Header colors={colors} heading="Home" canGoBack={false} />++ <Search+ onChangeText={onChangeText}+ onSubmitEditing={onSubmitEditing}+ onBlur={onBlur}+ onFocus={onFocus}+ />++ {hidden ? null : <RecentList />}+ </SafeAreaView>+ ) : (+ <SideMenu+ isOpen={isOpen}+ bounceBackOnOverdraw={false}+ onChange={args => {+ setOpen(args);+ }}+ menu={RenderSideMenu(colors, () => setOpen(false))}+ openMenuOffset={w / 1.5}>+ <SafeAreaView style={styles.container}>+ <Header colors={colors} heading="Home" canGoBack={false} />++ <Search+ onChangeText={onChangeText}+ onSubmitEditing={onSubmitEditing}+ onBlur={onBlur}+ onFocus={onFocus}+ />++ {hidden ? null : <RecentList />}+ </SafeAreaView>+ </SideMenu>+ );+};++Home.navigationOptions = {+ header: null,+};++export default Home;++export const RenderSideMenu = ({colors, close}) => (+ <SafeAreaView+ style={{+ height: '100%',+ justifyContent: 'space-between',+ }}>+ <View><Viewstyle={{width: '100%',- justifyContent: 'flex-start',+ justifyContent: 'space-between',paddingHorizontal: '5%',alignItems: 'center',alignSelf: 'center',backgroundColor: 'white',- marginBottom: 20,+ marginBottom: 10,+ marginTop: Platform.OS == 'ios' ? h * 0.01 : h * 0.04,+ flexDirection: 'row',}}><Imagestyle={{- width: 80,- height: 80,+ width: 35,+ height: 35,borderRadius: 100,marginRight: 10,}}@@ -64,6 +148,8 @@ export const Home = ({navigation}) => {<TouchableOpacityonPress={() => {+ close();+NavigationService.navigate('Login');}}activeOpacity={opacity}@@ -73,7 +159,6 @@ export const Home = ({navigation}) => {borderRadius: 5,justifyContent: 'center',alignItems: 'center',- marginTop: 20,borderColor: colors.accent,backgroundColor: colors.bg,borderWidth: 1,@@ -88,96 +173,115 @@ export const Home = ({navigation}) => {</TouchableOpacity>{/* <Text- style={{- fontFamily: WEIGHT.semibold,- color: colors.accent,- fontSize: SIZE.md,- marginTop: 10,- }}>- Hi, Ammar!- </Text>+ style={{+ fontFamily: WEIGHT.semibold,+ color: colors.accent,+ fontSize: SIZE.md,+ marginTop: 10,+ }}>+ Hi, Ammar!+ </Text>- <Text- style={{- fontFamily: WEIGHT.regular,- color: colors.accent,- fontSize: SIZE.xs,- marginTop: 10,- }}>- 80.45/100 MB- </Text> */}+ <Text+ style={{+ fontFamily: WEIGHT.regular,+ color: colors.accent,+ fontSize: SIZE.xs,+ marginTop: 10,+ }}>+ 80.45/100 MB+ </Text> */}{/* <View+ style={{+ borderRadius: 2.5,+ backgroundColor: colors.accent,+ marginTop: 10,+ paddingHorizontal: 5,+ paddingVertical: 2,+ }}>+ <Textstyle={{- borderRadius: 2.5,- backgroundColor: colors.accent,- marginTop: 10,- paddingHorizontal: 5,- paddingVertical: 2,+ fontFamily: WEIGHT.bold,+ fontSize: SIZE.xxs,+ color: 'white',}}>- <Text- style={{- fontFamily: WEIGHT.bold,- fontSize: SIZE.xxs,- color: 'white',- }}>- Basic User- </Text>- </View> */}+ Basic User+ </Text>+ </View> */}</View>-<Viewstyle={{+ borderWidth: 1,+ borderColor: colors.navbg,+ height: 2,+ backgroundColor: colors.navbg,width: '100%',- alignSelf: 'center',- height: '60%',- marginVertical: 10,- borderRadius: 5,- }}>- <FlatList- data={[- {- name: 'Home',- icon: 'ios-home',- func: () => NavigationService.navigate('Home'),- },- {- name: 'Favorites',- icon: 'md-star',- func: () => NavigationService.navigate('Favorites'),- },- {- name: 'Notebooks',- icon: 'md-folder',- func: () => NavigationService.navigate('Folders'),- },- {- name: 'Tags',- icon: 'md-folder',- func: () => {},- },- {- name: 'Colors',- icon: 'md-folder',- func: () => {},- },- ]}- keyExtractor={(item, index) => item.name}- renderItem={({item, index}) => (- <TouchableOpacity- activeOpacity={opacity}- onPress={() => {- item.func();- setOpen(false);- }}+ marginBottom: 5,+ }}+ />+ <FlatList+ data={[+ {+ name: 'Home',+ icon: 'home',+ func: () => NavigationService.navigate('Home'),+ },++ {+ name: 'Notebooks',+ icon: 'book',+ func: () => NavigationService.navigate('Folders'),+ },+ {+ name: 'Lists',+ icon: 'list',+ func: () => NavigationService.navigate('Favorites'),+ },+ {+ name: 'Favorites',+ icon: 'star',+ func: () => NavigationService.navigate('Favorites'),+ },++ {+ name: 'Dark Mode',+ icon: 'moon',+ func: () => NavigationService.navigate('Folders'),+ switch: true,+ on: false,+ },+ {+ name: 'Trash',+ icon: 'trash',+ func: () => NavigationService.navigate('Folders'),+ },+ {+ name: 'Settings',+ icon: 'settings',+ func: () => NavigationService.navigate('Folders'),+ },+ ]}+ keyExtractor={(item, index) => item.name}+ renderItem={({item, index}) => (+ <TouchableOpacity+ activeOpacity={opacity}+ onPress={() => {+ item.func();+ }}+ style={{+ width: '100%',+ alignSelf: 'center',+ flexDirection: 'row',+ justifyContent: 'space-between',+ alignItems: 'center',+ paddingHorizontal: ph,+ paddingVertical: 10,+ }}>+ <Viewstyle={{- width: '100%',- alignSelf: 'center',flexDirection: 'row',- justifyContent: 'flex-start',alignItems: 'center',- paddingHorizontal: ph,- marginVertical: 10,}}><Iconstyle={{@@ -191,14 +295,157 @@ export const Home = ({navigation}) => {style={{fontFamily: WEIGHT.medium,fontSize: SIZE.sm,- marginTop: -5,}}>{item.name}</Text>+ </View>+ {item.switch ? (+ <Icon+ size={SIZE.lg}+ color={item.on ? colors.accent : colors.icon}+ name={item.on ? 'toggle-right' : 'toggle-left'}+ />+ ) : (+ undefined+ )}+ </TouchableOpacity>+ )}+ />+ </View>++ <View>+ <View+ style={{+ width: '100%',+ alignSelf: 'center',+ flexDirection: 'row',+ justifyContent: 'flex-start',+ alignItems: 'center',+ paddingHorizontal: ph,+ marginTop: 20,+ }}>+ <Icon+ style={{+ width: 30,+ }}+ name="tag"+ color={colors.icon}+ size={SIZE.md}+ />+ <Text+ style={{+ fontFamily: WEIGHT.medium,+ fontSize: SIZE.sm,+ marginTop: -5,+ }}>+ Tags+ </Text>+ </View>++ <View+ style={{+ borderWidth: 1,+ borderColor: colors.navbg,+ height: 2,+ backgroundColor: colors.navbg,+ width: '100%',+ marginBottom: 5,+ }}+ />+ <ScrollView+ contentContainerStyle={{+ flexDirection: 'row',+ flexWrap: 'wrap',+ paddingHorizontal: '5%',+ marginBottom: 20,+ }}>+ {['home', 'office', 'work', 'book_notes', 'poem', 'lists', 'water'].map(+ item => (+ <TouchableOpacity+ style={{+ flexDirection: 'row',+ justifyContent: 'flex-start',+ alignItems: 'center',+ margin: 5,+ }}>+ <Text+ style={{+ fontFamily: WEIGHT.medium,+ fontSize: SIZE.sm,+ color: colors.icon,+ }}>+ #{item}+ </Text></TouchableOpacity>- )}+ ),+ )}+ </ScrollView>++ <View+ style={{+ width: '100%',+ alignSelf: 'center',+ flexDirection: 'row',+ justifyContent: 'flex-start',+ alignItems: 'center',+ paddingHorizontal: ph,+ marginTop: 20,+ }}>+ <Icon+ style={{+ width: 30,+ }}+ name="circle"+ color={colors.icon}+ size={SIZE.md}/>+ <Text+ style={{+ fontFamily: WEIGHT.medium,+ fontSize: SIZE.sm,+ marginTop: -5,+ }}>+ Colors+ </Text></View>+ <View+ style={{+ borderWidth: 1,+ borderColor: colors.navbg,+ height: 2,+ backgroundColor: colors.navbg,+ width: '100%',+ marginBottom: 5,+ }}+ />+ <ScrollView+ contentContainerStyle={{+ flexDirection: 'row',+ flexWrap: 'wrap',+ paddingHorizontal: '5%',+ marginBottom: 40,+ }}>+ {['red', 'yellow', 'green', 'blue', 'purple', 'orange', 'gray'].map(+ item => (+ <TouchableOpacity+ style={{+ flexDirection: 'row',+ justifyContent: 'flex-start',+ alignItems: 'center',+ margin: 5,+ }}>+ <View+ style={{+ width: 40,+ height: 25,+ backgroundColor: item,+ borderRadius: 5,+ }}+ />+ </TouchableOpacity>+ ),+ )}+ </ScrollView><Viewstyle={{@@ -209,7 +456,7 @@ export const Home = ({navigation}) => {flexDirection: 'row',justifyContent: 'space-between',alignItems: 'center',- height: '5%',+ height: h * 0.05,paddingHorizontal: ph,marginVertical: 10,}}>@@ -229,57 +476,9 @@ export const Home = ({navigation}) => {paddingVertical: pv - 8,borderRadius: 5,}}>- <Icon name="ios-star" color="#FCBA04" size={SIZE.lg} />+ <Icon name="star" color="#FCBA04" size={SIZE.lg} /></View></View>- </SafeAreaView>- );-- useEffect(() => {- setTimeout(() => {- setLoading(false);- }, 1000);- });-- return (- <SideMenu- isOpen={isOpen}- bounceBackOnOverdraw={false}- onChange={args => {- setOpen(args);- }}- menu={RenderSideMenu}- openMenuOffset={w / 1.5}>- <SafeAreaView style={styles.container}>- <View- style={{- flexDirection: 'row',- justifyContent: 'space-between',- alignItems: 'center',- paddingHorizontal: '5%',- marginTop: Platform.OS == 'ios' ? h * 0.01 : h * 0.04,- marginBottom: h * 0.04,- }}>- <Text- style={{- fontSize: SIZE.xxl,- color: colors.pri,- fontFamily: WEIGHT.bold,- }}>- Notes- </Text>- <Icon name="md-more" color={colors.icon} size={SIZE.xxl} />- </View>-- <Search />- <RecentList />- </SafeAreaView>- </SideMenu>- );-};--Home.navigationOptions = {- header: null,-};--export default Home;+ </View>+ </SafeAreaView>+);diff --git a/apps/mobile/src/views/Login/index.js b/apps/mobile/src/views/Login/index.jsindex 01e3bd42b..dd4f5d415 100644--- a/apps/mobile/src/views/Login/index.js+++ b/apps/mobile/src/views/Login/index.js@@ -27,9 +27,7 @@ import {ListItem} from '../../components/ListItem';import {getElevation} from '../../utils/utils';import {FlatList, TextInput} from 'react-native-gesture-handler';import {NavigationEvents} from 'react-navigation';--const w = Dimensions.get('window').width;-const h = Dimensions.get('window').height;+import {Header} from '../../components/header';export const Login = ({navigation}) => {const [colors, setColors] = useState(COLOR_SCHEME);@@ -39,7 +37,14 @@ export const Login = ({navigation}) => {return () => {DeviceEventEmitter.emit('show');};- });+ }, []);++ useEffect(() => {+ DeviceEventEmitter.emit('closeSidebar');+ return () => {+ DeviceEventEmitter.emit('openSidebar');+ };+ }, []);return (<SafeAreaView>@@ -48,153 +53,150 @@ export const Login = ({navigation}) => {DeviceEventEmitter.emit('hide');}}/>+ <Header colors={colors} heading="Login" />+<Viewstyle={{- flexDirection: 'row',- justifyContent: 'flex-start',+ justifyContent: 'center',alignItems: 'center',- paddingHorizontal: '5%',- marginTop: Platform.OS == 'ios' ? h * 0.02 : h * 0.04,- marginBottom: h * 0.04,+ width: '100%',}}>+ {renderLogin(colors)}+ </View>+ </SafeAreaView>+ );+};++Login.navigationOptions = {+ header: null,+ headerStyle: {+ backgroundColor: 'transparent',+ borderBottomWidth: 0,+ height: 0,+ },+};++export default Login;++const renderLogin = colors => {+ return (+ <View+ style={{+ justifyContent: Platform.isPad ? 'center' : 'space-between',+ height: '80%',+ width: Platform.isPad ? '60%' : '100%',+ alignSelf: 'center',+ }}>+ <View>+ <TextInput+ style={{+ padding: pv,+ backgroundColor: colors.navbg,+ marginHorizontal: '5%',+ borderRadius: 5,+ fontSize: SIZE.md,+ fontFamily: WEIGHT.regular,+ marginBottom: 20,+ }}+ placeholder="Email"+ placeholderTextColor={colors.icon}+ />+ <TextInput+ style={{+ padding: pv,+ backgroundColor: colors.navbg,+ marginHorizontal: '5%',+ borderRadius: 5,+ fontSize: SIZE.md,+ fontFamily: WEIGHT.regular,+ marginBottom: 20,+ }}+ placeholder="Password"+ placeholderTextColor={colors.icon}+ />+<TouchableOpacity+ activeOpacity={opacity}style={{- paddingRight: 20,- justifyContent: 'center',+ padding: pv,+ backgroundColor: colors.accent,+ borderRadius: 5,+ marginHorizontal: '5%',+ marginBottom: 10,alignItems: 'center',}}>- <Icon name="ios-arrow-back" size={SIZE.xl} />+ <Text+ style={{+ fontSize: SIZE.md,+ fontFamily: WEIGHT.medium,+ color: 'white',+ }}>+ Login+ </Text></TouchableOpacity>- <Text++ <TouchableOpacity+ onPress={() => {+ NavigationService.navigate('ForgotPassword');+ }}+ activeOpacity={opacity}style={{- fontSize: SIZE.xxl,- color: colors.pri,- fontFamily: WEIGHT.bold,+ alignItems: 'flex-end',+ marginHorizontal: '5%',}}>- Login- </Text>+ <Text+ style={{+ fontSize: SIZE.sm,+ fontFamily: WEIGHT.regular,+ color: colors.accent,+ }}>+ Forgot password?+ </Text>+ </TouchableOpacity></View><Viewstyle={{- justifyContent: 'space-between',- height: '80%',+ width: '100%',+ position: Platform.isPad ? 'absolute' : 'relative',+ bottom: '0%',}}>- <View>- <TextInput- style={{- padding: pv,- backgroundColor: colors.navbg,- marginHorizontal: '5%',- borderRadius: 5,- fontSize: SIZE.md,- fontFamily: WEIGHT.regular,- marginBottom: 20,- }}- placeholder="Email"- placeholderTextColor={colors.icon}- />- <TextInput+ <TouchableOpacity+ activeOpacity={opacity}+ style={{+ alignItems: 'center',+ width: '100%',+ marginBottom: 20,+ }}>+ <Textstyle={{- padding: pv,- backgroundColor: colors.navbg,- marginHorizontal: '5%',- borderRadius: 5,fontSize: SIZE.md,fontFamily: WEIGHT.regular,- marginBottom: 20,- }}- placeholder="Password"- placeholderTextColor={colors.icon}- />-- <TouchableOpacity- activeOpacity={opacity}- style={{- padding: pv,- backgroundColor: colors.accent,- borderRadius: 5,- marginHorizontal: '5%',- marginBottom: 10,- alignItems: 'center',- }}>- <Text- style={{- fontSize: SIZE.md,- fontFamily: WEIGHT.medium,- color: 'white',- }}>- Login- </Text>- </TouchableOpacity>-- <TouchableOpacity- onPress={() => {- NavigationService.navigate('ForgotPassword');- }}- activeOpacity={opacity}- style={{- alignItems: 'flex-end',- marginHorizontal: '5%',+ color: colors.accent,}}>- <Text- style={{- fontSize: SIZE.sm,- fontFamily: WEIGHT.regular,- color: colors.accent,- }}>- Forgot password?- </Text>- </TouchableOpacity>- </View>+ Login with G+ </Text>+ </TouchableOpacity>- <View+ <TouchableOpacity+ onPress={() => {+ NavigationService.navigate('Signup');+ }}+ activeOpacity={opacity}style={{+ alignItems: 'center',width: '100%',}}>- <TouchableOpacity- activeOpacity={opacity}+ <Textstyle={{- alignItems: 'center',- width: '100%',- marginBottom: 20,+ fontSize: SIZE.sm,+ fontFamily: WEIGHT.bold,+ color: colors.accent,}}>- <Text- style={{- fontSize: SIZE.md,- fontFamily: WEIGHT.regular,- color: colors.accent,- }}>- Login with G- </Text>- </TouchableOpacity>-- <TouchableOpacity- onPress={() => {- NavigationService.navigate('Signup');- }}- activeOpacity={opacity}- style={{- alignItems: 'center',- width: '100%',- }}>- <Text- style={{- fontSize: SIZE.sm,- fontFamily: WEIGHT.bold,- color: colors.accent,- }}>- Create a New Account- </Text>- </TouchableOpacity>- </View>+ Create a New Account+ </Text>+ </TouchableOpacity></View>- </SafeAreaView>+ </View>);};--Login.navigationOptions = {- header: null,-};--export default Login;diff --git a/apps/mobile/src/views/Signup/index.js b/apps/mobile/src/views/Signup/index.jsindex 4a1a6a259..b05a9c5d3 100644--- a/apps/mobile/src/views/Signup/index.js+++ b/apps/mobile/src/views/Signup/index.js@@ -27,9 +27,7 @@ import {ListItem} from '../../components/ListItem';import {getElevation} from '../../utils/utils';import {FlatList, TextInput} from 'react-native-gesture-handler';import {NavigationEvents} from 'react-navigation';--const w = Dimensions.get('window').width;-const h = Dimensions.get('window').height;+import {Header} from '../../components/header';export const Signup = ({navigation}) => {const [colors, setColors] = useState(COLOR_SCHEME);@@ -39,7 +37,7 @@ export const Signup = ({navigation}) => {return () => {DeviceEventEmitter.emit('show');};- });+ }, []);return (<SafeAreaView>@@ -48,116 +46,107 @@ export const Signup = ({navigation}) => {DeviceEventEmitter.emit('hide');}}/>+ <Header colors={colors} heading="Create Account" />+<Viewstyle={{- flexDirection: 'row',- justifyContent: 'flex-start',+ justifyContent: 'center',alignItems: 'center',- paddingHorizontal: '5%',- marginTop: Platform.OS == 'ios' ? h * 0.02 : h * 0.04,- marginBottom: h * 0.04,+ width: '100%',}}>+ {renderSignup(colors)}+ </View>+ </SafeAreaView>+ );+};++Signup.navigationOptions = {+ header: null,+};++export default Signup;++const renderSignup = colors => {+ return (+ <View+ style={{+ justifyContent: Platform.isPad ? 'center' : 'space-between',+ height: '80%',+ width: Platform.isPad ? '60%' : '100%',+ alignSelf: 'center',+ }}>+ <View>+ <TextInput+ style={{+ padding: pv,+ backgroundColor: colors.navbg,+ marginHorizontal: '5%',+ borderRadius: 5,+ fontSize: SIZE.md,+ fontFamily: WEIGHT.regular,+ marginBottom: 20,+ }}+ placeholder="Email"+ placeholderTextColor={colors.icon}+ />+ <TextInput+ style={{+ padding: pv,+ backgroundColor: colors.navbg,+ marginHorizontal: '5%',+ borderRadius: 5,+ fontSize: SIZE.md,+ fontFamily: WEIGHT.regular,+ marginBottom: 20,+ }}+ placeholder="Password"+ placeholderTextColor={colors.icon}+ />+<TouchableOpacity+ activeOpacity={opacity}style={{- paddingRight: 20,- justifyContent: 'center',+ padding: pv,+ backgroundColor: colors.accent,+ borderRadius: 5,+ marginHorizontal: '5%',+ marginBottom: 10,alignItems: 'center',}}>- <Icon name="ios-arrow-back" size={SIZE.xl} />+ <Text+ style={{+ fontSize: SIZE.md,+ fontFamily: WEIGHT.medium,+ color: 'white',+ }}>+ Signup+ </Text></TouchableOpacity>-- <Text- style={{- fontSize: SIZE.xxl,- color: colors.pri,- fontFamily: WEIGHT.bold,- }}>- Create Account- </Text></View><Viewstyle={{- justifyContent: 'space-between',- height: '80%',+ width: '100%',+ position: Platform.isPad ? 'absolute' : 'relative',+ bottom: '0%',}}>- <View>- <TextInput- style={{- padding: pv,- backgroundColor: colors.navbg,- marginHorizontal: '5%',- borderRadius: 5,- fontSize: SIZE.md,- fontFamily: WEIGHT.regular,- marginBottom: 20,- }}- placeholder="Email"- placeholderTextColor={colors.icon}- />- <TextInput- style={{- padding: pv,- backgroundColor: colors.navbg,- marginHorizontal: '5%',- borderRadius: 5,- fontSize: SIZE.md,- fontFamily: WEIGHT.regular,- marginBottom: 20,- }}- placeholder="Password"- placeholderTextColor={colors.icon}- />-- <TouchableOpacity- activeOpacity={opacity}- style={{- padding: pv,- backgroundColor: colors.accent,- borderRadius: 5,- marginHorizontal: '5%',- marginBottom: 10,- alignItems: 'center',- }}>- <Text- style={{- fontSize: SIZE.md,- fontFamily: WEIGHT.medium,- color: 'white',- }}>- Signup- </Text>- </TouchableOpacity>- </View>-- <View+ <TouchableOpacity+ activeOpacity={opacity}style={{+ alignItems: 'center',width: '100%',+ marginBottom: 20,}}>- <TouchableOpacity- activeOpacity={opacity}+ <Textstyle={{- alignItems: 'center',- width: '100%',- marginBottom: 20,+ fontSize: SIZE.md,+ fontFamily: WEIGHT.regular,+ color: colors.accent,}}>- <Text- style={{- fontSize: SIZE.md,- fontFamily: WEIGHT.regular,- color: colors.accent,- }}>- Signup with G- </Text>- </TouchableOpacity>- </View>+ Signup with G+ </Text>+ </TouchableOpacity></View>- </SafeAreaView>+ </View>);};--Signup.navigationOptions = {- header: null,-};--export default Signup;