fixed warning message in device panel thanks to andrea

This commit is contained in:
Nicola Brunner 2020-05-07 09:51:38 +02:00
parent b61148b24a
commit bb91bb1ee2

View file

@ -25,7 +25,7 @@ class DevicePanel extends Component {
render() { render() {
return ( return (
<Card.Group centered style={{ paddingTop: "3rem" }}> <Card.Group centered style={{ paddingTop: "3rem" }}>
{this.props.devices.length !== 0 ? ( {this.props.numbeOfRooms > 0 ? (
<React.Fragment> <React.Fragment>
{this.props.devices.map((e, i) => { {this.props.devices.map((e, i) => {
return <Device key={i} tab={this.props.tab} id={e.id} />; return <Device key={i} tab={this.props.tab} id={e.id} />;
@ -70,6 +70,9 @@ const mapStateToProps = (state, _) => ({
return state.active.activeRoom === -1; return state.active.activeRoom === -1;
}, },
activeRoom: state.active.activeRoom, activeRoom: state.active.activeRoom,
get numbeOfRooms() {
return Object.keys(state.rooms).length;
},
}); });
const DevicePanelContainer = connect( const DevicePanelContainer = connect(
mapStateToProps, mapStateToProps,