Merge branch '105-room' into 'dev'

Resolve "Room view with no devices is now bugged and tells the user to create a room"

Closes #105

See merge request sa4-2020/the-sanmarinoes/frontend!132
This commit is contained in:
Andrea Brites Marto 2020-05-07 10:32:00 +02:00
commit 1dd25968be

View file

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