2017-11-03 02:09:34 +02: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 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 } < / T e x t >
2017-08-01 19:41:58 +02:00
< ActionButton addFolderNoteButtons = { true } / >
< / V i e w >
) ;
2017-05-24 22:11:37 +02:00
}
}
2017-07-13 20:47:31 +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
}
2017-07-13 20:47:31 +02:00
) ( WelcomeScreenComponent )
2017-05-24 22:11:37 +02:00
2017-11-03 02:13:17 +02:00
module . exports = { WelcomeScreen } ;