瀏覽代碼

ref(ui-components) Use new Dialog component (#12349)

Convert some files to TS
Refactor MuteEveryone and MuteEveryonesVideo dialogs. Move shared code to abstract components. Remove unnecessary code
factor2
Robert Pintilii 2 年之前
父節點
當前提交
b858496adb
No account linked to committer's email address

+ 4
- 0
css/modals/_dialog.scss 查看文件

38
     margin-top: 2px;
38
     margin-top: 2px;
39
     display: block;
39
     display: block;
40
 }
40
 }
41
+
42
+.dialog-bottom-margin {
43
+    margin-bottom: 5px;
44
+}

+ 9
- 1
react/features/base/dialog/middleware.web.ts 查看文件

16
 // @ts-ignore
16
 // @ts-ignore
17
 import StopRecordingDialog from '../../recording/components/Recording/web/StopRecordingDialog';
17
 import StopRecordingDialog from '../../recording/components/Recording/web/StopRecordingDialog';
18
 import ShareAudioDialog from '../../screen-share/components/ShareAudioDialog';
18
 import ShareAudioDialog from '../../screen-share/components/ShareAudioDialog';
19
+import ShareScreenWarningDialog from '../../screen-share/components/ShareScreenWarningDialog';
20
+import SecurityDialog from '../../security/components/security-dialog/web/SecurityDialog';
21
+import SharedVideoDialog from '../../shared-video/components/web/SharedVideoDialog';
22
+import SpeakerStats from '../../speaker-stats/components/web/SpeakerStats';
23
+import LanguageSelectorDialog from '../../subtitles/components/LanguageSelectorDialog.web';
24
+import MuteEveryoneDialog from '../../video-menu/components/web/MuteEveryoneDialog';
25
+import MuteEveryonesVideoDialog from '../../video-menu/components/web/MuteEveryonesVideoDialog';
19
 import MiddlewareRegistry from '../redux/MiddlewareRegistry';
26
 import MiddlewareRegistry from '../redux/MiddlewareRegistry';
20
 
27
 
21
 import { OPEN_DIALOG } from './actionTypes';
28
 import { OPEN_DIALOG } from './actionTypes';
25
 
32
 
26
 const NEW_DIALOG_LIST = [ KeyboardShortcutsDialog, ChatPrivacyDialog, DisplayNamePrompt, EmbedMeetingDialog,
33
 const NEW_DIALOG_LIST = [ KeyboardShortcutsDialog, ChatPrivacyDialog, DisplayNamePrompt, EmbedMeetingDialog,
27
     FeedbackDialog, AddPeopleDialog, PremiumFeatureDialog, StartLiveStreamDialog, StopLiveStreamDialog,
34
     FeedbackDialog, AddPeopleDialog, PremiumFeatureDialog, StartLiveStreamDialog, StopLiveStreamDialog,
28
-    StartRecordingDialog, StopRecordingDialog, ShareAudioDialog ];
35
+    StartRecordingDialog, StopRecordingDialog, ShareAudioDialog, ShareScreenWarningDialog, SecurityDialog,
36
+    SharedVideoDialog, SpeakerStats, LanguageSelectorDialog, MuteEveryoneDialog, MuteEveryonesVideoDialog ];
29
 
37
 
30
 // This function is necessary while the transition from @atlaskit dialog to our component is ongoing.
38
 // This function is necessary while the transition from @atlaskit dialog to our component is ongoing.
31
 const isNewDialog = (component: any) => NEW_DIALOG_LIST.some(comp => comp === component);
39
 const isNewDialog = (component: any) => NEW_DIALOG_LIST.some(comp => comp === component);

+ 1
- 0
react/features/display-name/components/web/DisplayNamePrompt.tsx 查看文件

57
                 titleKey = 'dialog.displayNameRequired'>
57
                 titleKey = 'dialog.displayNameRequired'>
58
                 <Input
58
                 <Input
59
                     autoFocus = { true }
59
                     autoFocus = { true }
60
+                    className = 'dialog-bottom-margin'
60
                     label = { this.props.t('dialog.enterDisplayName') }
61
                     label = { this.props.t('dialog.enterDisplayName') }
61
                     name = 'displayName'
62
                     name = 'displayName'
62
                     onChange = { this._onDisplayNameChange }
63
                     onChange = { this._onDisplayNameChange }

react/features/screen-share/components/ShareScreenWarningDialog.js → react/features/screen-share/components/ShareScreenWarningDialog.tsx 查看文件

1
-// @flow
2
-
3
 import React, { Component } from 'react';
1
 import React, { Component } from 'react';
4
-import type { Dispatch } from 'redux';
5
-
6
-import { Dialog } from '../../base/dialog';
7
-import { translate } from '../../base/i18n';
8
-import { connect } from '../../base/redux';
9
-import { toggleScreensharing } from '../../base/tracks';
2
+import { WithTranslation } from 'react-i18next';
10
 
3
 
11
-export type Props = {
4
+import { IStore } from '../../app/types';
5
+import { translate } from '../../base/i18n/functions';
6
+import { connect } from '../../base/redux/functions';
7
+import { toggleScreensharing } from '../../base/tracks/actions';
8
+import Dialog from '../../base/ui/components/web/Dialog';
12
 
9
 
13
-    /**
14
-     * The redux {@code dispatch} function.
15
-     */
16
-     dispatch: Dispatch<any>,
10
+export interface Props extends WithTranslation {
17
 
11
 
18
     /**
12
     /**
19
      * Whether or not the dialog was opened for the audio screen sharing flow or the normal one.
13
      * Whether or not the dialog was opened for the audio screen sharing flow or the normal one.
20
      */
14
      */
21
-    _isAudioScreenShareWarning: Boolean,
15
+    _isAudioScreenShareWarning: Boolean;
22
 
16
 
23
     /**
17
     /**
24
-     * Invoked to obtain translated strings.
18
+     * The redux {@code dispatch} function.
25
      */
19
      */
26
-    t: Function
20
+    dispatch: IStore['dispatch'];
27
 }
21
 }
