1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Mobile: Moved 'New notebook' button to sidebar

This commit is contained in:
Laurent Cozic 2019-06-26 01:10:15 +01:00
parent 9957b2798c
commit 430a11282b
2 changed files with 25 additions and 25 deletions

View File

@ -52,14 +52,6 @@ class ActionButtonComponent extends React.Component {
});
}
newFolder_press() {
this.props.dispatch({
type: 'NAV_GO',
routeName: 'Folder',
folderId: null,
});
}
render() {
let buttons = this.props.buttons ? this.props.buttons : [];
@ -79,13 +71,6 @@ class ActionButtonComponent extends React.Component {
icon: 'md-document',
});
}
buttons.push({
title: _('New notebook'),
onPress: () => { this.newFolder_press() },
color: '#3498db',
icon: 'md-folder',
});
}
let buttonComps = [];

View File

@ -19,12 +19,13 @@ class SideMenuContentComponent extends Component {
constructor() {
super();
this.state = { syncReportText: '',
//width: 0,
this.state = {
syncReportText: '',
};
this.styles_ = {};
this.tagButton_press = this.tagButton_press.bind(this);
this.newFolderButton_press = this.newFolderButton_press.bind(this);
}
styles() {
@ -58,6 +59,10 @@ class SideMenuContentComponent extends Component {
color: theme.colorFaded,
fontSize: theme.fontSizeSmaller,
},
sidebarIcon: {
fontSize: 22,
color: theme.color,
},
};
styles.folderButton = Object.assign({}, styles.button);
@ -102,6 +107,16 @@ class SideMenuContentComponent extends Component {
});
}
newFolderButton_press() {
this.props.dispatch({ type: 'SIDE_MENU_CLOSE' });
this.props.dispatch({
type: 'NAV_GO',
routeName: 'Folder',
folderId: null,
});
}
async synchronize_press() {
const actionDone = await shared.synchronize_press(this);
if (actionDone === 'auth') this.props.dispatch({ type: 'SIDE_MENU_CLOSE' });
@ -149,7 +164,7 @@ class SideMenuContentComponent extends Component {
const theme = themeStyle(this.props.theme);
const title = state == 'sync' ? _('Synchronise') : _('Cancel synchronisation');
const iconComp = state == 'sync' ? <Icon name='md-sync' style={theme.icon} /> : <Icon name='md-close' style={theme.icon} />;
const iconComp = state == 'sync' ? <Icon name='md-sync' style={this.styles().sidebarIcon} /> : <Icon name='md-close' style={this.styles().sidebarIcon} />;
return (
<TouchableOpacity key={'synchronize_button'} onPress={() => { this.synchronize_press() }}>
@ -161,14 +176,14 @@ class SideMenuContentComponent extends Component {
);
}
tagButton() {
renderSideBarButton(key, title, iconName, onPressHandler) {
const theme = themeStyle(this.props.theme);
return (
<TouchableOpacity key={'tag_button'} onPress={this.tagButton_press}>
<TouchableOpacity key={key} onPress={onPressHandler}>
<View style={this.styles().sideButton}>
<Icon name='md-pricetag' style={theme.icon} />
<Text style={this.styles().sideButtonText}>Tags</Text>
<Icon name={iconName} style={this.styles().sidebarIcon} />
<Text style={this.styles().sideButtonText}>{title}</Text>
</View>
</TouchableOpacity>
);
@ -214,10 +229,10 @@ class SideMenuContentComponent extends Component {
}
items.push(this.makeDivider('divider_1'));
items.push(this.tagButton());
items.push(this.makeDivider('divider_tag_bottom'));
items.push(this.renderSideBarButton('newFolder_button', _('New Notebook'), 'md-folder-open', this.newFolderButton_press));
items.push(this.renderSideBarButton('tag_button', _('Tags'), 'md-pricetag', this.tagButton_press));
let lines = Synchronizer.reportToLines(this.props.syncReport);
const syncReportText = lines.join("\n");