You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-15 23:00:36 +02:00
Mobile: Make it clearer when there are no notebooks and added a button create one
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
const React = require('react');
|
const React = require('react');
|
||||||
const Component = React.Component;
|
const Component = React.Component;
|
||||||
const { connect } = require('react-redux');
|
const { connect } = require('react-redux');
|
||||||
const { ListView, Text, StyleSheet } = require('react-native');
|
const { ListView, Text, StyleSheet, Button, View } = require('react-native');
|
||||||
const { _ } = require('lib/locale.js');
|
const { _ } = require('lib/locale.js');
|
||||||
const { NoteItem } = require('lib/components/note-item.js');
|
const { NoteItem } = require('lib/components/note-item.js');
|
||||||
const { time } = require('lib/time-utils.js');
|
const { time } = require('lib/time-utils.js');
|
||||||
@ -22,6 +22,8 @@ class NoteListComponent extends Component {
|
|||||||
};
|
};
|
||||||
this.rootRef_ = null;
|
this.rootRef_ = null;
|
||||||
this.styles_ = {};
|
this.styles_ = {};
|
||||||
|
|
||||||
|
this.createNotebookButton_click = this.createNotebookButton_click.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
styles() {
|
styles() {
|
||||||
@ -39,6 +41,10 @@ class NoteListComponent extends Component {
|
|||||||
paddingBottom: theme.marginBottom,
|
paddingBottom: theme.marginBottom,
|
||||||
fontSize: theme.fontSize,
|
fontSize: theme.fontSize,
|
||||||
color: theme.color,
|
color: theme.color,
|
||||||
|
textAlign: 'center',
|
||||||
|
},
|
||||||
|
noNotebookView: {
|
||||||
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -46,6 +52,14 @@ class NoteListComponent extends Component {
|
|||||||
return this.styles_[themeId];
|
return this.styles_[themeId];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
createNotebookButton_click() {
|
||||||
|
this.props.dispatch({
|
||||||
|
type: 'NAV_GO',
|
||||||
|
routeName: 'Folder',
|
||||||
|
folderId: null,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
filterNotes(notes) {
|
filterNotes(notes) {
|
||||||
const todoFilter = 'all'; //Setting.value('todoFilter');
|
const todoFilter = 'all'; //Setting.value('todoFilter');
|
||||||
if (todoFilter == 'all') return notes;
|
if (todoFilter == 'all') return notes;
|
||||||
@ -97,16 +111,27 @@ class NoteListComponent extends Component {
|
|||||||
enableEmptySections={true}
|
enableEmptySections={true}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
if (!this.props.folders.length) {
|
||||||
|
const noItemMessage = _('You currently have no notebooks.');
|
||||||
|
return (
|
||||||
|
<View style={this.styles().noNotebookView}>
|
||||||
|
<Text style={this.styles().noItemMessage}>{noItemMessage}</Text>
|
||||||
|
<Button title={_('Create a notebook')} onPress={this.createNotebookButton_click} />
|
||||||
|
</View>
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
const noItemMessage = _('There are currently no notes. Create one by clicking on the (+) button.');
|
const noItemMessage = _('There are currently no notes. Create one by clicking on the (+) button.');
|
||||||
return <Text style={this.styles().noItemMessage}>{noItemMessage}</Text>;
|
return <Text style={this.styles().noItemMessage}>{noItemMessage}</Text>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const NoteList = connect(state => {
|
const NoteList = connect(state => {
|
||||||
return {
|
return {
|
||||||
items: state.notes,
|
items: state.notes,
|
||||||
|
folders: state.folders,
|
||||||
notesSource: state.notesSource,
|
notesSource: state.notesSource,
|
||||||
theme: state.settings.theme,
|
theme: state.settings.theme,
|
||||||
noteSelectionEnabled: state.noteSelectionEnabled,
|
noteSelectionEnabled: state.noteSelectionEnabled,
|
||||||
|
Reference in New Issue
Block a user