Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
ref(ui-components) Replace Switch with new components (#11956)
Robert Pintilii3a87282e268d
diff --git a/react/features/speaker-stats/components/web/FaceExpressionsSwitch.js b/react/features/speaker-stats/components/web/FaceExpressionsSwitch.jsdeleted file mode 100644index c9eea382a9..0000000000--- a/react/features/speaker-stats/components/web/FaceExpressionsSwitch.js+++ /dev/null@@ -1,97 +0,0 @@-// @flow-import { makeStyles } from '@material-ui/core/styles';-import React from 'react';-import { useTranslation } from 'react-i18next';--import { Switch } from '../../../base/react';---const useStyles = makeStyles(theme => {- return {- switchContainer: {- display: 'flex',- alignItems: 'center',- '& svg': {- display: 'none'-- },- '& div': {- width: 38,- '& > label': {- width: 32,- height: 20,- backgroundColor: theme.palette.ui05,- '&:not([data-checked]):hover': {- backgroundColor: theme.palette.ui05- },- '&[data-checked]': {- backgroundColor: theme.palette.action01,- '&:hover': {- backgroundColor: theme.palette.action01- },- '&::before': {- margin: '0 0 1.5px -3px',- backgroundColor: theme.palette.text01- }- },- '&:focus-within': {- borderColor: 'transparent'- },- '&::before': {- width: 14,- height: 14,- margin: '0 0 1.5px 1.5px',- backgroundColor: theme.palette.text01- }- }- }- },- switchLabel: {- marginRight: 10,- ...theme.typography.bodyShortRegular,- lineHeight: `${theme.typography.bodyShortRegular.lineHeight}px`- }- };-});--/**- * The type of the React {@code Component} props of {@link ToggleFaceExpressionsButton}.- */-type Props = {-- /**- * The function to initiate the change in the speaker stats table.- */- onChange: Function,-- /**- * The state of the button.- */- showFaceExpressions: boolean,--};--/**- * React component for toggling face expressions grid.- *- * @returns {React$Element<any>}- */-export default function FaceExpressionsSwitch({ onChange, showFaceExpressions }: Props) {- const classes = useStyles();- const { t } = useTranslation();-- return (- <div className = { classes.switchContainer } >- <label- className = { classes.switchLabel }- htmlFor = 'face-expressions-switch'>- { t('speakerStats.displayEmotions')}- </label>- <Switch- id = 'face-expressions-switch'- onValueChange = { onChange }- trackColor = {{ false: 'blue' }}- value = { showFaceExpressions } />- </div>- );-}diff --git a/react/features/speaker-stats/components/web/FaceExpressionsSwitch.tsx b/react/features/speaker-stats/components/web/FaceExpressionsSwitch.tsxnew file mode 100644index 0000000000..5b9b446d28--- /dev/null+++ b/react/features/speaker-stats/components/web/FaceExpressionsSwitch.tsx@@ -0,0 +1,63 @@+import { makeStyles } from '@material-ui/core/styles';+import React from 'react';+import { useTranslation } from 'react-i18next';++import Switch from '../../../base/ui/components/web/Switch';+import { Theme } from '../../../base/ui/types';++// @ts-ignore+const useStyles = makeStyles((theme: Theme) => {+ return {+ switchContainer: {+ display: 'flex',+ alignItems: 'center'+ },++ switchLabel: {+ marginRight: 10,+ ...theme.typography.bodyShortRegular,+ lineHeight: `${theme.typography.bodyShortRegular.lineHeight}px`+ }+ };+});++/**+ * The type of the React {@code Component} props of {@link ToggleFaceExpressionsButton}.+ */+type Props = {++ /**+ * The function to initiate the change in the speaker stats table.+ */+ onChange: (checked?: boolean) => void,++ /**+ * The state of the button.+ */+ showFaceExpressions: boolean,++};++/**+ * React component for toggling face expressions grid.+ *+ * @returns {React$Element<any>}+ */+export default function FaceExpressionsSwitch({ onChange, showFaceExpressions }: Props) {+ const classes = useStyles();+ const { t } = useTranslation();++ return (+ <div className = { classes.switchContainer } >+ <label+ className = { classes.switchLabel }+ htmlFor = 'face-expressions-switch'>+ { t('speakerStats.displayEmotions')}+ </label>+ <Switch+ checked = { showFaceExpressions }+ id = 'face-expressions-switch'+ onChange = { onChange } />+ </div>+ );+}diff --git a/react/features/video-menu/components/web/MuteEveryoneDialog.js b/react/features/video-menu/components/web/MuteEveryoneDialog.tsxsimilarity index 75%rename from react/features/video-menu/components/web/MuteEveryoneDialog.jsrename to react/features/video-menu/components/web/MuteEveryoneDialog.tsxindex 46b47e1ae2..e0b9fb9302 100644--- a/react/features/video-menu/components/web/MuteEveryoneDialog.js+++ b/react/features/video-menu/components/web/MuteEveryoneDialog.tsx@@ -1,12 +1,13 @@-// @flow-+/* eslint-disable lines-around-comment */import React from 'react';+// @ts-ignoreimport { Dialog } from '../../../base/dialog';-import { translate } from '../../../base/i18n';-import { Switch } from '../../../base/react';-import { connect } from '../../../base/redux';+import { translate } from '../../../base/i18n/functions';+import { connect } from '../../../base/redux/functions';+import Switch from '../../../base/ui/components/web/Switch';import AbstractMuteEveryoneDialog, { abstractMapStateToProps, type Props }+// @ts-ignorefrom '../AbstractMuteEveryoneDialog';/**@@ -23,9 +24,11 @@ class MuteEveryoneDialog extends AbstractMuteEveryoneDialog<Props> {* @returns {void}*/_onToggleModeration() {+ // @ts-ignorethis.setState(state => {return {audioModerationEnabled: !state.audioModerationEnabled,+ // @ts-ignorecontent: this.props.t(state.audioModerationEnabled? 'dialog.muteEveryoneDialog' : 'dialog.muteEveryoneDialogModerationOn')@@ -44,21 +47,26 @@ class MuteEveryoneDialog extends AbstractMuteEveryoneDialog<Props> {<DialogokKey = 'dialog.muteParticipantButton'onSubmit = { this._onSubmit }+ // @ts-ignoretitleString = { this.props.title }width = 'small'><div className = 'mute-dialog'>+ {/* @ts-ignore */}{ this.state.content }+ {/* @ts-ignore */}{ this.props.isModerationSupported && this.props.exclude.length === 0 && (<><div className = 'separator-line' /><div className = 'control-row'><label htmlFor = 'moderation-switch'>+ {/* @ts-ignore */}{this.props.t('dialog.moderationAudioLabel')}</label><Switch+ // @ts-ignore+ checked = { !this.state.audioModerationEnabled }id = 'moderation-switch'- onValueChange = { this._onToggleModeration }- value = { !this.state.audioModerationEnabled } />+ onChange = { this._onToggleModeration } /></div></>)}@@ -70,4 +78,5 @@ class MuteEveryoneDialog extends AbstractMuteEveryoneDialog<Props> {_onSubmit: () => boolean;}+// @ts-ignoreexport default translate(connect(abstractMapStateToProps)(MuteEveryoneDialog));diff --git a/react/features/video-menu/components/web/MuteEveryonesVideoDialog.js b/react/features/video-menu/components/web/MuteEveryonesVideoDialog.tsxsimilarity index 76%rename from react/features/video-menu/components/web/MuteEveryonesVideoDialog.jsrename to react/features/video-menu/components/web/MuteEveryonesVideoDialog.tsxindex af75d04ad0..dd30e41713 100644--- a/react/features/video-menu/components/web/MuteEveryonesVideoDialog.js+++ b/react/features/video-menu/components/web/MuteEveryonesVideoDialog.tsx@@ -1,12 +1,13 @@-// @flow-+/* eslint-disable lines-around-comment */import React from 'react';+// @ts-ignoreimport { Dialog } from '../../../base/dialog';-import { translate } from '../../../base/i18n';-import { Switch } from '../../../base/react';-import { connect } from '../../../base/redux';+import { translate } from '../../../base/i18n/functions';+import { connect } from '../../../base/redux/functions';+import Switch from '../../../base/ui/components/web/Switch';import AbstractMuteEveryonesVideoDialog, { abstractMapStateToProps, type Props }+// @ts-ignorefrom '../AbstractMuteEveryonesVideoDialog';/**@@ -23,9 +24,11 @@ class MuteEveryonesVideoDialog extends AbstractMuteEveryonesVideoDialog<Props> {* @returns {void}*/_onToggleModeration() {+ // @ts-ignorethis.setState(state => {return {moderationEnabled: !state.moderationEnabled,+ // @ts-ignorecontent: this.props.t(state.moderationEnabled? 'dialog.muteEveryonesVideoDialog' : 'dialog.muteEveryonesVideoDialogModerationOn')@@ -44,21 +47,26 @@ class MuteEveryonesVideoDialog extends AbstractMuteEveryonesVideoDialog<Props> {<DialogokKey = 'dialog.muteParticipantsVideoButton'onSubmit = { this._onSubmit }+ // @ts-ignoretitleString = { this.props.title }width = 'small'><div className = 'mute-dialog'>+ {/* @ts-ignore */}{this.state.content}+ {/* @ts-ignore */}{ this.props.isModerationSupported && this.props.exclude.length === 0 && (<><div className = 'separator-line' /><div className = 'control-row'><label htmlFor = 'moderation-switch'>+ {/* @ts-ignore */}{this.props.t('dialog.moderationVideoLabel')}</label><Switch+ // @ts-ignore+ checked = { !this.state.moderationEnabled }id = 'moderation-switch'- onValueChange = { this._onToggleModeration }- value = { !this.state.moderationEnabled } />+ onChange = { this._onToggleModeration } /></div></>)}@@ -70,4 +78,5 @@ class MuteEveryonesVideoDialog extends AbstractMuteEveryonesVideoDialog<Props> {_onSubmit: () => boolean;}+// @ts-ignoreexport default translate(connect(abstractMapStateToProps)(MuteEveryonesVideoDialog));