bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/settings/submenus/data-saving/component.jsx

113 lines
3.5 KiB
React
Raw Normal View History

2018-01-30 19:20:51 +08:00
import React from 'react';
2022-02-15 23:58:28 +08:00
import Toggle from '/imports/ui/components/common/switch/component';
2018-01-30 19:20:51 +08:00
import { defineMessages, injectIntl } from 'react-intl';
import BaseMenu from '../base/component';
2021-11-05 22:06:47 +08:00
import Styled from './styles';
2018-01-30 19:20:51 +08:00
const intlMessages = defineMessages({
dataSavingLabel: {
id: 'app.settings.dataSavingTab.label',
2018-01-30 19:20:51 +08:00
description: 'label for data savings tab',
},
webcamLabel: {
id: 'app.settings.dataSavingTab.webcam',
2018-01-30 19:20:51 +08:00
description: 'webcam toggle',
},
screenShareLabel: {
id: 'app.settings.dataSavingTab.screenShare',
2018-01-30 19:20:51 +08:00
description: 'screenshare toggle',
},
dataSavingDesc: {
id: 'app.settings.dataSavingTab.description',
description: 'description of data savings tab',
},
2018-01-30 19:20:51 +08:00
});
class DataSaving extends BaseMenu {
constructor(props) {
super(props);
this.state = {
settingsName: 'dataSaving',
2018-01-30 19:20:51 +08:00
settings: props.settings,
};
}
2018-12-06 01:42:31 +08:00
2018-01-30 19:20:51 +08:00
render() {
const {
intl,
showToggleLabel,
displaySettingsStatus,
isScreenSharingEnabled,
isVideoEnabled,
} = this.props;
2018-01-30 19:20:51 +08:00
const { viewParticipantsWebcams, viewScreenshare } = this.state.settings;
2018-01-30 19:20:51 +08:00
return (
2018-12-06 01:42:31 +08:00
<div>
<div>
2021-11-05 22:06:47 +08:00
<Styled.Title>{intl.formatMessage(intlMessages.dataSavingLabel)}</Styled.Title>
<Styled.SubTitle>{intl.formatMessage(intlMessages.dataSavingDesc)}</Styled.SubTitle>
2018-01-30 19:20:51 +08:00
</div>
2021-11-05 22:06:47 +08:00
<Styled.Form>
{isVideoEnabled
? (
<Styled.Row>
<Styled.Col aria-hidden="true">
<Styled.FormElement>
<Styled.Label>
{intl.formatMessage(intlMessages.webcamLabel)}
</Styled.Label>
</Styled.FormElement>
</Styled.Col>
<Styled.Col>
<Styled.FormElementRight>
{displaySettingsStatus(viewParticipantsWebcams)}
<Toggle
icons={false}
defaultChecked={viewParticipantsWebcams}
onChange={() => this.handleToggle('viewParticipantsWebcams')}
ariaLabelledBy="webcamToggle"
ariaLabel={intl.formatMessage(intlMessages.webcamLabel)}
showToggleLabel={showToggleLabel}
/>
</Styled.FormElementRight>
</Styled.Col>
</Styled.Row>
)
: null}
{isScreenSharingEnabled
? (
<Styled.Row>
<Styled.Col aria-hidden="true">
<Styled.FormElement>
<Styled.Label>
{intl.formatMessage(intlMessages.screenShareLabel)}
</Styled.Label>
</Styled.FormElement>
</Styled.Col>
<Styled.Col>
<Styled.FormElementRight>
{displaySettingsStatus(viewScreenshare)}
<Toggle
icons={false}
defaultChecked={viewScreenshare}
onChange={() => this.handleToggle('viewScreenshare')}
ariaLabelledBy="screenShare"
ariaLabel={intl.formatMessage(intlMessages.screenShareLabel)}
showToggleLabel={showToggleLabel}
/>
</Styled.FormElementRight>
</Styled.Col>
</Styled.Row>
)
: null}
2021-11-05 22:06:47 +08:00
</Styled.Form>
2018-01-30 19:20:51 +08:00
</div>
);
}
}
export default injectIntl(DataSaving);