Skip to content

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

ui: improvements

ammarahm-ed4f191a8c6b3a
diff --git a/apps/mobile/src/components/AddNotebookDialog/index.js b/apps/mobile/src/components/AddNotebookDialog/index.js
index 8b0c7b5e1..b0c5cf4d7 100644
--- a/apps/mobile/src/components/AddNotebookDialog/index.js
+++ b/apps/mobile/src/components/AddNotebookDialog/index.js
@@ -245,6 +245,7 @@ export class AddNotebookDialog extends React.Component {
paddingHorizontal: ph,
borderRadius: 5,
fontSize: SIZE.sm,
+ height: 35,
fontFamily: WEIGHT.regular,
color: colors.pri,
marginTop: 20,
@@ -274,6 +275,7 @@ export class AddNotebookDialog extends React.Component {
borderColor: descFocused ? colors.accent : colors.nav,
paddingHorizontal: ph,
borderRadius: 5,
+ height: 35,
fontSize: SIZE.sm,
fontFamily: WEIGHT.regular,
color: colors.pri,
@@ -335,6 +337,7 @@ export class AddNotebookDialog extends React.Component {
paddingHorizontal: 0,
borderRadius: 5,
borderWidth: 1.5,
+ height: 35,
fontSize: SIZE.sm,
borderColor: topicInputFoused ? colors.accent : colors.nav,
fontFamily: WEIGHT.regular,
@@ -352,11 +355,10 @@ export class AddNotebookDialog extends React.Component {
justifyContent: 'center',
alignItems: 'center',
borderWidth: 1.5,
-
borderColor: topicInputFoused ? colors.accent : colors.nav,
borderRadius: 5,
- width: 40,
- height: 40,
+ width: '12%',
+ height: 35,
}}>
<Icon
name="plus"
diff --git a/apps/mobile/src/components/Container/index.js b/apps/mobile/src/components/Container/index.js
index edaf80933..75a3f3aff 100644
--- a/apps/mobile/src/components/Container/index.js
+++ b/apps/mobile/src/components/Container/index.js
@@ -13,6 +13,7 @@ import Icon from 'react-native-vector-icons/Feather';
import {br, opacity, pv, SIZE, WEIGHT} from '../../common/common';
import {useTracked} from '../../provider';
import {getElevation, w} from '../../utils/utils';
+import {DDS} from '../../../App';
export const AnimatedSafeAreaView = Animatable.createAnimatableComponent(
SafeAreaView,
);
@@ -65,6 +66,7 @@ export const Container = ({
duration={300}
style={{
height: '100%',
+
backgroundColor: colors.night ? colors.bg : colors.bg,
}}>
<KeyboardAvoidingView
@@ -76,52 +78,59 @@ export const Container = ({
{children}
{noBottomButton ? null : (
- <AnimatedTouchableOpacity
+ <Animatable.View
transition={['translateY', 'opacity']}
useNativeDriver={true}
duration={250}
- onPress={bottomButtonOnPress}
- activeOpacity={opacity}
style={{
- ...getElevation(5),
- width: '95%',
- alignSelf: 'center',
- borderRadius: br,
- backgroundColor: colors.accent,
- justifyContent: 'center',
- alignItems: 'center',
- marginBottom: 0,
+ width: '100%',
+ opacity: buttonHide ? 0 : 1,
position: 'absolute',
+ paddingHorizontal: 12,
zIndex: 10,
bottom: 10,
- opacity: buttonHide ? 0 : 1,
transform: [
{
translateY: buttonHide ? 200 : 0,
},
],
}}>
- <View
+ <AnimatedTouchableOpacity
+ onPress={bottomButtonOnPress}
+ activeOpacity={opacity}
style={{
- justifyContent: 'flex-start',
- alignItems: 'center',
- flexDirection: 'row',
+ ...getElevation(5),
width: '100%',
- padding: pv,
- paddingVertical: pv + 5,
+
+ alignSelf: 'center',
+ borderRadius: br,
+ backgroundColor: colors.accent,
+ justifyContent: 'center',
+ alignItems: 'center',
+ marginBottom: 0,
}}>
- <Icon name="plus" color="white" size={SIZE.xl} />
- <Text
+ <View
style={{
- fontSize: SIZE.md,
- color: 'white',
- fontFamily: WEIGHT.regular,
- textAlignVertical: 'center',
+ justifyContent: 'flex-start',
+ alignItems: 'center',
+ flexDirection: 'row',
+ width: '100%',
+ padding: pv,
+ paddingVertical: pv + 5,
}}>
- {' ' + bottomButtonText}
- </Text>
- </View>
- </AnimatedTouchableOpacity>
+ <Icon name="plus" color="white" size={SIZE.xl} />
+ <Text
+ style={{
+ fontSize: SIZE.md,
+ color: 'white',
+ fontFamily: WEIGHT.regular,
+ textAlignVertical: 'center',
+ }}>
+ {' ' + bottomButtonText}
+ </Text>
+ </View>
+ </AnimatedTouchableOpacity>
+ </Animatable.View>
)}
</KeyboardAvoidingView>
</AnimatedSafeAreaView>
diff --git a/apps/mobile/src/components/Dialog/index.js b/apps/mobile/src/components/Dialog/index.js
index b1f2fae95..eb059fe52 100644
--- a/apps/mobile/src/components/Dialog/index.js
+++ b/apps/mobile/src/components/Dialog/index.js
@@ -1,7 +1,13 @@
import React, {Component} from 'react';
-import {Modal, Text, TouchableOpacity, View} from 'react-native';
+import {
+ Modal,
+ Text,
+ TouchableOpacity,
+ View,
+ DeviceEventEmitter,
+} from 'react-native';
import Icon from 'react-native-vector-icons/Feather';
-import {db} from '../../../App';
+import {db, DDS} from '../../../App';
import {opacity, ph, pv, SIZE, WEIGHT} from '../../common/common';
import {ACTIONS} from '../../provider';
import NavigationService from '../../services/NavigationService';
@@ -58,6 +64,13 @@ export class Dialog extends Component {
break;
}
+ case dialogActions.ACTION_EXIT_FULLSCREEN: {
+ updateEvent({type: ACTIONS.NOTES});
+ DeviceEventEmitter.emit('closeFullScreenEditor');
+ this.setState({
+ visible: false,
+ });
+ }
}
};
@@ -98,7 +111,7 @@ export class Dialog extends Component {
alignItems: 'center',
}}>
<TouchableOpacity
- onPress={() => close()}
+ onPress={this.hide}
style={{
width: '100%',
height: '100%',
@@ -108,7 +121,7 @@ export class Dialog extends Component {
<View
style={{
...getElevation(5),
- width: '80%',
+ width: DDS.isTab ? '50%' : '80%',
maxHeight: 350,
borderRadius: 5,
backgroundColor: colors.bg,
diff --git a/apps/mobile/src/components/DialogManager/index.js b/apps/mobile/src/components/DialogManager/index.js
index 9dcae8643..91b7210a1 100644
--- a/apps/mobile/src/components/DialogManager/index.js
+++ b/apps/mobile/src/components/DialogManager/index.js
@@ -7,11 +7,20 @@ import {VaultDialog} from '../VaultDialog';
import MoveNoteDialog from '../MoveNoteDialog';
import {AddTopicDialog} from '../AddTopicDialog';
import {AddNotebookDialog} from '../AddNotebookDialog';
+import {DDS} from '../../../App';
+export const _recieveEvent = (eventName, action) => {
+ DeviceEventEmitter.addListener(eventName, action);
+};
+
+export const _unSubscribeEvent = (eventName, action) => {
+ DeviceEventEmitter.removeListener(eventName, action);
+};
export const dialogActions = {
ACTION_DELETE: 511,
ACTION_EXIT: 512,
ACTION_EMPTY_TRASH: 513,
+ ACTION_EXIT_FULLSCREEN: 514,
};
export const ActionSheetEvent = (
@@ -67,14 +76,6 @@ export const updateEvent = data => {
DeviceEventEmitter.emit('updateEvent', data);
};
-export const _recieveEvent = (eventName, action) => {
- DeviceEventEmitter.addListener(eventName, action);
-};
-
-export const _unSubscribeEvent = (eventName, action) => {
- DeviceEventEmitter.removeListener(eventName, action);
-};
-
export const TEMPLATE_DELETE = type => {
return {
title: `Delete ${type}`,
@@ -86,6 +87,17 @@ export const TEMPLATE_DELETE = type => {
};
};
+export const TEMPLATE_EXIT_FULLSCREEN = () => {
+ return {
+ title: `Exit fullscreen editor?`,
+ paragraph: `Are you sure you want to exit fullscreen editor?`,
+ positiveText: 'Exit',
+ negativeText: 'Cancel',
+ action: dialogActions.ACTION_EXIT_FULLSCREEN,
+ icon: 'x',
+ };
+};
+
export const TEMPLATE_EXIT = type => {
return {
title: `Close ${type}`,
@@ -162,7 +174,19 @@ export class DialogManager extends Component {
this.moveNoteDialog.close();
};
+ loadNote = i => {
+ if (i && i.type === 'new') {
+ setNote({});
+ } else {
+ note = i;
+ this.setState({
+ item: i,
+ });
+ }
+ };
+
componentDidMount() {
+ _recieveEvent('loadNoteEvent', this.loadNote);
_recieveEvent('ActionSheetEvent', this._showActionSheet);
_recieveEvent('ActionSheetHideEvent', this._hideActionSheet);
@@ -179,6 +203,8 @@ export class DialogManager extends Component {
_recieveEvent('hideAddTopicEvent', this.hideAddTopic);
}
componentWillUnmount() {
+ _unSubscribeEvent('loadNoteEvent', this.loadNote);
+
_unSubscribeEvent('ActionSheetEvent', this._showActionSheet);
_unSubscribeEvent('ActionSheetHideEvent', this._hideSimpleDialog);
@@ -288,6 +314,8 @@ export class DialogManager extends Component {
ref={ref => (this.actionSheet = ref)}
customStyles={{
backgroundColor: colors.bg,
+ width: DDS.isTab ? '60%' : '100%',
+ alignSelf: 'center',
}}
indicatorColor={colors.shade}
initialOffsetFromBottom={0.5}