2018-03-09 22:59:12 +02:00
const React = require ( 'react' ) ; const Component = React . Component ;
const { View , Text , StyleSheet } = require ( 'react-native' ) ;
const { connect } = require ( 'react-redux' ) ;
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 {
2018-03-09 22:59:12 +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 ( ) {
2018-03-09 22:59:12 +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 (
2018-03-09 22:59:12 +02:00
< View style = { this . rootStyle ( this . props . theme ) . root } >
< ScreenHeader title = { _ ( 'Welcome' ) } / >
2017-08-01 20:29:01 +02:00
< Text style = { this . styles ( ) . message } > { message } < / T e x t >
2018-12-07 02:23:36 +02:00
< ActionButton addFolderNoteButtons = { true } parentFolderId = { this . props . selectedFolderId } / >
2017-08-01 19:41:58 +02:00
< / V i e w >
) ;
2017-05-24 22:11:37 +02:00
}
2018-03-09 22:59:12 +02:00
2017-05-24 22:11:37 +02:00
}
2018-03-09 22:59:12 +02:00
const WelcomeScreen = connect (
( state ) => {
return {
folders : state . folders ,
theme : state . settings . theme ,
2018-12-07 02:23:36 +02:00
selectedFolderId : state . selectedFolderId ,
2018-03-09 22:59:12 +02:00
} ;
}
) ( WelcomeScreenComponent )
2017-05-24 22:11:37 +02:00
2018-03-09 22:59:12 +02:00
module . exports = { WelcomeScreen } ;