Files
Iris/src/js/components/DebugInfo.js

61 lines
1.6 KiB
JavaScript
Raw Normal View History

2017-01-29 12:54:06 +13:00
import React, { PropTypes } from 'react'
import { connect } from 'react-redux'
import { Link } from 'react-router'
import { createStore, bindActionCreators } from 'redux'
import * as helpers from '../helpers'
2017-01-29 12:54:06 +13:00
import * as uiActions from '../services/ui/actions'
class DebugInfo extends React.Component{
constructor(props) {
super(props);
}
render(){
var touch_state = 'no touch'
if (this.props.ui.emulate_touch){
touch_state = 'emulated touch'
} else if (helpers.isTouchDevice()){
touch_state = 'touch device'
}
2017-01-29 12:54:06 +13:00
return (
<div className="debug-info">
<div className="item">
{this.props.ui.albums ? Object.keys(this.props.ui.albums).length : '0'}&nbsp;albums
</div>
<div className="item">
{this.props.ui.artists ? Object.keys(this.props.ui.artists).length : '0'}&nbsp;artists
</div>
<div className="item">
{this.props.ui.playlists ? Object.keys(this.props.ui.playlists).length : '0'}&nbsp;playlists
</div>
2017-02-01 10:10:31 +13:00
<div className="item">
{this.props.ui.tracks ? Object.keys(this.props.ui.tracks).length : '0'}&nbsp;tracks
</div>
2017-01-29 12:54:06 +13:00
<div className="item">
{this.props.ui.users ? Object.keys(this.props.ui.users).length : '0'}&nbsp;users
</div>
<div className="item">
{touch_state}
2017-01-29 12:54:06 +13:00
</div>
</div>
);
}
}
const mapStateToProps = (state, ownProps) => {
return {
ui: state.ui
}
}
const mapDispatchToProps = (dispatch) => {
return {
uiActions: bindActionCreators(uiActions, dispatch)
}
}
export default connect(mapStateToProps, mapDispatchToProps)(DebugInfo)