import { connect } from 'react-redux' ; import Redux from 'redux' ; import { UserState } from 'shared/auth/UserState' ; import { loadQuestFromURL } from '../actions/Quest' ; import { loginUser } from '../actions/User' ; import { AppState } from '../reducers/StateTypes' ; import Splash , { DispatchProps , StateProps } from './Splash' ; const ReactGA = require ( 'react-ga' ) ; const mapStateToProps = ( state ) : StateProps => { return { announcement : state . announcement , user : state . user , } ; } ; const mapDispatchToProps = ( dispatch ) : DispatchProps => { return { onLinkTap : ( link ) => { if ( link !== '' ) { window . open ( link + '?utm_source=questcreator' , '_system' ) ; } } , onLogin : ( position ) => { ReactGA . event ( { action : 'LOGIN' , category : 'interaction' , label : 'splashscreen' + position , } ) ; dispatch ( loginUser ( true , true ) ) ; } , onNewQuest : ( user ) => { dispatch ( loadQuestFromURL ( user ) ) ; } , } ; } ; const SplashContainer = connect ( mapStateToProps , mapDispatchToProps ) ( Splash ) ; export default SplashContainer ;