2017-09-20 11:12:10 +08:00
|
|
|
import React from 'react';
|
2018-01-08 12:44:42 +08:00
|
|
|
import PropTypes from 'prop-types';
|
2017-09-20 11:12:10 +08:00
|
|
|
import Button from '/imports/ui/components/button/component';
|
2018-01-08 12:44:42 +08:00
|
|
|
import { defineMessages, injectIntl, intlShape } from 'react-intl';
|
2017-09-20 11:12:10 +08:00
|
|
|
|
|
|
|
const intlMessages = defineMessages({
|
|
|
|
joinVideo: {
|
|
|
|
id: 'app.video.joinVideo',
|
|
|
|
description: 'Join video button label',
|
|
|
|
},
|
|
|
|
leaveVideo: {
|
|
|
|
id: 'app.video.leaveVideo',
|
|
|
|
description: 'Leave video button label',
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2018-01-17 00:04:34 +08:00
|
|
|
const JoinVideoOptions = ({intl, isWaitingResponse, isConnected, isSharingVideo, handleJoinVideo, handleCloseVideo}) => {
|
|
|
|
if (isSharingVideo) {
|
2017-09-20 11:12:10 +08:00
|
|
|
return (
|
|
|
|
<Button
|
2018-01-17 00:04:34 +08:00
|
|
|
onClick={handleCloseVideo}
|
|
|
|
label={intl.formatMessage(intlMessages.leaveVideo)}
|
2017-12-22 01:40:00 +08:00
|
|
|
hideLabel
|
2018-01-17 00:04:34 +08:00
|
|
|
aria-label={intl.formatMessage(intlMessages.leaveVideo)}
|
|
|
|
color={'danger'}
|
|
|
|
icon={'video'}
|
2017-09-20 11:12:10 +08:00
|
|
|
size={'lg'}
|
|
|
|
circle
|
2018-01-17 00:04:34 +08:00
|
|
|
disabled={isWaitingResponse}
|
2017-09-20 11:12:10 +08:00
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
2018-01-17 00:04:34 +08:00
|
|
|
|
|
|
|
return (
|
|
|
|
<Button
|
|
|
|
onClick={handleJoinVideo}
|
|
|
|
label={intl.formatMessage(intlMessages.joinVideo)}
|
|
|
|
hideLabel
|
|
|
|
aria-label={intl.formatMessage(intlMessages.joinVideo)}
|
|
|
|
color={'primary'}
|
|
|
|
icon={'video_off'}
|
|
|
|
size={'lg'}
|
|
|
|
circle
|
|
|
|
disabled={isWaitingResponse || (!isSharingVideo && isConnected)}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
}
|
2017-09-20 11:12:10 +08:00
|
|
|
|
2017-12-09 00:53:28 +08:00
|
|
|
export default injectIntl(JoinVideoOptions);
|