import React, { PureComponent } from 'react';
import { defineMessages, injectIntl } from 'react-intl';
import Button from '/imports/ui/components/common/button/component';
import ConnectionStatusModalComponent from '/imports/ui/components/connection-status/modal/container';
import ConnectionStatusService from '/imports/ui/components/connection-status/service';
import Icon from '/imports/ui/components/connection-status/icon/component';
import Styled from './styles';
import Auth from '/imports/ui/services/auth';
const intlMessages = defineMessages({
label: {
id: 'app.connection-status.label',
description: 'Connection status button label',
},
description: {
id: 'app.connection-status.description',
description: 'Connection status button description',
},
});
class ConnectionStatusButton extends PureComponent {
constructor(props) {
super(props);
this.state = {
isModalOpen: false,
}
}
renderIcon(level = 'normal') {
return(
);
}
setModalIsOpen = (isOpen) => this.setState({ isModalOpen: isOpen });
renderModal(isModalOpen) {
const { isGridLayout, paginationEnabled, viewParticipantsWebcams } = this.props;
return (
isModalOpen ?
: null
)
}
render() {
const {
intl,
connected,
} = this.props;
const { isModalOpen } = this.state;
if (!connected) {
return (
);
}
const {
myCurrentStatus,
} = this.props;
let color;
switch (myCurrentStatus) {
case 'warning':
color = 'success';
break;
case 'danger':
color = 'warning';
ConnectionStatusService.notification('warning', intl);
break;
case 'critical':
color = 'danger';
ConnectionStatusService.notification('error', intl);
break;
default:
color = 'success';
}
return (
);
}
}
export default injectIntl(ConnectionStatusButton);