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

73 lines
2.6 KiB
React
Raw Normal View History

import React from 'react';
import PropTypes from 'prop-types';
import { defineMessages, injectIntl } from 'react-intl';
2021-10-26 03:30:41 +08:00
import Styled from './styles';
const propTypes = {
2021-08-09 22:24:02 +08:00
intl: PropTypes.shape({
formatMessage: PropTypes.func.isRequired,
}).isRequired,
setPresentationIsOpen: PropTypes.func.isRequired,
};
const intlMessages = defineMessages({
minimizePresentationLabel: {
id: 'app.actionsBar.actionsDropdown.minimizePresentationLabel',
description: '',
},
minimizePresentationDesc: {
2021-09-28 03:43:30 +08:00
id: 'app.actionsBar.actionsDropdown.restorePresentationDesc',
description: '',
},
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',
},
});
const PresentationOptionsContainer = ({
intl,
presentationIsOpen,
setPresentationIsOpen,
2021-08-09 22:24:02 +08:00
layoutContextDispatch,
hasPresentation,
hasExternalVideo,
hasScreenshare,
}) => {
let buttonType = 'presentation';
if (hasExternalVideo) {
// hack until we have an external-video icon
buttonType = 'external-video';
} else if (hasScreenshare) {
buttonType = 'desktop';
}
const isThereCurrentPresentation = hasExternalVideo || hasScreenshare || hasPresentation;
return (
2021-10-26 03:30:41 +08:00
<Styled.RestorePresentationButton
icon={`${buttonType}${!presentationIsOpen ? '_off' : ''}`}
2021-10-27 01:57:40 +08:00
data-test="restorePresentationButton"
label={intl.formatMessage(!presentationIsOpen ? intlMessages.restorePresentationLabel : intlMessages.minimizePresentationLabel)}
aria-label={intl.formatMessage(!presentationIsOpen ? intlMessages.restorePresentationLabel : intlMessages.minimizePresentationLabel)}
aria-describedby={intl.formatMessage(!presentationIsOpen ? intlMessages.restorePresentationDesc : intlMessages.minimizePresentationDesc)}
description={intl.formatMessage(!presentationIsOpen ? intlMessages.restorePresentationDesc : intlMessages.minimizePresentationDesc)}
color={presentationIsOpen ? "primary" : "default"}
hideLabel
circle
size="lg"
onClick={() => setPresentationIsOpen(layoutContextDispatch, !presentationIsOpen)}
id="restore-presentation"
ghost={!presentationIsOpen}
disabled={!isThereCurrentPresentation}
data-test={!presentationIsOpen ? 'restorePresentation' : 'minimizePresentation'}
/>
);
};
PresentationOptionsContainer.propTypes = propTypes;
export default injectIntl(PresentationOptionsContainer);