mirror of
https://github.com/laurent22/joplin.git
synced 2025-05-31 22:29:43 +02:00
Mobile: Moved 'New notebook' button to sidebar
This commit is contained in:
parent
9957b2798c
commit
430a11282b
@ -52,14 +52,6 @@ class ActionButtonComponent extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
newFolder_press() {
|
|
||||||
this.props.dispatch({
|
|
||||||
type: 'NAV_GO',
|
|
||||||
routeName: 'Folder',
|
|
||||||
folderId: null,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let buttons = this.props.buttons ? this.props.buttons : [];
|
let buttons = this.props.buttons ? this.props.buttons : [];
|
||||||
|
|
||||||
@ -79,13 +71,6 @@ class ActionButtonComponent extends React.Component {
|
|||||||
icon: 'md-document',
|
icon: 'md-document',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
buttons.push({
|
|
||||||
title: _('New notebook'),
|
|
||||||
onPress: () => { this.newFolder_press() },
|
|
||||||
color: '#3498db',
|
|
||||||
icon: 'md-folder',
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let buttonComps = [];
|
let buttonComps = [];
|
||||||
|
@ -19,12 +19,13 @@ class SideMenuContentComponent extends Component {
|
|||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.state = { syncReportText: '',
|
this.state = {
|
||||||
//width: 0,
|
syncReportText: '',
|
||||||
};
|
};
|
||||||
this.styles_ = {};
|
this.styles_ = {};
|
||||||
|
|
||||||
this.tagButton_press = this.tagButton_press.bind(this);
|
this.tagButton_press = this.tagButton_press.bind(this);
|
||||||
|
this.newFolderButton_press = this.newFolderButton_press.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
styles() {
|
styles() {
|
||||||
@ -58,6 +59,10 @@ class SideMenuContentComponent extends Component {
|
|||||||
color: theme.colorFaded,
|
color: theme.colorFaded,
|
||||||
fontSize: theme.fontSizeSmaller,
|
fontSize: theme.fontSizeSmaller,
|
||||||
},
|
},
|
||||||
|
sidebarIcon: {
|
||||||
|
fontSize: 22,
|
||||||
|
color: theme.color,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
styles.folderButton = Object.assign({}, styles.button);
|
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() {
|
async synchronize_press() {
|
||||||
const actionDone = await shared.synchronize_press(this);
|
const actionDone = await shared.synchronize_press(this);
|
||||||
if (actionDone === 'auth') this.props.dispatch({ type: 'SIDE_MENU_CLOSE' });
|
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 theme = themeStyle(this.props.theme);
|
||||||
|
|
||||||
const title = state == 'sync' ? _('Synchronise') : _('Cancel synchronisation');
|
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 (
|
return (
|
||||||
<TouchableOpacity key={'synchronize_button'} onPress={() => { this.synchronize_press() }}>
|
<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);
|
const theme = themeStyle(this.props.theme);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity key={'tag_button'} onPress={this.tagButton_press}>
|
<TouchableOpacity key={key} onPress={onPressHandler}>
|
||||||
<View style={this.styles().sideButton}>
|
<View style={this.styles().sideButton}>
|
||||||
<Icon name='md-pricetag' style={theme.icon} />
|
<Icon name={iconName} style={this.styles().sidebarIcon} />
|
||||||
<Text style={this.styles().sideButtonText}>Tags</Text>
|
<Text style={this.styles().sideButtonText}>{title}</Text>
|
||||||
</View>
|
</View>
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
);
|
);
|
||||||
@ -214,10 +229,10 @@ class SideMenuContentComponent extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
items.push(this.makeDivider('divider_1'));
|
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);
|
let lines = Synchronizer.reportToLines(this.props.syncReport);
|
||||||
const syncReportText = lines.join("\n");
|
const syncReportText = lines.join("\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user