Better management of captions activation
This commit is contained in:
parent
34b39a2b0a
commit
a37ae9cb70
@ -8,7 +8,7 @@ import Button from '/imports/ui/components/button/component';
|
||||
|
||||
const propTypes = {
|
||||
intl: intlShape.isRequired,
|
||||
isCaptionsActive: PropTypes.bool.isRequired,
|
||||
isActive: PropTypes.bool.isRequired,
|
||||
handleOnClick: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
@ -23,19 +23,19 @@ const intlMessages = defineMessages({
|
||||
},
|
||||
});
|
||||
|
||||
const CaptionsButton = ({ intl, isCaptionsActive, handleOnClick }) => {
|
||||
const CaptionsButton = ({ intl, isActive, handleOnClick }) => {
|
||||
return (
|
||||
<Button
|
||||
className={cx(styles.button, isCaptionsActive || styles.btn)}
|
||||
className={cx(styles.button, isActive || styles.btn)}
|
||||
icon="polling"
|
||||
label={intl.formatMessage(isCaptionsActive ? intlMessages.stop : intlMessages.start)}
|
||||
color={isCaptionsActive ? 'primary' : 'default'}
|
||||
ghost={!isCaptionsActive}
|
||||
label={intl.formatMessage(isActive ? intlMessages.stop : intlMessages.start)}
|
||||
color={isActive ? 'primary' : 'default'}
|
||||
ghost={!isActive}
|
||||
hideLabel
|
||||
circle
|
||||
size="lg"
|
||||
onClick={handleOnClick}
|
||||
id={isCaptionsActive ? 'stop-captions-button' : 'start-captions-button'}
|
||||
id={isActive ? 'stop-captions-button' : 'start-captions-button'}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
@ -8,6 +8,6 @@ import CaptionsButton from './component';
|
||||
const CaptionsButtonContainer = props => <CaptionsButton {...props} />;
|
||||
|
||||
export default withModalMounter(withTracker(({ mountModal }) => ({
|
||||
isCaptionsActive: CaptionsService.getActiveCaptions() ? true : false,
|
||||
handleOnClick: () => (CaptionsService.getActiveCaptions() ? CaptionsService.deactivateCaptions() : mountModal(<CaptionsReaderMenuContainer />)),
|
||||
isActive: CaptionsService.isCaptionsActive(),
|
||||
handleOnClick: () => (CaptionsService.isCaptionsActive() ? CaptionsService.deactivateCaptions() : mountModal(<CaptionsReaderMenuContainer />)),
|
||||
}))(CaptionsButtonContainer));
|
||||
|
@ -90,7 +90,7 @@ export default injectIntl(withModalMounter(withTracker(({ intl, baseControls })
|
||||
}).fetch();
|
||||
|
||||
return {
|
||||
captions: CaptionsService.isCaptionsActive ? <CaptionsContainer /> : null,
|
||||
captions: CaptionsService.isCaptionsActive() ? <CaptionsContainer /> : null,
|
||||
fontSize: getFontSize(),
|
||||
hasBreakoutRooms: getBreakoutRooms().length > 0,
|
||||
customStyle: getFromUserSettings('customStyle', false),
|
||||
|
@ -23,6 +23,6 @@ export default withTracker(() => {
|
||||
fontColor,
|
||||
backgroundColor,
|
||||
captions,
|
||||
isActive: CaptionsService.getActiveCaptions() ? true : false,
|
||||
isActive: CaptionsService.isCaptionsActive(),
|
||||
};
|
||||
})(CaptionsContainer);
|
||||
|
@ -92,7 +92,7 @@ const isCaptionsAvailable = () => {
|
||||
|
||||
const isCaptionsActive = () => {
|
||||
const enabled = isCaptionsEnabled();
|
||||
const activated = getActiveCaptions();
|
||||
const activated = getActiveCaptions() !== '';
|
||||
return (enabled && activated);
|
||||
}
|
||||
|
||||
@ -112,8 +112,6 @@ export default {
|
||||
takeOwnership,
|
||||
getCaptions,
|
||||
canIOwnThisPad,
|
||||
getActiveCaptions,
|
||||
setActiveCaptions,
|
||||
getCaptionsSettings,
|
||||
isCaptionsEnabled,
|
||||
isCaptionsAvailable,
|
||||
|
Loading…
Reference in New Issue
Block a user