import { setDialog } from 'app/actions/Dialog' ; import { connect } from 'react-redux' ; import Redux from 'redux' ; import { toCard , toNavCard } from '../../actions/Card' ; import { changeSettings } from '../../actions/Settings' ; import { openWindow } from '../../Globals' ; import { AppState } from '../../reducers/StateTypes' ; import { AnnouncementState } from '../../reducers/StateTypes' ; import SplashScreen , { DispatchProps , StateProps } from './SplashScreen' ; const mapStateToProps = ( state ) : StateProps => { return { announcement : state . serverstatus . announcement , } ; } ; const mapDispatchToProps = ( dispatch ) : DispatchProps => { return { onAnnouncementTap : ( announcement ) => { if ( announcement . link && announcement . link !== '' ) { if ( announcement . link . includes ( '?' ) ) { openWindow ( announcement . link ) ; } else { openWindow ( announcement . link + '?utm_source=app' ) ; } } } , onPlayerCountSelect : ( numLocalPlayers ) => { if ( numLocalPlayers > 6 ) { dispatch ( setDialog ( 'TOO_MANY_PLAYERS' ) ) ; } else { dispatch ( changeSettings ( { numLocalPlayers , multitouch : true } ) ) ; dispatch ( toNavCard ( { } ) ) ; } } , onPlayerManualSelect : ( ) => { dispatch ( toCard ( { name : 'PLAYER_COUNT_SETTING' } ) ) ; } , } ; } ; const SplashScreenContainer = connect ( mapStateToProps , mapDispatchToProps ) ( SplashScreen ) ; export default SplashScreenContainer ;