28
 
22
 
29
 /**
23
 /**
36
      *
30
      *
37
      * @inheritdoc
31
      * @inheritdoc
38
      */
32
      */
39
-    constructor(props) {
33
+    constructor(props: Props) {
40
         super(props);
34
         super(props);
41
 
35
 
42
         this._onStopSharing = this._onStopSharing.bind(this);
36
         this._onStopSharing = this._onStopSharing.bind(this);
43
     }
37
     }
44
 
38
 
45
-    _onStopSharing: () => boolean;
46
-
47
     /**
39
     /**
48
      * Stop current screen sharing session.
40
      * Stop current screen sharing session.
49
      *
41
      *
86
         }
78
         }
87
 
79
 
88
         return (<Dialog
80
         return (<Dialog
89
-            hideCancelButton = { false }
90
-            okKey = { t(stopSharing) }
81
+            ok = {{ translationKey: stopSharing }}
91
             onSubmit = { this._onStopSharing }
82
             onSubmit = { this._onStopSharing }
92
-            titleKey = { t(title) }
93
-            width = { 'small' }>
83
+            titleKey = { t(title) }>
94
             <div className = 'share-screen-warn-dialog'>
84
             <div className = 'share-screen-warn-dialog'>
95
                 <p className = 'header'> { t(header1) } </p>
85
                 <p className = 'header'> { t(header1) } </p>
96
                 <p className = 'description' > { t(description1) } </p>
86
                 <p className = 'description' > { t(description1) } </p>
99
                 <p className = 'description' > { t(description2) } </p>
89
                 <p className = 'description' > { t(description2) } </p>
100
             </div>
90
             </div>
101
         </Dialog>);
91
         </Dialog>);
102
-
103
     }
92
     }
104
 }
93
 }
105
 
94
 

+ 4
- 6
react/features/security/components/security-dialog/web/SecurityDialog.tsx 查看文件

4
 import { IState } from '../../../../app/types';
4
 import { IState } from '../../../../app/types';
5
 // @ts-ignore
5
 // @ts-ignore
6
 import { setPassword as setPass } from '../../../../base/conference';
6
 import { setPassword as setPass } from '../../../../base/conference';
7
-// @ts-ignore
8
-import { Dialog } from '../../../../base/dialog';
9
 import { isLocalParticipantModerator } from '../../../../base/participants/functions';
7
 import { isLocalParticipantModerator } from '../../../../base/participants/functions';
10
 import { connect } from '../../../../base/redux/functions';
8
 import { connect } from '../../../../base/redux/functions';
9
+import Dialog from '../../../../base/ui/components/web/Dialog';
11
 // @ts-ignore
10
 // @ts-ignore
12
 import { E2EESection } from '../../../../e2ee/components';
11
 import { E2EESection } from '../../../../e2ee/components';
13
 // @ts-ignore
12
 // @ts-ignore
90
 
89
 
91
     return (
90
     return (
92
         <Dialog
91
         <Dialog
93
-            hideCancelButton = { true }
94
-            submitDisabled = { true }
95
-            titleKey = 'security.title'
96
-            width = { 'small' }>
92
+            cancel = {{ hidden: true }}
93
+            ok = {{ hidden: true }}
94
+            titleKey = 'security.title'>
97
             <div className = 'security-dialog'>
95
             <div className = 'security-dialog'>
98
                 <LobbySection />
96
                 <LobbySection />
99
                 <PasswordSection
97
                 <PasswordSection

+ 7
- 7
react/features/shared-video/components/web/SharedVideoDialog.tsx 查看文件

1
 import React from 'react';
1
 import React from 'react';
2
 
2
 
3
-// @ts-ignore
4
-import { Dialog } from '../../../base/dialog';
5
 import { translate } from '../../../base/i18n/functions';
3
 import { translate } from '../../../base/i18n/functions';
6
 import { connect } from '../../../base/redux/functions';
4
 import { connect } from '../../../base/redux/functions';
5
+import Dialog from '../../../base/ui/components/web/Dialog';
7
 import Input from '../../../base/ui/components/web/Input';
6
 import Input from '../../../base/ui/components/web/Input';
8
 import AbstractSharedVideoDialog from '../AbstractSharedVideoDialog';
7
 import AbstractSharedVideoDialog from '../AbstractSharedVideoDialog';
9
 
8
 
73
 
72
 
74
         return (
73
         return (
75
             <Dialog
74
             <Dialog
76
-                hideCancelButton = { false }
77
-                okDisabled = { this.state.okDisabled }
78
-                okKey = { t('dialog.Share') }
75
+                ok = {{
76
+                    disabled: this.state.okDisabled,
77
+                    translationKey: 'dialog.Share'
78
+                }}
79
                 onSubmit = { this._onSubmitValue }
79
                 onSubmit = { this._onSubmitValue }
80
-                titleKey = { t('dialog.shareVideoTitle') }
81
-                width = { 'small' }>
80
+                titleKey = 'dialog.shareVideoTitle'>
82
                 <Input
81
                 <Input
83
                     autoFocus = { true }
82
                     autoFocus = { true }
83
+                    className = 'dialog-bottom-margin'
84
                     error = { error }
84
                     error = { error }
85
                     label = { t('dialog.videoLink') }
85
                     label = { t('dialog.videoLink') }
86
                     name = 'sharedVideoUrl'
86
                     name = 'sharedVideoUrl'

+ 5
- 11
react/features/speaker-stats/components/web/SpeakerStats.tsx 查看文件

5
 import { makeStyles } from 'tss-react/mui';
5
 import { makeStyles } from 'tss-react/mui';
6
 
6
 
7
 import { IState } from '../../../app/types';
7
 import { IState } from '../../../app/types';
8
-// @ts-ignore
9
-import { Dialog } from '../../../base/dialog';
8
+import Dialog from '../../../base/ui/components/web/Dialog';
10
 import { escapeRegexp } from '../../../base/util/helpers';
9
 import { escapeRegexp } from '../../../base/util/helpers';
11
 // @ts-ignore
10
 // @ts-ignore
12
 import { initSearch, resetSearchCriteria, toggleFaceExpressions } from '../../actions';
11
 import { initSearch, resetSearchCriteria, toggleFaceExpressions } from '../../actions';
56
                 }
55
                 }
57
             }
56
             }
58
         },
57
         },
59
-        footer: {
60
-            display: 'none !important'
61
-        },
62
         labelsContainer: {
58
         labelsContainer: {
63
             position: 'relative'
59
             position: 'relative'
64
         },
60
         },
115
 
111
 
116
     return (
112
     return (
117
         <Dialog
113
         <Dialog
118
-            cancelKey = 'dialog.close'
119
-            classes = {{ footer: classes.footer }}
120
-            hideCancelButton = { true }
121
-            submitDisabled = { true }
122
-            titleKey = 'speakerStats.speakerStats'
123
-            width = { showFaceExpressions ? '664px' : 'small' }>
114
+            cancel = {{ hidden: true }}
115
+            ok = {{ hidden: true }}
116
+            size = { showFaceExpressions ? 'large' : 'medium' }
117
+            titleKey = 'speakerStats.speakerStats'>
124
             <div className = { classes.speakerStats }>
118
             <div className = { classes.speakerStats }>
125
                 <div
119
                 <div
126
                     className = {
120
                     className = {

+ 9
- 8
react/features/subtitles/components/LanguageSelectorDialog.web.tsx 查看文件

4
 
4
 
5
 import { IState } from '../../app/types';
5
 import { IState } from '../../app/types';
6
 // @ts-ignore
6
 // @ts-ignore
7
-import { Dialog } from '../../base/dialog';
8
-// @ts-ignore
9
 import { TRANSLATION_LANGUAGES, TRANSLATION_LANGUAGES_HEAD } from '../../base/i18n';
7
 import { TRANSLATION_LANGUAGES, TRANSLATION_LANGUAGES_HEAD } from '../../base/i18n';
10
 import { connect } from '../../base/redux/functions';
8
 import { connect } from '../../base/redux/functions';
9
+import Dialog from '../../base/ui/components/web/Dialog';
11
 // @ts-ignore
10
 // @ts-ignore
12
 import { setRequestingSubtitles, toggleLanguageSelectorDialog, updateTranslationLanguage } from '../actions';
11
 import { setRequestingSubtitles, toggleLanguageSelectorDialog, updateTranslationLanguage } from '../actions';
13
 
12
 
25
  *
24
  *
26
  * @returns {React$Element<any>}
25
  * @returns {React$Element<any>}
27
  */
