1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-15 09:04:04 +02:00
joplin/ReactNativeClient/lib/components/screens/welcome.js

64 lines
1.7 KiB
JavaScript
Raw Normal View History

const React = require('react'); const Component = React.Component;
const { View, Text, StyleSheet } = require('react-native');
const { connect } = require('react-redux');
const { Log } = require('lib/log.js');
const { ScreenHeader } = require('lib/components/screen-header.js');
const { ActionButton } = require('lib/components/action-button.js');
const { BaseScreenComponent } = require('lib/components/base-screen.js');
const { _ } = require('lib/locale.js');
const { themeStyle } = require('lib/components/global-style.js');
2017-05-24 22:11:37 +02:00
2017-07-14 20:49:14 +02:00
class WelcomeScreenComponent extends BaseScreenComponent {
2017-05-24 22:11:37 +02:00
2017-06-06 22:01:43 +02:00
static navigationOptions(options) {
2017-05-24 22:11:37 +02:00
return { header: null };
}
2017-08-01 20:29:01 +02:00
constructor() {
super();
this.styles_ = {};
}
styles() {
const themeId = this.props.theme;
const theme = themeStyle(themeId);
if (this.styles_[themeId]) return this.styles_[themeId];
this.styles_ = {};
let styles = {
message: {
margin: theme.margin,
fontSize: theme.fontSize,
color: theme.color,
},
};
this.styles_[themeId] = StyleSheet.create(styles);
return this.styles_[themeId];
}
2017-05-24 22:11:37 +02:00
render() {
2017-08-01 19:41:58 +02:00
let message = this.props.folders.length ? _('Click on the (+) button to create a new note or notebook. Click on the side menu to access your existing notebooks.') : _('You currently have no notebook. Create one by clicking on (+) button.');
2017-07-13 23:50:21 +02:00
2017-08-01 19:41:58 +02:00
return (
2017-08-01 20:29:01 +02:00
<View style={this.rootStyle(this.props.theme).root} >
2017-08-01 19:41:58 +02:00
<ScreenHeader title={_('Welcome')}/>
2017-08-01 20:29:01 +02:00
<Text style={this.styles().message}>{message}</Text>
2017-08-01 19:41:58 +02:00
<ActionButton addFolderNoteButtons={true}/>
</View>
);
2017-05-24 22:11:37 +02:00
}
}
const WelcomeScreen = connect(
2017-05-24 22:11:37 +02:00
(state) => {
2017-07-09 00:57:09 +02:00
return {
2017-07-13 23:50:21 +02:00
folders: state.folders,
2017-08-01 20:29:01 +02:00
theme: state.settings.theme,
2017-07-09 00:57:09 +02:00
};
2017-05-24 22:11:37 +02:00
}
)(WelcomeScreenComponent)
2017-05-24 22:11:37 +02:00
2017-11-03 02:13:17 +02:00
module.exports = { WelcomeScreen };