1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00
Files
joplin/ReactNativeClient/lib/components/screens/welcome.js

64 lines
1.7 KiB
JavaScript
Raw Normal View History

2018-03-09 17:49:35 +00:00
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 20:11:37 +00:00
2017-07-14 18:49:14 +00:00
class WelcomeScreenComponent extends BaseScreenComponent {
2017-06-06 20:01:43 +00:00
static navigationOptions(options) {
2017-05-24 20:11:37 +00:00
return { header: null };
}
2017-08-01 18:29:01 +00: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 20:11:37 +00:00
render() {
2018-03-09 17:49:35 +00: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 22:50:21 +01:00
2017-08-01 17:41:58 +00:00
return (
2018-03-09 17:49:35 +00:00
<View style={this.rootStyle(this.props.theme).root}>
<ScreenHeader title={_("Welcome")} />
2017-08-01 18:29:01 +00:00
<Text style={this.styles().message}>{message}</Text>
2018-03-09 17:49:35 +00:00
<ActionButton addFolderNoteButtons={true} />
2017-08-01 17:41:58 +00:00
</View>
);
2017-05-24 20:11:37 +00:00
}
}
2018-03-09 17:49:35 +00:00
const WelcomeScreen = connect(state => {
return {
folders: state.folders,
theme: state.settings.theme,
};
})(WelcomeScreenComponent);
2017-05-24 20:11:37 +00:00
2018-03-09 17:49:35 +00:00
module.exports = { WelcomeScreen };