2020-03-19 22:19:40 +08:00
|
|
|
import React from 'react';
|
2022-02-15 04:20:50 +08:00
|
|
|
import Button from '/imports/ui/components/common/button/component';
|
2022-02-15 23:58:28 +08:00
|
|
|
import Toggle from '/imports/ui/components/common/switch/component';
|
2022-02-15 22:57:07 +08:00
|
|
|
import LocalesDropdown from '/imports/ui/components/common/locales-dropdown/component';
|
2017-04-11 05:11:48 +08:00
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
2017-10-06 03:18:30 +08:00
|
|
|
import BaseMenu from '../base/component';
|
2021-11-05 21:46:14 +08:00
|
|
|
import Styled from './styles';
|
2020-08-29 03:29:45 +08:00
|
|
|
import VideoService from '/imports/ui/components/video-provider/service';
|
2023-06-14 00:26:43 +08:00
|
|
|
import WakeLockService from '/imports/ui/components/wake-lock/service';
|
2022-05-03 22:32:50 +08:00
|
|
|
import { ACTIONS } from '/imports/ui/components/layout/enums';
|
2021-11-05 21:46:14 +08:00
|
|
|
import Settings from '/imports/ui/services/settings';
|
2016-12-14 11:40:32 +08:00
|
|
|
|
2017-02-25 04:19:53 +08:00
|
|
|
const MIN_FONTSIZE = 0;
|
2021-05-06 22:41:19 +08:00
|
|
|
const SHOW_AUDIO_FILTERS = (Meteor.settings.public.app
|
|
|
|
.showAudioFilters === undefined)
|
|
|
|
? true
|
|
|
|
: Meteor.settings.public.app.showAudioFilters;
|
2021-11-05 21:46:14 +08:00
|
|
|
const { animations } = Settings.application;
|
2017-02-25 04:19:53 +08:00
|
|
|
|
2017-04-11 05:11:48 +08:00
|
|
|
const intlMessages = defineMessages({
|
|
|
|
applicationSectionTitle: {
|
|
|
|
id: 'app.submenu.application.applicationSectionTitle',
|
|
|
|
description: 'Application section title',
|
|
|
|
},
|
2019-01-25 00:16:23 +08:00
|
|
|
animationsLabel: {
|
|
|
|
id: 'app.submenu.application.animationsLabel',
|
|
|
|
description: 'animations label',
|
|
|
|
},
|
2021-01-23 03:30:42 +08:00
|
|
|
audioFilterLabel: {
|
|
|
|
id: 'app.submenu.application.audioFilterLabel',
|
|
|
|
description: 'audio filters label',
|
|
|
|
},
|
2022-04-09 03:05:29 +08:00
|
|
|
darkThemeLabel: {
|
|
|
|
id: 'app.submenu.application.darkThemeLabel',
|
|
|
|
description: 'dark mode label',
|
|
|
|
},
|
2017-04-11 05:11:48 +08:00
|
|
|
fontSizeControlLabel: {
|
|
|
|
id: 'app.submenu.application.fontSizeControlLabel',
|
2017-04-11 05:21:54 +08:00
|
|
|
description: 'label for font size ontrol',
|
2017-04-11 05:11:48 +08:00
|
|
|
},
|
|
|
|
increaseFontBtnLabel: {
|
|
|
|
id: 'app.submenu.application.increaseFontBtnLabel',
|
2017-04-11 05:21:54 +08:00
|
|
|
description: 'label for button to increase font size',
|
2017-04-11 05:11:48 +08:00
|
|
|
},
|
|
|
|
increaseFontBtnDesc: {
|
|
|
|
id: 'app.submenu.application.increaseFontBtnDesc',
|
2017-04-11 05:21:54 +08:00
|
|
|
description: 'adds descriptive context to increase font size button',
|
2017-04-11 05:11:48 +08:00
|
|
|
},
|
|
|
|
decreaseFontBtnLabel: {
|
|
|
|
id: 'app.submenu.application.decreaseFontBtnLabel',
|
2017-04-11 05:21:54 +08:00
|
|
|
description: 'label for button to reduce font size',
|
2017-04-11 05:11:48 +08:00
|
|
|
},
|
|
|
|
decreaseFontBtnDesc: {
|
|
|
|
id: 'app.submenu.application.decreaseFontBtnDesc',
|
2017-04-11 05:21:54 +08:00
|
|
|
description: 'adds descriptive context to decrease font size button',
|
2017-04-11 05:11:48 +08:00
|
|
|
},
|
2017-04-22 03:04:46 +08:00
|
|
|
languageLabel: {
|
|
|
|
id: 'app.submenu.application.languageLabel',
|
|
|
|
description: 'displayed label for changing application locale',
|
|
|
|
},
|
2019-05-24 05:50:36 +08:00
|
|
|
currentValue: {
|
|
|
|
id: 'app.submenu.application.currentSize',
|
|
|
|
description: 'current value label',
|
|
|
|
},
|
2017-06-03 03:25:02 +08:00
|
|
|
languageOptionLabel: {
|
2017-04-22 03:04:46 +08:00
|
|
|
id: 'app.submenu.application.languageOptionLabel',
|
|
|
|
description: 'default change language option when locales are available',
|
|
|
|
},
|
|
|
|
noLocaleOptionLabel: {
|
|
|
|
id: 'app.submenu.application.noLocaleOptionLabel',
|
|
|
|
description: 'default change language option when no locales available',
|
|
|
|
},
|
2020-08-29 03:29:45 +08:00
|
|
|
paginationEnabledLabel: {
|
|
|
|
id: 'app.submenu.application.paginationEnabledLabel',
|
|
|
|
description: 'enable/disable video pagination',
|
|
|
|
},
|
2023-03-27 06:08:09 +08:00
|
|
|
wbToolbarsAutoHideLabel: {
|
|
|
|
id: 'app.submenu.application.wbToolbarsAutoHideLabel',
|
|
|
|
description: 'enable/disable auto hiding of whitebord toolbars',
|
|
|
|
},
|
2023-06-14 00:26:43 +08:00
|
|
|
wakeLockEnabledLabel: {
|
|
|
|
id: 'app.submenu.application.wakeLockEnabledLabel',
|
|
|
|
description: 'enable/disable wake lock',
|
|
|
|
},
|
2021-06-22 04:28:51 +08:00
|
|
|
layoutOptionLabel: {
|
|
|
|
id: 'app.submenu.application.layoutOptionLabel',
|
|
|
|
description: 'layout options',
|
|
|
|
},
|
2021-12-15 02:25:15 +08:00
|
|
|
pushLayoutLabel: {
|
|
|
|
id: 'app.submenu.application.pushLayoutLabel',
|
|
|
|
description: 'push layout togle',
|
|
|
|
},
|
2021-06-22 04:28:51 +08:00
|
|
|
customLayout: {
|
|
|
|
id: 'app.layout.style.custom',
|
|
|
|
description: 'label for custom layout style',
|
|
|
|
},
|
|
|
|
smartLayout: {
|
|
|
|
id: 'app.layout.style.smart',
|
|
|
|
description: 'label for smart layout style',
|
|
|
|
},
|
|
|
|
presentationFocusLayout: {
|
|
|
|
id: 'app.layout.style.presentationFocus',
|
|
|
|
description: 'label for presentationFocus layout style',
|
|
|
|
},
|
|
|
|
videoFocusLayout: {
|
|
|
|
id: 'app.layout.style.videoFocus',
|
|
|
|
description: 'label for videoFocus layout style',
|
|
|
|
},
|
2021-10-01 01:21:03 +08:00
|
|
|
presentationFocusPushLayout: {
|
|
|
|
id: 'app.layout.style.presentationFocusPush',
|
|
|
|
description: 'label for presentationFocus layout style (push to all)',
|
|
|
|
},
|
|
|
|
videoFocusPushLayout: {
|
|
|
|
id: 'app.layout.style.videoFocusPush',
|
|
|
|
description: 'label for videoFocus layout style (push to all)',
|
|
|
|
},
|
2021-10-24 23:23:34 +08:00
|
|
|
smartPushLayout: {
|
|
|
|
id: 'app.layout.style.smartPush',
|
|
|
|
description: 'label for smart layout style (push to all)',
|
|
|
|
},
|
|
|
|
customPushLayout: {
|
|
|
|
id: 'app.layout.style.customPush',
|
|
|
|
description: 'label for custom layout style (push to all)',
|
|
|
|
},
|
2017-04-11 05:11:48 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
class ApplicationMenu extends BaseMenu {
|
2019-01-04 01:14:45 +08:00
|
|
|
static setHtmlFontSize(size) {
|
|
|
|
document.getElementsByTagName('html')[0].style.fontSize = size;
|
|
|
|
}
|
|
|
|
|
2016-05-06 05:14:39 +08:00
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
2018-01-31 00:41:45 +08:00
|
|
|
|
2017-02-25 04:19:53 +08:00
|
|
|
this.state = {
|
|
|
|
settingsName: 'application',
|
|
|
|
settings: props.settings,
|
2018-03-02 01:21:19 +08:00
|
|
|
isLargestFontSize: false,
|
|
|
|
isSmallestFontSize: false,
|
2020-05-14 01:05:59 +08:00
|
|
|
showSelect: false,
|
2019-01-04 01:14:45 +08:00
|
|
|
fontSizes: [
|
|
|
|
'12px',
|
|
|
|
'14px',
|
|
|
|
'16px',
|
|
|
|
'18px',
|
|
|
|
'20px',
|
|
|
|
],
|
2021-01-23 03:30:42 +08:00
|
|
|
audioFilterEnabled: ApplicationMenu.isAudioFilterEnabled(props
|
|
|
|
.settings.microphoneConstraints),
|
2017-02-25 04:19:53 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2019-01-04 01:14:45 +08:00
|
|
|
componentDidMount() {
|
|
|
|
this.setInitialFontSize();
|
|
|
|
}
|
|
|
|
|
2021-01-20 00:02:20 +08:00
|
|
|
componentWillUnmount() {
|
|
|
|
// fix Warning: Can't perform a React state update on an unmounted component
|
2021-08-09 22:24:02 +08:00
|
|
|
this.setState = () => {};
|
2021-01-20 00:02:20 +08:00
|
|
|
}
|
|
|
|
|
2019-01-04 01:14:45 +08:00
|
|
|
setInitialFontSize() {
|
|
|
|
const { fontSizes } = this.state;
|
|
|
|
const clientFont = document.getElementsByTagName('html')[0].style.fontSize;
|
|
|
|
const hasFont = fontSizes.includes(clientFont);
|
|
|
|
if (!hasFont) {
|
|
|
|
fontSizes.push(clientFont);
|
|
|
|
fontSizes.sort();
|
|
|
|
}
|
|
|
|
const fontIndex = fontSizes.indexOf(clientFont);
|
|
|
|
this.changeFontSize(clientFont);
|
|
|
|
this.setState({
|
|
|
|
isSmallestFontSize: fontIndex <= MIN_FONTSIZE,
|
|
|
|
isLargestFontSize: fontIndex >= (fontSizes.length - 1),
|
|
|
|
fontSizes,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-01-23 03:30:42 +08:00
|
|
|
static isAudioFilterEnabled(_constraints) {
|
|
|
|
if (typeof _constraints === 'undefined') return true;
|
|
|
|
|
|
|
|
const _isConstraintEnabled = (constraintValue) => {
|
|
|
|
switch (typeof constraintValue) {
|
|
|
|
case 'boolean':
|
|
|
|
return constraintValue;
|
|
|
|
case 'string':
|
|
|
|
return constraintValue === 'true';
|
|
|
|
case 'object':
|
|
|
|
return !!(constraintValue.exact || constraintValue.ideal);
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
let isAnyFilterEnabled = true;
|
|
|
|
|
|
|
|
const constraints = _constraints && (typeof _constraints.advanced === 'object')
|
|
|
|
? _constraints.advanced
|
|
|
|
: _constraints || {};
|
|
|
|
|
|
|
|
isAnyFilterEnabled = Object.values(constraints).find(
|
2021-08-09 22:24:02 +08:00
|
|
|
(constraintValue) => _isConstraintEnabled(constraintValue),
|
2021-01-23 03:30:42 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
return isAnyFilterEnabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
handleAudioFilterChange() {
|
|
|
|
const _audioFilterEnabled = !ApplicationMenu.isAudioFilterEnabled(this
|
|
|
|
.state.settings.microphoneConstraints);
|
|
|
|
const _newConstraints = {
|
|
|
|
autoGainControl: _audioFilterEnabled,
|
|
|
|
echoCancellation: _audioFilterEnabled,
|
|
|
|
noiseSuppression: _audioFilterEnabled,
|
|
|
|
};
|
|
|
|
|
|
|
|
const obj = this.state;
|
|
|
|
obj.settings.microphoneConstraints = _newConstraints;
|
|
|
|
this.handleUpdateSettings(this.state.settings, obj.settings);
|
|
|
|
}
|
|
|
|
|
2017-02-25 04:19:53 +08:00
|
|
|
handleUpdateFontSize(size) {
|
2017-06-03 03:25:02 +08:00
|
|
|
const obj = this.state;
|
2017-02-25 04:19:53 +08:00
|
|
|
obj.settings.fontSize = size;
|
|
|
|
this.handleUpdateSettings(this.state.settingsName, obj.settings);
|
|
|
|
}
|
|
|
|
|
|
|
|
changeFontSize(size) {
|
2021-08-05 19:03:24 +08:00
|
|
|
const { layoutContextDispatch } = this.props;
|
2017-06-03 03:25:02 +08:00
|
|
|
const obj = this.state;
|
2017-02-25 04:19:53 +08:00
|
|
|
obj.settings.fontSize = size;
|
|
|
|
this.setState(obj, () => {
|
2019-01-04 01:14:45 +08:00
|
|
|
ApplicationMenu.setHtmlFontSize(this.state.settings.fontSize);
|
2017-02-25 04:19:53 +08:00
|
|
|
this.handleUpdateFontSize(this.state.settings.fontSize);
|
|
|
|
});
|
2021-06-19 02:32:46 +08:00
|
|
|
|
2021-08-05 19:03:24 +08:00
|
|
|
layoutContextDispatch({
|
2021-06-19 02:32:46 +08:00
|
|
|
type: ACTIONS.SET_FONT_SIZE,
|
2021-08-09 22:24:02 +08:00
|
|
|
value: parseInt(size.slice(0, -2), 10),
|
2021-06-19 02:32:46 +08:00
|
|
|
});
|
2016-05-06 05:14:39 +08:00
|
|
|
}
|
|
|
|
|
2017-02-25 04:19:53 +08:00
|
|
|
handleIncreaseFontSize() {
|
|
|
|
const currentFontSize = this.state.settings.fontSize;
|
2019-01-04 01:14:45 +08:00
|
|
|
const availableFontSizes = this.state.fontSizes;
|
|
|
|
const maxFontSize = availableFontSizes.length - 1;
|
|
|
|
const canIncreaseFontSize = availableFontSizes.indexOf(currentFontSize) < maxFontSize;
|
|
|
|
const fs = canIncreaseFontSize ? availableFontSizes.indexOf(currentFontSize) + 1 : maxFontSize;
|
2017-02-25 04:19:53 +08:00
|
|
|
this.changeFontSize(availableFontSizes[fs]);
|
2019-01-04 01:14:45 +08:00
|
|
|
if (fs === maxFontSize) this.setState({ isLargestFontSize: true });
|
2018-03-02 01:21:19 +08:00
|
|
|
this.setState({ isSmallestFontSize: false });
|
2017-06-03 03:25:02 +08:00
|
|
|
}
|
2017-02-25 04:19:53 +08:00
|
|
|
|
|
|
|
handleDecreaseFontSize() {
|
|
|
|
const currentFontSize = this.state.settings.fontSize;
|
2019-01-04 01:14:45 +08:00
|
|
|
const availableFontSizes = this.state.fontSizes;
|
2017-02-25 04:19:53 +08:00
|
|
|
const canDecreaseFontSize = availableFontSizes.indexOf(currentFontSize) > MIN_FONTSIZE;
|
2018-01-30 19:20:51 +08:00
|
|
|
const fs = canDecreaseFontSize ? availableFontSizes.indexOf(currentFontSize) - 1 : MIN_FONTSIZE;
|
2017-02-25 04:19:53 +08:00
|
|
|
this.changeFontSize(availableFontSizes[fs]);
|
2018-03-02 01:21:19 +08:00
|
|
|
if (fs === MIN_FONTSIZE) this.setState({ isSmallestFontSize: true });
|
|
|
|
this.setState({ isLargestFontSize: false });
|
2017-06-03 03:25:02 +08:00
|
|
|
}
|
2017-02-25 04:19:53 +08:00
|
|
|
|
2021-06-22 04:28:51 +08:00
|
|
|
handleSelectChange(fieldname, e) {
|
2017-06-03 03:25:02 +08:00
|
|
|
const obj = this.state;
|
2021-01-28 03:50:48 +08:00
|
|
|
obj.settings[fieldname] = e.target.value;
|
2017-04-06 20:36:59 +08:00
|
|
|
this.handleUpdateSettings('application', obj.settings);
|
|
|
|
}
|
|
|
|
|
2021-05-06 22:41:19 +08:00
|
|
|
renderAudioFilters() {
|
|
|
|
let audioFilterOption = null;
|
|
|
|
|
|
|
|
if (SHOW_AUDIO_FILTERS) {
|
|
|
|
const { intl, showToggleLabel, displaySettingsStatus } = this.props;
|
|
|
|
const { settings } = this.state;
|
|
|
|
const audioFilterStatus = ApplicationMenu
|
|
|
|
.isAudioFilterEnabled(settings.microphoneConstraints);
|
|
|
|
|
|
|
|
audioFilterOption = (
|
2021-11-05 21:46:14 +08:00
|
|
|
<Styled.Row>
|
|
|
|
<Styled.Col aria-hidden="true">
|
|
|
|
<Styled.FormElement>
|
|
|
|
<Styled.Label>
|
2021-05-06 22:41:19 +08:00
|
|
|
{intl.formatMessage(intlMessages.audioFilterLabel)}
|
2021-11-05 21:46:14 +08:00
|
|
|
</Styled.Label>
|
|
|
|
</Styled.FormElement>
|
|
|
|
</Styled.Col>
|
|
|
|
<Styled.Col>
|
|
|
|
<Styled.FormElementRight>
|
2021-05-06 22:41:19 +08:00
|
|
|
{displaySettingsStatus(audioFilterStatus)}
|
|
|
|
<Toggle
|
|
|
|
icons={false}
|
|
|
|
defaultChecked={this.state.audioFilterEnabled}
|
|
|
|
onChange={() => this.handleAudioFilterChange()}
|
2022-12-17 00:02:46 +08:00
|
|
|
ariaLabel={`${intl.formatMessage(intlMessages.audioFilterLabel)} - ${displaySettingsStatus(audioFilterStatus, true)}`}
|
2021-05-06 22:41:19 +08:00
|
|
|
showToggleLabel={showToggleLabel}
|
|
|
|
/>
|
2021-11-05 21:46:14 +08:00
|
|
|
</Styled.FormElementRight>
|
|
|
|
</Styled.Col>
|
|
|
|
</Styled.Row>
|
2021-05-06 22:41:19 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return audioFilterOption;
|
|
|
|
}
|
|
|
|
|
2020-08-29 03:29:45 +08:00
|
|
|
renderPaginationToggle() {
|
|
|
|
// See VideoService's method for an explanation
|
2021-08-09 22:24:02 +08:00
|
|
|
if (!VideoService.shouldRenderPaginationToggle()) return false;
|
2020-08-29 03:29:45 +08:00
|
|
|
|
2021-05-01 03:06:28 +08:00
|
|
|
const { intl, showToggleLabel, displaySettingsStatus } = this.props;
|
|
|
|
const { settings } = this.state;
|
2020-08-29 03:29:45 +08:00
|
|
|
|
|
|
|
return (
|
2021-11-05 21:46:14 +08:00
|
|
|
<Styled.Row>
|
|
|
|
<Styled.Col aria-hidden="true">
|
|
|
|
<Styled.FormElement>
|
2021-08-09 22:24:02 +08:00
|
|
|
{/* eslint-disable-next-line jsx-a11y/label-has-associated-control */}
|
2021-11-05 21:46:14 +08:00
|
|
|
<Styled.Label>
|
2020-08-29 03:29:45 +08:00
|
|
|
{intl.formatMessage(intlMessages.paginationEnabledLabel)}
|
2021-11-05 21:46:14 +08:00
|
|
|
</Styled.Label>
|
|
|
|
</Styled.FormElement>
|
|
|
|
</Styled.Col>
|
|
|
|
<Styled.Col>
|
|
|
|
<Styled.FormElementRight>
|
2021-05-01 03:06:28 +08:00
|
|
|
{displaySettingsStatus(settings.paginationEnabled)}
|
2020-08-29 03:29:45 +08:00
|
|
|
<Toggle
|
|
|
|
icons={false}
|
2021-05-01 03:06:28 +08:00
|
|
|
defaultChecked={settings.paginationEnabled}
|
2020-08-29 03:29:45 +08:00
|
|
|
onChange={() => this.handleToggle('paginationEnabled')}
|
2022-12-17 00:02:46 +08:00
|
|
|
ariaLabel={`${intl.formatMessage(intlMessages.paginationEnabledLabel)} - ${displaySettingsStatus(settings.paginationEnabled, true)}`}
|
2021-05-01 03:06:28 +08:00
|
|
|
showToggleLabel={showToggleLabel}
|
2020-08-29 03:29:45 +08:00
|
|
|
/>
|
2021-11-05 21:46:14 +08:00
|
|
|
</Styled.FormElementRight>
|
|
|
|
</Styled.Col>
|
|
|
|
</Styled.Row>
|
2020-08-29 03:29:45 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-04-09 03:05:29 +08:00
|
|
|
renderDarkThemeToggle() {
|
|
|
|
const { intl, showToggleLabel, displaySettingsStatus } = this.props;
|
|
|
|
const { settings } = this.state;
|
|
|
|
|
|
|
|
const isDarkThemeEnabled = Meteor.settings.public.app.darkTheme.enabled;
|
|
|
|
if (!isDarkThemeEnabled) return null;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Styled.Row>
|
|
|
|
<Styled.Col aria-hidden="true">
|
|
|
|
<Styled.FormElement>
|
|
|
|
{/* eslint-disable-next-line jsx-a11y/label-has-associated-control */}
|
|
|
|
<Styled.Label>
|
|
|
|
{intl.formatMessage(intlMessages.darkThemeLabel)}
|
|
|
|
</Styled.Label>
|
|
|
|
</Styled.FormElement>
|
|
|
|
</Styled.Col>
|
|
|
|
<Styled.Col>
|
|
|
|
<Styled.FormElementRight>
|
|
|
|
{displaySettingsStatus(settings.darkTheme)}
|
|
|
|
<Toggle
|
|
|
|
icons={false}
|
|
|
|
defaultChecked={settings.darkTheme}
|
|
|
|
onChange={() => this.handleToggle('darkTheme')}
|
|
|
|
showToggleLabel={showToggleLabel}
|
2022-12-17 00:02:46 +08:00
|
|
|
ariaLabel={`${intl.formatMessage(intlMessages.darkThemeLabel)} - ${displaySettingsStatus(settings.darkTheme, true)}`}
|
2022-11-11 04:25:18 +08:00
|
|
|
data-test="darkModeToggleBtn"
|
2022-04-09 03:05:29 +08:00
|
|
|
/>
|
|
|
|
</Styled.FormElementRight>
|
|
|
|
</Styled.Col>
|
|
|
|
</Styled.Row>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2023-06-14 00:26:43 +08:00
|
|
|
renderWakeLockToggle() {
|
|
|
|
if (!WakeLockService.isSupported()) return null;
|
|
|
|
|
|
|
|
const { intl, showToggleLabel, displaySettingsStatus } = this.props;
|
|
|
|
const { settings } = this.state;
|
|
|
|
|
|
|
|
return (
|
|
|
|
<Styled.Row>
|
|
|
|
<Styled.Col>
|
|
|
|
<Styled.FormElement>
|
|
|
|
{/* eslint-disable-next-line jsx-a11y/label-has-associated-control */}
|
|
|
|
<Styled.Label>
|
|
|
|
{intl.formatMessage(intlMessages.wakeLockEnabledLabel)}
|
|
|
|
</Styled.Label>
|
|
|
|
</Styled.FormElement>
|
|
|
|
</Styled.Col>
|
|
|
|
<Styled.Col>
|
|
|
|
<Styled.FormElementRight>
|
|
|
|
{displaySettingsStatus(settings.wakeLockEnabled)}
|
|
|
|
<Toggle
|
|
|
|
icons={false}
|
|
|
|
defaultChecked={settings.wakeLockEnabled}
|
|
|
|
onChange={() => this.handleToggle('wakeLockEnabled')}
|
|
|
|
ariaLabel={intl.formatMessage(intlMessages.wakeLockEnabledLabel)}
|
|
|
|
showToggleLabel={showToggleLabel}
|
|
|
|
/>
|
|
|
|
</Styled.FormElementRight>
|
|
|
|
</Styled.Col>
|
|
|
|
</Styled.Row>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2017-01-27 23:41:11 +08:00
|
|
|
render() {
|
2021-05-01 03:06:28 +08:00
|
|
|
const {
|
|
|
|
allLocales, intl, showToggleLabel, displaySettingsStatus,
|
|
|
|
} = this.props;
|
2021-01-20 00:02:20 +08:00
|
|
|
const {
|
2021-01-28 03:50:48 +08:00
|
|
|
isLargestFontSize, isSmallestFontSize, settings,
|
2021-01-20 00:02:20 +08:00
|
|
|
} = this.state;
|
2019-05-08 23:11:55 +08:00
|
|
|
|
|
|
|
// conversions can be found at http://pxtoem.com
|
2019-05-03 21:43:02 +08:00
|
|
|
const pixelPercentage = {
|
2019-05-08 23:11:55 +08:00
|
|
|
'12px': '75%',
|
|
|
|
// 14px is actually 87.5%, rounding up to show more friendly value
|
|
|
|
'14px': '90%',
|
|
|
|
'16px': '100%',
|
|
|
|
// 18px is actually 112.5%, rounding down to show more friendly value
|
|
|
|
'18px': '110%',
|
|
|
|
'20px': '125%',
|
2019-05-03 21:43:02 +08:00
|
|
|
};
|
2017-04-06 20:36:59 +08:00
|
|
|
|
2019-05-24 05:50:36 +08:00
|
|
|
const ariaValueLabel = intl.formatMessage(intlMessages.currentValue, { 0: `${pixelPercentage[settings.fontSize]}` });
|
|
|
|
|
2021-01-30 00:17:35 +08:00
|
|
|
const showSelect = allLocales && allLocales.length > 0;
|
2021-01-28 03:50:48 +08:00
|
|
|
|
2016-05-06 05:14:39 +08:00
|
|
|
return (
|
2018-12-06 01:42:31 +08:00
|
|
|
<div>
|
|
|
|
<div>
|
2021-11-05 21:46:14 +08:00
|
|
|
<Styled.Title>
|
2017-04-19 03:14:39 +08:00
|
|
|
{intl.formatMessage(intlMessages.applicationSectionTitle)}
|
2021-11-05 21:46:14 +08:00
|
|
|
</Styled.Title>
|
2017-01-27 23:41:11 +08:00
|
|
|
</div>
|
2021-11-05 21:46:14 +08:00
|
|
|
<Styled.Form>
|
|
|
|
<Styled.Row>
|
|
|
|
<Styled.Col aria-hidden="true">
|
|
|
|
<Styled.FormElement>
|
2021-08-09 22:24:02 +08:00
|
|
|
{/* eslint-disable-next-line jsx-a11y/label-has-associated-control */}
|
2021-11-05 21:46:14 +08:00
|
|
|
<Styled.Label>
|
2019-01-25 00:16:23 +08:00
|
|
|
{intl.formatMessage(intlMessages.animationsLabel)}
|
2021-11-05 21:46:14 +08:00
|
|
|
</Styled.Label>
|
|
|
|
</Styled.FormElement>
|
|
|
|
</Styled.Col>
|
|
|
|
<Styled.Col>
|
|
|
|
<Styled.FormElementRight>
|
2021-05-01 03:06:28 +08:00
|
|
|
{displaySettingsStatus(settings.animations)}
|
2019-01-25 00:16:23 +08:00
|
|
|
<Toggle
|
|
|
|
icons={false}
|
2021-05-01 03:06:28 +08:00
|
|
|
defaultChecked={settings.animations}
|
2019-01-25 00:16:23 +08:00
|
|
|
onChange={() => this.handleToggle('animations')}
|
2022-12-17 00:02:46 +08:00
|
|
|
ariaLabel={`${intl.formatMessage(intlMessages.animationsLabel)} - ${displaySettingsStatus(settings.animations, true)}`}
|
2021-05-01 03:06:28 +08:00
|
|
|
showToggleLabel={showToggleLabel}
|
2019-01-25 00:16:23 +08:00
|
|
|
/>
|
2021-11-05 21:46:14 +08:00
|
|
|
</Styled.FormElementRight>
|
|
|
|
</Styled.Col>
|
|
|
|
</Styled.Row>
|
2019-01-25 00:16:23 +08:00
|
|
|
|
2021-05-06 22:41:19 +08:00
|
|
|
{this.renderAudioFilters()}
|
2020-08-29 03:29:45 +08:00
|
|
|
{this.renderPaginationToggle()}
|
2022-04-09 03:05:29 +08:00
|
|
|
{this.renderDarkThemeToggle()}
|
2023-06-14 00:26:43 +08:00
|
|
|
{this.renderWakeLockToggle()}
|
2020-08-29 03:29:45 +08:00
|
|
|
|
2023-03-27 06:08:09 +08:00
|
|
|
<Styled.Row>
|
|
|
|
<Styled.Col aria-hidden="true">
|
|
|
|
<Styled.FormElement>
|
|
|
|
{/* eslint-disable-next-line jsx-a11y/label-has-associated-control */}
|
|
|
|
<Styled.Label>
|
|
|
|
{intl.formatMessage(intlMessages.wbToolbarsAutoHideLabel)}
|
|
|
|
</Styled.Label>
|
|
|
|
</Styled.FormElement>
|
|
|
|
</Styled.Col>
|
|
|
|
<Styled.Col>
|
|
|
|
<Styled.FormElementRight>
|
|
|
|
{displaySettingsStatus(settings.whiteboardToolbarAutoHide)}
|
|
|
|
<Toggle
|
|
|
|
icons={false}
|
|
|
|
defaultChecked={settings.whiteboardToolbarAutoHide}
|
|
|
|
onChange={() => this.handleToggle('whiteboardToolbarAutoHide')}
|
|
|
|
ariaLabel={`${intl.formatMessage(intlMessages.wbToolbarsAutoHideLabel)} - ${displaySettingsStatus(settings.whiteboardToolbarAutoHide, true)}`}
|
|
|
|
showToggleLabel={showToggleLabel}
|
|
|
|
/>
|
|
|
|
</Styled.FormElementRight>
|
|
|
|
</Styled.Col>
|
|
|
|
</Styled.Row>
|
|
|
|
|
2021-11-05 21:46:14 +08:00
|
|
|
<Styled.Row>
|
|
|
|
<Styled.Col>
|
|
|
|
<Styled.FormElement>
|
2022-12-17 00:02:46 +08:00
|
|
|
<Styled.Label aria-hidden>
|
2017-04-22 03:04:46 +08:00
|
|
|
{intl.formatMessage(intlMessages.languageLabel)}
|
2021-11-05 21:46:14 +08:00
|
|
|
</Styled.Label>
|
|
|
|
</Styled.FormElement>
|
|
|
|
</Styled.Col>
|
|
|
|
<Styled.Col>
|
|
|
|
<Styled.FormElementRight>
|
2020-05-14 01:05:59 +08:00
|
|
|
{showSelect ? (
|
2021-11-05 21:46:14 +08:00
|
|
|
<Styled.LocalesDropdownSelect>
|
|
|
|
<LocalesDropdown
|
|
|
|
allLocales={allLocales}
|
|
|
|
handleChange={(e) => this.handleSelectChange('locale', e)}
|
|
|
|
value={settings.locale}
|
|
|
|
elementId="langSelector"
|
2022-12-17 00:02:46 +08:00
|
|
|
ariaLabel={intl.formatMessage(intlMessages.languageLabel)}
|
2021-11-05 21:46:14 +08:00
|
|
|
selectMessage={intl.formatMessage(intlMessages.languageOptionLabel)}
|
|
|
|
/>
|
|
|
|
</Styled.LocalesDropdownSelect>
|
2021-06-22 04:28:51 +08:00
|
|
|
) : (
|
2021-11-05 21:46:14 +08:00
|
|
|
<Styled.SpinnerOverlay animations={animations}>
|
|
|
|
<Styled.Bounce1 animations={animations} />
|
|
|
|
<Styled.Bounce2 animations={animations} />
|
2021-06-22 04:28:51 +08:00
|
|
|
<div />
|
2021-11-05 21:46:14 +08:00
|
|
|
</Styled.SpinnerOverlay>
|
2021-06-22 04:28:51 +08:00
|
|
|
)}
|
2021-11-05 21:46:14 +08:00
|
|
|
</Styled.FormElementRight>
|
|
|
|
</Styled.Col>
|
|
|
|
</Styled.Row>
|
|
|
|
|
|
|
|
<Styled.Separator />
|
|
|
|
<Styled.Row>
|
|
|
|
<Styled.Col>
|
|
|
|
<Styled.FormElement>
|
2021-08-09 22:24:02 +08:00
|
|
|
{/* eslint-disable-next-line jsx-a11y/label-has-associated-control */}
|
2021-11-05 21:46:14 +08:00
|
|
|
<Styled.Label>
|
2017-04-11 05:11:48 +08:00
|
|
|
{intl.formatMessage(intlMessages.fontSizeControlLabel)}
|
2021-11-05 21:46:14 +08:00
|
|
|
</Styled.Label>
|
|
|
|
</Styled.FormElement>
|
|
|
|
</Styled.Col>
|
|
|
|
<Styled.Col>
|
|
|
|
<Styled.FormElementCenter aria-hidden>
|
2021-08-09 22:24:02 +08:00
|
|
|
{/* eslint-disable-next-line jsx-a11y/label-has-associated-control */}
|
2021-11-05 21:46:14 +08:00
|
|
|
<Styled.BoldLabel>
|
2021-05-01 03:06:28 +08:00
|
|
|
{`${pixelPercentage[settings.fontSize]}`}
|
2021-11-05 21:46:14 +08:00
|
|
|
</Styled.BoldLabel>
|
|
|
|
</Styled.FormElementCenter>
|
|
|
|
</Styled.Col>
|
|
|
|
<Styled.Col>
|
|
|
|
<Styled.FormElementRight>
|
|
|
|
<Styled.PullContentRight>
|
|
|
|
<Styled.Col>
|
2017-03-09 22:34:33 +08:00
|
|
|
<Button
|
2018-12-14 05:47:43 +08:00
|
|
|
onClick={() => this.handleDecreaseFontSize()}
|
2017-12-01 03:17:03 +08:00
|
|
|
color="primary"
|
2018-12-14 05:47:43 +08:00
|
|
|
icon="substract"
|
2017-06-03 03:25:02 +08:00
|
|
|
circle
|
|
|
|
hideLabel
|
2018-12-14 05:47:43 +08:00
|
|
|
label={intl.formatMessage(intlMessages.decreaseFontBtnLabel)}
|
2019-05-24 05:50:36 +08:00
|
|
|
aria-label={`${intl.formatMessage(intlMessages.decreaseFontBtnLabel)}, ${ariaValueLabel}`}
|
2018-12-14 05:47:43 +08:00
|
|
|
disabled={isSmallestFontSize}
|
2023-01-19 00:29:45 +08:00
|
|
|
data-test="decreaseFontSize"
|
2017-03-09 22:34:33 +08:00
|
|
|
/>
|
2021-11-05 21:46:14 +08:00
|
|
|
</Styled.Col>
|
|
|
|
<Styled.Col>
|
2017-03-09 22:34:33 +08:00
|
|
|
<Button
|
2018-12-14 05:47:43 +08:00
|
|
|
onClick={() => this.handleIncreaseFontSize()}
|
2017-12-01 03:17:03 +08:00
|
|
|
color="primary"
|
2018-12-14 05:47:43 +08:00
|
|
|
icon="add"
|
2017-06-03 03:25:02 +08:00
|
|
|
circle
|
|
|
|
hideLabel
|
2018-12-14 05:47:43 +08:00
|
|
|
label={intl.formatMessage(intlMessages.increaseFontBtnLabel)}
|
2019-05-24 05:50:36 +08:00
|
|
|
aria-label={`${intl.formatMessage(intlMessages.increaseFontBtnLabel)}, ${ariaValueLabel}`}
|
2018-12-14 05:47:43 +08:00
|
|
|
disabled={isLargestFontSize}
|
2023-01-19 00:29:45 +08:00
|
|
|
data-test="increaseFontSize"
|
2017-03-09 22:34:33 +08:00
|
|
|
/>
|
2021-11-05 21:46:14 +08:00
|
|
|
</Styled.Col>
|
|
|
|
</Styled.PullContentRight>
|
|
|
|
</Styled.FormElementRight>
|
|
|
|
</Styled.Col>
|
|
|
|
</Styled.Row>
|
|
|
|
</Styled.Form>
|
2016-05-06 05:14:39 +08:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
2017-06-03 03:25:02 +08:00
|
|
|
}
|
2017-04-11 05:11:48 +08:00
|
|
|
|
|
|
|
export default injectIntl(ApplicationMenu);
|