bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/video-provider/video-button/component.jsx

66 lines
1.7 KiB
React
Raw Normal View History

2017-09-20 11:12:10 +08:00
import React from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
2017-09-20 11:12:10 +08:00
import Button from '/imports/ui/components/button/component';
import { defineMessages, injectIntl, intlShape } from 'react-intl';
import { styles } from './styles';
2017-09-20 11:12:10 +08:00
const intlMessages = defineMessages({
joinVideo: {
id: 'app.video.joinVideo',
description: 'Join video button label',
2017-09-20 11:12:10 +08:00
},
leaveVideo: {
id: 'app.video.leaveVideo',
description: 'Leave video button label',
2017-09-20 11:12:10 +08:00
},
videoButtonDesc: {
id: 'app.video.videoButtonDesc',
description: 'video button description',
},
2019-03-29 22:31:56 +08:00
videoLocked: {
id: 'app.video.videoLocked',
description: 'video disabled label',
2018-03-23 01:02:59 +08:00
},
2017-09-20 11:12:10 +08:00
});
2018-01-29 19:52:07 +08:00
const propTypes = {
intl: intlShape.isRequired,
isSharingVideo: PropTypes.bool.isRequired,
isDisabled: PropTypes.bool.isRequired,
handleJoinVideo: PropTypes.func.isRequired,
handleCloseVideo: PropTypes.func.isRequired,
};
const JoinVideoButton = ({
intl,
isSharingVideo,
isDisabled,
handleJoinVideo,
handleCloseVideo,
2019-03-29 22:31:56 +08:00
}) => (
<Button
label={isDisabled
? intl.formatMessage(intlMessages.videoLocked)
: (isSharingVideo
? intl.formatMessage(intlMessages.leaveVideo)
: intl.formatMessage(intlMessages.joinVideo)
)
}
className={cx(styles.button, isSharingVideo || styles.btn)}
2019-03-29 22:31:56 +08:00
onClick={isSharingVideo ? handleCloseVideo : handleJoinVideo}
hideLabel
aria-label={intl.formatMessage(intlMessages.videoButtonDesc)}
color={isSharingVideo ? 'primary' : 'default'}
icon={isSharingVideo ? 'video' : 'video_off'}
ghost={!isSharingVideo}
size="lg"
circle
disabled={isDisabled}
/>
);
JoinVideoButton.propTypes = propTypes;
export default injectIntl(JoinVideoButton);