github.com/stampzilla/stampzilla-go@v2.0.0-rc9+incompatible/nodes/stampzilla-magicmirror/web/src/routes/home/index.js (about)

     1  import React from 'react'
     2  import { connect } from 'react-redux'
     3  
     4  import Clock from './Clock'
     5  import Forecast from './Forecast'
     6  import DeviceList from './DeviceList'
     7  
     8  class Home extends React.PureComponent {
     9    render() {
    10      const { widgets } = this.props
    11      return (
    12        <div>
    13          {widgets &&
    14            widgets.map(widget => {
    15              switch (widget.get('type')) {
    16                case 'clock':
    17                  return <Clock />
    18                case 'forecast':
    19                  return <Forecast />
    20                case 'devicelist':
    21                  return <DeviceList devices={widget.get('devices')} />
    22              }
    23            })}
    24        </div>
    25      )
    26    }
    27  }
    28  
    29  const mapStateToProps = state => ({
    30    widgets: state.getIn(['config', 'widgets'])
    31  })
    32  
    33  export default connect(mapStateToProps)(Home)