bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/actions-bar/presentation-options/component.jsx

55 lines
1.6 KiB
React
Raw Normal View History

import React from 'react';
import PropTypes from 'prop-types';
import { defineMessages, injectIntl } from 'react-intl';
import Button from '/imports/ui/components/button/component';
import MediaService from '/imports/ui/components/media/service';
const propTypes = {
2021-08-09 22:24:02 +08:00
intl: PropTypes.shape({
formatMessage: PropTypes.func.isRequired,
}).isRequired,
toggleSwapLayout: PropTypes.func.isRequired,
};
const intlMessages = defineMessages({
restorePresentationLabel: {
id: 'app.actionsBar.actionsDropdown.restorePresentationLabel',
description: 'Restore Presentation option label',
},
restorePresentationDesc: {
id: 'app.actionsBar.actionsDropdown.restorePresentationDesc',
description: 'button to restore presentation after it has been closed',
},
});
2021-08-09 22:24:02 +08:00
const shouldUnswapLayout = () => (
MediaService.shouldShowScreenshare() || MediaService.shouldShowExternalVideo()
);
const PresentationOptionsContainer = ({
intl,
toggleSwapLayout,
isThereCurrentPresentation,
2021-08-09 22:24:02 +08:00
layoutContextDispatch,
}) => {
if (shouldUnswapLayout()) toggleSwapLayout();
return (
<Button
icon="presentation"
data-test="restorePresentationButton"
label={intl.formatMessage(intlMessages.restorePresentationLabel)}
description={intl.formatMessage(intlMessages.restorePresentationDesc)}
color="primary"
hideLabel
circle
size="lg"
2021-08-05 19:03:24 +08:00
onClick={() => toggleSwapLayout(layoutContextDispatch)}
id="restore-presentation"
disabled={!isThereCurrentPresentation}
/>
);
};
PresentationOptionsContainer.propTypes = propTypes;
export default injectIntl(PresentationOptionsContainer);