import React from 'react' ; import { connect } from 'react-redux' ; import { closeApp } from '../../../store/AppProcessesStore' ; import InstanceBag from '../../../InstanceBag' ; const styles = require ( './HomeButton.module.scss' ) ; class HomeButton extends React . Component { constructor ( props ) { super ( props ) ; this . handleHomeButtonClick = this . handleHomeButtonClick . bind ( this ) ; } sdk = null ; state = { type { string [ ] } connectedNamespaces : [ ] , } ; componentDidMount ( ) { } onAppConnected ( frameMessageEvent ) { const { connectedNamespaces } = this . state ; connectedNamespaces . push ( frameMessageEvent . data . from ) ; this . setState ( { connectedNamespaces , } ) ; } handleHomeButtonClick ( ) { if ( ! this . props . AppCanvasStore . currentlyOpen . id ) return ; this . props . dispatch ( closeApp ( ) ) ; } handleHomePress ( ) { console . log ( 'Multitasking activated' ) ; } render ( ) { const { currentlyOpen } = this . props . AppCanvasStore ; if ( this . state . connectedNamespaces . includes ( currentlyOpen . namespace ) ) { return null ; } return ( < div title = "Home" className = { styles . HomeButton } onClick = { this . handleHomeButtonClick } > { } < img alt = "Home" src = "./res/img/PlayOSLogoSide_white.svg" className = { styles [ 'HomeButton-Icon' ] } / > { } < /div>); } } const mapStateToProps = ( store ) => { return { AppCanvasStore : store . AppCanvasStore , } ; } ; export default connect ( mapStateToProps ) ( HomeButton ) ;