26
  */
28
-const LanguageSelectorDialog = ({ _language, _translationLanguages, _translationLanguagesHead }:
29
-                                    ILanguageSelectorDialogProps) => {
27
+const LanguageSelectorDialog = ({
28
+    _language,
29
+    _translationLanguages,
30
+    _translationLanguagesHead
31
+}: ILanguageSelectorDialogProps) => {
30
 
32
 
31
     const dispatch = useDispatch();
33
     const dispatch = useDispatch();
32
     const off = 'transcribing.subtitlesOff';
34
     const off = 'transcribing.subtitlesOff';
65
 
67
 
66
     return (
68
     return (
67
         <Dialog
69
         <Dialog
68
-            hideCancelButton = { true }
69
-            submitDisabled = { true }
70
-            titleKey = 'transcribing.subtitles'
71
-            width = { 'small' }>
70
+            cancel = {{ hidden: true }}
71
+            ok = {{ hidden: true }}
72
+            titleKey = 'transcribing.subtitles'>
72
             <LanguageList
73
             <LanguageList
73
                 items = { listItems }
74
                 items = { listItems }
74
                 onLanguageSelected = { onLanguageSelected }
75
                 onLanguageSelected = { onLanguageSelected }

react/features/video-menu/components/AbstractMuteEveryoneDialog.js → react/features/video-menu/components/AbstractMuteEveryoneDialog.ts 查看文件

1
-// @flow
2
-
3
-import React from 'react';
1
+import { WithTranslation } from 'react-i18next';
4
 
2
 
3
+import { IState } from '../../app/types';
5
 import { requestDisableAudioModeration, requestEnableAudioModeration } from '../../av-moderation/actions';
4
 import { requestDisableAudioModeration, requestEnableAudioModeration } from '../../av-moderation/actions';
6
 import { isEnabledFromState, isSupported } from '../../av-moderation/functions';
5
 import { isEnabledFromState, isSupported } from '../../av-moderation/functions';
7
-import { Dialog } from '../../base/dialog';
8
-import { MEDIA_TYPE } from '../../base/media';
9
-import { getLocalParticipant, getParticipantDisplayName } from '../../base/participants';
6
+import { MEDIA_TYPE } from '../../base/media/constants';
7
+import { getLocalParticipant, getParticipantDisplayName } from '../../base/participants/functions';
8
+// eslint-disable-next-line lines-around-comment
9
+// @ts-ignore
10
 import { muteAllParticipants } from '../actions';
10
 import { muteAllParticipants } from '../actions';
11
 
11
 
12
 import AbstractMuteRemoteParticipantDialog, {
12
 import AbstractMuteRemoteParticipantDialog, {
17
  * The type of the React {@code Component} props of
17
  * The type of the React {@code Component} props of
18
  * {@link AbstractMuteEveryoneDialog}.
18
  * {@link AbstractMuteEveryoneDialog}.
19
  */
19
  */
20
-export type Props = AbstractProps & {
21
-
22
-    content: string,
23
-    exclude: Array<string>,
24
-    title: string,
25
-    showAdvancedModerationToggle: boolean,
26
-    isAudioModerationEnabled: boolean,
27
-    isModerationSupported: boolean
20
+export type Props = AbstractProps & WithTranslation & {
21
+    content: string;
22
+    exclude: Array<string>;
23
+    isAudioModerationEnabled: boolean;
24
+    isModerationSupported: boolean;
25
+    showAdvancedModerationToggle: boolean;
26
+    title: string;
28
 };
27
 };
29
 
28
 
30
 type State = {
29
 type State = {
31
-    audioModerationEnabled: boolean,
32
-    content: string
30
+    audioModerationEnabled: boolean;
31
+    content: string;
33
 };
32
 };
34
 
33
 
35
 /**
34
 /**
39
  *
38
  *
40
  * @augments AbstractMuteRemoteParticipantDialog
39
  * @augments AbstractMuteRemoteParticipantDialog
41
  */
40
  */
42
-export default class AbstractMuteEveryoneDialog<P: Props> extends AbstractMuteRemoteParticipantDialog<P, State> {
41
+export default class AbstractMuteEveryoneDialog<P extends Props> extends AbstractMuteRemoteParticipantDialog<P, State> {
43
     static defaultProps = {
42
     static defaultProps = {
44
         exclude: [],
43
         exclude: [],
45
         muteLocal: false
44
         muteLocal: false
67
     }
66
     }
68
 
67
 
69
     /**
68
     /**
70
-     * Implements React's {@link Component#render()}.
71
-     *
72
-     * @inheritdoc
73
-     * @returns {ReactElement}
74
-     */
75
-    render() {
76
-        const { content, title } = this.props;
77
-
78
-        return (
79
-            <Dialog
80
-                okKey = 'dialog.muteParticipantButton'
81
-                onSubmit = { this._onSubmit }
82
-                titleString = { title }
83
-                width = 'small'>
84
-                <div>
85
-                    { content }
86
-                </div>
87
-            </Dialog>
88
-        );
69
+      * Toggles advanced moderation switch.
70
+      *
71
+      * @returns {void}
72
+      */
73
+    _onToggleModeration() {
74
+        this.setState(state => {
75
+            return {
76
+                audioModerationEnabled: !state.audioModerationEnabled,
77
+                content: this.props.t(state.audioModerationEnabled
78
+                    ? 'dialog.muteEveryoneDialog' : 'dialog.muteEveryoneDialogModerationOn'
79
+                )
80
+            };
81
+        });
89
     }
82
     }
90
 
83
 
91
-    _onSubmit: () => boolean;
92
-
93
-    _onToggleModeration: () => void;
94
-
95
     /**
84
     /**
96
      * Callback to be invoked when the value of this dialog is submitted.
85
      * Callback to be invoked when the value of this dialog is submitted.
97
      *
86
      *
117
 /**
106
 /**
118
  * Maps (parts of) the Redux state to the associated {@code AbstractMuteEveryoneDialog}'s props.
107
  * Maps (parts of) the Redux state to the associated {@code AbstractMuteEveryoneDialog}'s props.
119
  *
108
  *
120
- * @param {Object} state - The redux state.
109
+ * @param {IState} state - The redux state.
121
  * @param {Object} ownProps - The properties explicitly passed to the component.
110
  * @param {Object} ownProps - The properties explicitly passed to the component.
122
  * @returns {Props}
111
  * @returns {Props}
123
  */
112
  */
124
-export function abstractMapStateToProps(state: Object, ownProps: Props) {
113
+export function abstractMapStateToProps(state: IState, ownProps: Props) {
125
     const { exclude = [], t } = ownProps;
114
     const { exclude = [], t } = ownProps;
126
 
115
 
127
     const whom = exclude
116
     const whom = exclude
128
         // eslint-disable-next-line no-confusing-arrow
117
         // eslint-disable-next-line no-confusing-arrow
129
-        .map(id => id === getLocalParticipant(state).id
118
+        .map(id => id === getLocalParticipant(state)?.id
130
             ? t('dialog.muteEveryoneSelf')
119
             ? t('dialog.muteEveryoneSelf')
131
             : getParticipantDisplayName(state, id))
120
             : getParticipantDisplayName(state, id))
132
         .join(', ');
121
         .join(', ');

react/features/video-menu/components/AbstractMuteEveryonesVideoDialog.js → react/features/video-menu/components/AbstractMuteEveryonesVideoDialog.ts 查看文件

1
-// @flow
2
-
3
-import React from 'react';
1
+import { WithTranslation } from 'react-i18next';
4
 
2
 
3
+import { IState } from '../../app/types';
5
 import { requestDisableVideoModeration, requestEnableVideoModeration } from '../../av-moderation/actions';
4
 import { requestDisableVideoModeration, requestEnableVideoModeration } from '../../av-moderation/actions';
6
 import { isEnabledFromState, isSupported } from '../../av-moderation/functions';
5
 import { isEnabledFromState, isSupported } from '../../av-moderation/functions';
7
-import { Dialog } from '../../base/dialog';
8
-import { MEDIA_TYPE } from '../../base/media';
9
-import { getLocalParticipant, getParticipantDisplayName } from '../../base/participants';
6
+import { MEDIA_TYPE } from '../../base/media/constants';
7
+import { getLocalParticipant, getParticipantDisplayName } from '../../base/participants/functions';
8
+// eslint-disable-next-line lines-around-comment
9
+// @ts-ignore
10
 import { muteAllParticipants } from '../actions';
10
 import { muteAllParticipants } from '../actions';
11
 
11
 
12
 import AbstractMuteRemoteParticipantsVideoDialog, {
12
 import AbstractMuteRemoteParticipantsVideoDialog, {
17
  * The type of the React {@code Component} props of
17
  * The type of the React {@code Component} props of
18
  * {@link AbstractMuteEveryonesVideoDialog}.
18
  * {@link AbstractMuteEveryonesVideoDialog}.
19
  */
19
  */
20
-export type Props = AbstractProps & {
21
-
22
-    content: string,
23
-    exclude: Array<string>,
24
-    title: string,
25
-    showAdvancedModerationToggle: boolean,
26
-    isVideoModerationEnabled: boolean,
27
-    isModerationSupported: boolean
20
+export type Props = AbstractProps & WithTranslation & {
21
+    content: string;
22
+    exclude: Array<string>;
23
+    isModerationSupported: boolean;
24
+    isVideoModerationEnabled: boolean;
25
+    showAdvancedModerationToggle: boolean;
26
+    title: string;
28
 };
27
 };
29
 
28
 
30
 type State = {
29
 type State = {
31
-    moderationEnabled: boolean;
32
     content: string;
30
     content: string;
31
+    moderationEnabled: boolean;
33
 };
32
 };
34
 
33
 
35
 /**
34
 /**
39
  *
38
  *
40
  * @augments AbstractMuteRemoteParticipantsVideoDialog
39
  * @augments AbstractMuteRemoteParticipantsVideoDialog
41
  */
40
  */
42
-export default class AbstractMuteEveryonesVideoDialog<P: Props>
41
+export default class AbstractMuteEveryonesVideoDialog<P extends Props>
43
     extends AbstractMuteRemoteParticipantsVideoDialog<P, State> {
42
     extends AbstractMuteRemoteParticipantsVideoDialog<P, State> {
44
     static defaultProps = {
43
     static defaultProps = {
45
         exclude: [],
44
         exclude: [],
68
     }
67
     }
69
 
68
 
70
     /**
69
     /**
71
-     * Implements React's {@link Component#render()}.
70
+     * Toggles advanced moderation switch.
72
      *
71
      *
73
-     * @inheritdoc
74
-     * @returns {ReactElement}
72
+     * @returns {void}
75
      */
73
      */
76
-    render() {
77
-        const { content, title } = this.props;
78
-
79
-        return (
80
-            <Dialog
81
-                okKey = 'dialog.muteParticipantsVideoButton'
82
-                onSubmit = { this._onSubmit }
83
-                titleString = { title }
84
-                width = 'small'>
85
-                <div>
86
-                    { content }
87
-                </div>
88
-            </Dialog>
89
-        );
74
+    _onToggleModeration() {
75
+        this.setState(state => {
76
+            return {
77
+                moderationEnabled: !state.moderationEnabled,
78
+                content: this.props.t(state.moderationEnabled
79
+                    ? 'dialog.muteEveryonesVideoDialog' : 'dialog.muteEveryonesVideoDialogModerationOn'
80
+                )
81
+            };
82
+        });
90
     }
83
     }
91
 
84
 
92
-    _onSubmit: () => boolean;
93
-
94
-    _onToggleModeration: () => void;
95
-
96
     /**
85
     /**
97
      * Callback to be invoked when the value of this dialog is submitted.
86
      * Callback to be invoked when the value of this dialog is submitted.
98
      *
87
      *
118
 /**
107
 /**
119
  * Maps (parts of) the Redux state to the associated {@code AbstractMuteEveryonesVideoDialog}'s props.
108
  * Maps (parts of) the Redux state to the associated {@code AbstractMuteEveryonesVideoDialog}'s props.
120
  *
109
  *
121
- * @param {Object} state - The redux state.
110
+ * @param {IState} state - The redux state.
122
  * @param {Object} ownProps - The properties explicitly passed to the component.
111
  * @param {Object} ownProps - The properties explicitly passed to the component.
123
  * @returns {Props}
112
  * @returns {Props}
124
  */
113
  */
125
-export function abstractMapStateToProps(state: Object, ownProps: Props) {
114
+export function abstractMapStateToProps(state: IState, ownProps: Props) {
126
     const { exclude = [], t } = ownProps;
115
     const { exclude = [], t } = ownProps;
127
     const isVideoModerationEnabled = isEnabledFromState(MEDIA_TYPE.VIDEO, state);
116
     const isVideoModerationEnabled = isEnabledFromState(MEDIA_TYPE.VIDEO, state);
128
 
117
 
129
     const whom = exclude
118
     const whom = exclude
130
         // eslint-disable-next-line no-confusing-arrow
119
         // eslint-disable-next-line no-confusing-arrow
131
-        .map(id => id === getLocalParticipant(state).id
120
+        .map(id => id === getLocalParticipant(state)?.id
132
             ? t('dialog.muteEveryoneSelf')
121
             ? t('dialog.muteEveryoneSelf')
133
             : getParticipantDisplayName(state, id))
122
             : getParticipantDisplayName(state, id))
134
         .join(', ');
123
         .join(', ');

react/features/video-menu/components/AbstractMuteRemoteParticipantDialog.js → react/features/video-menu/components/AbstractMuteRemoteParticipantDialog.ts 查看文件

1
-// @flow
2
-
3
 import { Component } from 'react';
1
 import { Component } from 'react';
4
 
2
 
5
-import { MEDIA_TYPE } from '../../base/media';
3
+import { MEDIA_TYPE } from '../../base/media/constants';
4
+// eslint-disable-next-line lines-around-comment
5
+// @ts-ignore
6
 import { muteRemote } from '../actions';
6
 import { muteRemote } from '../actions';
7
 
7
 
8
 /**
8
 /**
14
     /**
14
     /**
15
      * The Redux dispatch function.
15
      * The Redux dispatch function.
16
      */
16
      */
17
-    dispatch: Function,
17
+    dispatch: Function;
18
 
18
 
19
     /**
19
     /**
20
      * The ID of the remote participant to be muted.
20
      * The ID of the remote participant to be muted.
21
      */
21
      */
22
-    participantID: string,
22
+    participantID: string;
23
 
23
 
24
     /**
24
     /**
25
      * Function to translate i18n labels.
25
      * Function to translate i18n labels.
26
      */
26
      */
27
-    t: Function
27
+    t: Function;
28
 };
28
 };
29
 
29
 
30
 /**
30
 /**
32
  *
32
  *
33
  * @augments Component
33
  * @augments Component
34
  */
34
  */
35
-export default class AbstractMuteRemoteParticipantDialog<P:Props = Props, State=void>
35
+export default class AbstractMuteRemoteParticipantDialog<P extends Props = Props, State=void>
36
     extends Component<P, State> {
36
     extends Component<P, State> {
37
     /**
37
     /**
38
      * Initializes a new {@code AbstractMuteRemoteParticipantDialog} instance.
38
      * Initializes a new {@code AbstractMuteRemoteParticipantDialog} instance.
47
         this._onSubmit = this._onSubmit.bind(this);
47
         this._onSubmit = this._onSubmit.bind(this);
48
     }
48
     }
49
 
49
 
50
-    _onSubmit: () => boolean;
51
-
52
     /**
50
     /**
53
      * Handles the submit button action.
51
      * Handles the submit button action.
54
      *
52
      *

react/features/video-menu/components/AbstractMuteRemoteParticipantsVideoDialog.js → react/features/video-menu/components/AbstractMuteRemoteParticipantsVideoDialog.ts 查看文件

1
-// @flow
2
-
3
 import { Component } from 'react';
1
 import { Component } from 'react';
4
 
2
 
3
+import { IState } from '../../app/types';
5
 import { rejectParticipantVideo } from '../../av-moderation/actions';
4
 import { rejectParticipantVideo } from '../../av-moderation/actions';
6
 import { isEnabledFromState } from '../../av-moderation/functions';
5
 import { isEnabledFromState } from '../../av-moderation/functions';
7
-import { MEDIA_TYPE } from '../../base/media';
6
+import { MEDIA_TYPE } from '../../base/media/constants';
7
+// eslint-disable-next-line lines-around-comment
8
+// @ts-ignore
8
 import { muteRemote } from '../actions';
9
 import { muteRemote } from '../actions';
9
 
10
 
10
 /**
11
 /**
16
     /**
17
     /**
17
      * The Redux dispatch function.
18
      * The Redux dispatch function.
18
      */
19
      */
19
-    dispatch: Function,
20
+    dispatch: Function;
20
 
21
 
21
     /**
22
     /**
22
      * Whether or not video moderation is on.
23
      * Whether or not video moderation is on.
23
      */
24
      */
24
-    isVideoModerationOn: boolean,
25
+    isVideoModerationOn: boolean;
25
 
26
 
26
     /**
27
     /**
27
      * The ID of the remote participant to be muted.
28
      * The ID of the remote participant to be muted.
28
      */
29
      */
29
-    participantID: string,
30
+    participantID: string;
30
 
31
 
31
     /**
32
     /**
32
      * Function to translate i18n labels.
33
      * Function to translate i18n labels.
33
      */
34
      */
34
-    t: Function
35
+    t: Function;
35
 };
36
 };
36
 
37
 
37
 /**
38
 /**
39
  *
40
  *
40
  * @augments Component
41
  * @augments Component
41
  */
42
  */
42
-export default class AbstractMuteRemoteParticipantsVideoDialog<P:Props = Props, State=void>
43
+export default class AbstractMuteRemoteParticipantsVideoDialog<P extends Props = Props, State=void>
43
     extends Component<P, State> {
44
     extends Component<P, State> {
44
     /**
45
     /**
45
      * Initializes a new {@code AbstractMuteRemoteParticipantsVideoDialog} instance.
46
      * Initializes a new {@code AbstractMuteRemoteParticipantsVideoDialog} instance.
54
         this._onSubmit = this._onSubmit.bind(this);
55
         this._onSubmit = this._onSubmit.bind(this);
55
     }
56
     }
56
 
57
 
57
-    _onSubmit: () => boolean;
58
-
59
     /**
58
     /**
60
      * Handles the submit button action.
59
      * Handles the submit button action.
61
      *
60
      *
76
  * Maps (parts of) the redux state to the associated
75
  * Maps (parts of) the redux state to the associated
77
  * {@code AbstractDialogContainer}'s props.
76
  * {@code AbstractDialogContainer}'s props.
78
  *
77
  *
79
- * @param {Object} state - The redux state.
78
+ * @param {IState} state - The redux state.
80
  * @private
79
  * @private
81
  * @returns {Object}
80
  * @returns {Object}
82
  */
81
  */
83
-export function abstractMapStateToProps(state: Object) {
82
+export function abstractMapStateToProps(state: IState) {
84
     return {
83
     return {
85
         isVideoModerationOn: isEnabledFromState(MEDIA_TYPE.VIDEO, state)
84
         isVideoModerationOn: isEnabledFromState(MEDIA_TYPE.VIDEO, state)
86
     };
85
     };

+ 0
- 16
react/features/video-menu/components/native/MuteEveryoneDialog.js 查看文件

34
         );
34
         );
35
     }
35
     }
36
 
36
 
37
-    /**
38
-     * Toggles advanced moderation switch.
39
-     *
40
-     * @returns {void}
41
-     */
42
-    _onToggleModeration() {
43
-        this.setState(state => {
44
-            return {
45
-                audioModerationEnabled: !state.audioModerationEnabled,
46
-                content: this.props.t(state.audioModerationEnabled
47
-                    ? 'dialog.muteEveryoneDialog' : 'dialog.muteEveryoneDialogModerationOn'
48
-                )
49
-            };
50
-        });
51
-    }
52
-
53
     /**
37
     /**
54
      * Implements {@code Component#render}.
38
      * Implements {@code Component#render}.
55
      *
39
      *

+ 0
- 16
react/features/video-menu/components/native/MuteEveryonesVideoDialog.js 查看文件

34
         );
34
         );
35
     }
35
     }
36
 
36
 
37
-    /**
38
-     * Toggles advanced moderation switch.
39
-     *
40
-     * @returns {void}
41
-     */
42
-    _onToggleModeration() {
43
-        this.setState(state => {
44
-            return {
45
-                moderationEnabled: !state.moderationEnabled,
46
-                content: this.props.t(state.moderationEnabled
47
-                    ? 'dialog.muteEveryonesVideoDialog' : 'dialog.muteEveryonesVideoDialogModerationOn'
48
-                )
49
-            };
50
-        });
51
-    }
52
-
53
     /**
37
     /**
54
      * Implements {@code Component#render}.
38
      * Implements {@code Component#render}.
55
      *
39
      *

+ 3
- 33
react/features/video-menu/components/web/MuteEveryoneDialog.tsx 查看文件

1
-/* eslint-disable lines-around-comment */
2
 import React from 'react';
1
 import React from 'react';
3
 
2
 
4
-// @ts-ignore
5
-import { Dialog } from '../../../base/dialog';
6
 import { translate } from '../../../base/i18n/functions';
3
 import { translate } from '../../../base/i18n/functions';
7
 import { connect } from '../../../base/redux/functions';
4
 import { connect } from '../../../base/redux/functions';
5
+import Dialog from '../../../base/ui/components/web/Dialog';
8
 import Switch from '../../../base/ui/components/web/Switch';
6
 import Switch from '../../../base/ui/components/web/Switch';
9
 import AbstractMuteEveryoneDialog, { type Props, abstractMapStateToProps }
7
 import AbstractMuteEveryoneDialog, { type Props, abstractMapStateToProps }
10
-// @ts-ignore
11
     from '../AbstractMuteEveryoneDialog';
8
     from '../AbstractMuteEveryoneDialog';
12
 
9
 
13
 /**
10
 /**
18
  */
15
  */
19
 class MuteEveryoneDialog extends AbstractMuteEveryoneDialog<Props> {
16
 class MuteEveryoneDialog extends AbstractMuteEveryoneDialog<Props> {
20
 
17
 
21
-    /**
22
-     * Toggles advanced moderation switch.
23
-     *
24
-     * @returns {void}
25
-     */
26
-    _onToggleModeration() {
27
-        // @ts-ignore
28
-        this.setState(state => {
29
-            return {
30
-                audioModerationEnabled: !state.audioModerationEnabled,
31
-                // @ts-ignore
32
-                content: this.props.t(state.audioModerationEnabled
33
-                    ? 'dialog.muteEveryoneDialog' : 'dialog.muteEveryoneDialogModerationOn'
34
-                )
35
-            };
36
-        });
37
-    }
38
-
39
     /**
18
     /**
40
      * Implements React's {@link Component#render()}.
19
      * Implements React's {@link Component#render()}.
41
      *
20
      *
45
     render() {
24
     render() {
46
         return (
25
         return (
47
             <Dialog
26
             <Dialog
48
-                okKey = 'dialog.muteParticipantButton'
27
+                ok = {{ translationKey: 'dialog.muteParticipantButton' }}
49
                 onSubmit = { this._onSubmit }
28
                 onSubmit = { this._onSubmit }
50
-                // @ts-ignore
51
-                titleString = { this.props.title }
52
-                width = 'small'>
29
+                title = { this.props.title }>
53
                 <div className = 'mute-dialog'>
30
                 <div className = 'mute-dialog'>
54
-                    {/* @ts-ignore */}
55
                     { this.state.content }
31
                     { this.state.content }
56
-                    {/* @ts-ignore */}
57
                     { this.props.isModerationSupported && this.props.exclude.length === 0 && (
32
                     { this.props.isModerationSupported && this.props.exclude.length === 0 && (
58
                         <>
33
                         <>
59
                             <div className = 'separator-line' />
34
                             <div className = 'separator-line' />
60
                             <div className = 'control-row'>
35
                             <div className = 'control-row'>
61
                                 <label htmlFor = 'moderation-switch'>
36
                                 <label htmlFor = 'moderation-switch'>
62
-                                    {/* @ts-ignore */}
63
                                     {this.props.t('dialog.moderationAudioLabel')}
37
                                     {this.props.t('dialog.moderationAudioLabel')}
64
                                 </label>
38
                                 </label>
65
                                 <Switch
39
                                 <Switch
66
-                                    // @ts-ignore
67
                                     checked = { !this.state.audioModerationEnabled }
40
                                     checked = { !this.state.audioModerationEnabled }
68
                                     id = 'moderation-switch'
41
                                     id = 'moderation-switch'
69
                                     onChange = { this._onToggleModeration } />
42
                                     onChange = { this._onToggleModeration } />
74
             </Dialog>
47
             </Dialog>
75
         );
48
         );
76
     }
49
     }
77
-
78
-    _onSubmit: () => boolean;
79
 }
50
 }
80
 
51
 
81
-// @ts-ignore
82
 export default translate(connect(abstractMapStateToProps)(MuteEveryoneDialog));
52
 export default translate(connect(abstractMapStateToProps)(MuteEveryoneDialog));

+ 3
- 33
react/features/video-menu/components/web/MuteEveryonesVideoDialog.tsx 查看文件

1
-/* eslint-disable lines-around-comment */
2
 import React from 'react';
1
 import React from 'react';
3
 
2
 
4
-// @ts-ignore
5
-import { Dialog } from '../../../base/dialog';
6
 import { translate } from '../../../base/i18n/functions';
3
 import { translate } from '../../../base/i18n/functions';
7
 import { connect } from '../../../base/redux/functions';
4
 import { connect } from '../../../base/redux/functions';
5
+import Dialog from '../../../base/ui/components/web/Dialog';
8
 import Switch from '../../../base/ui/components/web/Switch';
6
 import Switch from '../../../base/ui/components/web/Switch';
9
 import AbstractMuteEveryonesVideoDialog, { type Props, abstractMapStateToProps }
7
 import AbstractMuteEveryonesVideoDialog, { type Props, abstractMapStateToProps }
10
-// @ts-ignore
11
     from '../AbstractMuteEveryonesVideoDialog';
8
     from '../AbstractMuteEveryonesVideoDialog';
12
 
9
 
13
 /**
10
 /**
18
  */
15
  */
19
 class MuteEveryonesVideoDialog extends AbstractMuteEveryonesVideoDialog<Props> {
16
 class MuteEveryonesVideoDialog extends AbstractMuteEveryonesVideoDialog<Props> {
20
 
17
 
21
-    /**
22
-     * Toggles advanced moderation switch.
23
-     *
24
-     * @returns {void}
25
-     */
26
-    _onToggleModeration() {
27
-        // @ts-ignore
28
-        this.setState(state => {
29
-            return {
30
-                moderationEnabled: !state.moderationEnabled,
31
-                // @ts-ignore
32
-                content: this.props.t(state.moderationEnabled
33
-                    ? 'dialog.muteEveryonesVideoDialog' : 'dialog.muteEveryonesVideoDialogModerationOn'
34
-                )
35
-            };
36
-        });
37
-    }
38
-
39
     /**
18
     /**
40
      * Implements React's {@link Component#render()}.
19
      * Implements React's {@link Component#render()}.
41
      *
20
      *
45
     render() {
24
     render() {
46
         return (
25
         return (
47
             <Dialog
26
             <Dialog
48
-                okKey = 'dialog.muteParticipantsVideoButton'
27
+                ok = {{ translationKey: 'dialog.muteParticipantsVideoButton' }}
49
                 onSubmit = { this._onSubmit }
28
                 onSubmit = { this._onSubmit }
50
-                // @ts-ignore
51
-                titleString = { this.props.title }
52
-                width = 'small'>
29
+                title = { this.props.title }>
53
                 <div className = 'mute-dialog'>
30
                 <div className = 'mute-dialog'>
54
-                    {/* @ts-ignore */}
55
                     {this.state.content}
31
                     {this.state.content}
56
-                    {/* @ts-ignore */}
57
                     { this.props.isModerationSupported && this.props.exclude.length === 0 && (
32
                     { this.props.isModerationSupported && this.props.exclude.length === 0 && (
58
                         <>
33
                         <>
59
                             <div className = 'separator-line' />
34
                             <div className = 'separator-line' />
60
                             <div className = 'control-row'>
35
                             <div className = 'control-row'>
61
                                 <label htmlFor = 'moderation-switch'>
36
                                 <label htmlFor = 'moderation-switch'>
62
-                                    {/* @ts-ignore */}
63
                                     {this.props.t('dialog.moderationVideoLabel')}
37
                                     {this.props.t('dialog.moderationVideoLabel')}
64
                                 </label>
38
                                 </label>
65
                                 <Switch
39
                                 <Switch
66
-                                    // @ts-ignore
67
                                     checked = { !this.state.moderationEnabled }
40
                                     checked = { !this.state.moderationEnabled }
68
                                     id = 'moderation-switch'
41
                                     id = 'moderation-switch'
69
                                     onChange = { this._onToggleModeration } />
42
                                     onChange = { this._onToggleModeration } />
74
             </Dialog>
47
             </Dialog>
75
         );
48
         );
76
     }
49
     }
77
-
78
-    _onSubmit: () => boolean;
79
 }
50
 }
80
 
51
 
81
-// @ts-ignore
82
 export default translate(connect(abstractMapStateToProps)(MuteEveryonesVideoDialog));
52
 export default translate(connect(abstractMapStateToProps)(MuteEveryonesVideoDialog));

Loading…
取消
儲存