2018-12-15 04:16:15 +08:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
2020-05-26 04:00:13 +08:00
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
2018-12-15 04:16:15 +08:00
|
|
|
import Button from '/imports/ui/components/button/component';
|
2019-02-01 23:32:43 +08:00
|
|
|
import MediaService from '/imports/ui/components/media/service';
|
2018-12-15 04:16:15 +08:00
|
|
|
|
|
|
|
const propTypes = {
|
2021-08-09 22:24:02 +08:00
|
|
|
intl: PropTypes.shape({
|
|
|
|
formatMessage: PropTypes.func.isRequired,
|
|
|
|
}).isRequired,
|
2018-12-15 04:16:15 +08:00
|
|
|
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()
|
|
|
|
);
|
2019-02-01 23:32:43 +08:00
|
|
|
|
2021-07-17 02:42:16 +08:00
|
|
|
const PresentationOptionsContainer = ({
|
|
|
|
intl,
|
|
|
|
toggleSwapLayout,
|
|
|
|
isThereCurrentPresentation,
|
2021-08-09 22:24:02 +08:00
|
|
|
layoutContextDispatch,
|
2021-07-17 02:42:16 +08:00
|
|
|
}) => {
|
2019-02-01 23:32:43 +08:00
|
|
|
if (shouldUnswapLayout()) toggleSwapLayout();
|
|
|
|
return (
|
|
|
|
<Button
|
|
|
|
icon="presentation"
|
2021-03-02 05:47:08 +08:00
|
|
|
data-test="restorePresentationButton"
|
2019-02-01 23:32:43 +08:00
|
|
|
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)}
|
2019-02-01 23:32:43 +08:00
|
|
|
id="restore-presentation"
|
2019-07-08 22:33:32 +08:00
|
|
|
disabled={!isThereCurrentPresentation}
|
2019-02-01 23:32:43 +08:00
|
|
|
/>
|
|
|
|
);
|
2019-08-19 21:44:36 +08:00
|
|
|
};
|
2018-12-15 04:16:15 +08:00
|
|
|
|
|
|
|
PresentationOptionsContainer.propTypes = propTypes;
|
|
|
|
export default injectIntl(PresentationOptionsContainer);
|