소스 검색

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,3 +38,7 @@
38 38
     margin-top: 2px;
39 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,6 +16,13 @@ import StartRecordingDialog from '../../recording/components/Recording/web/Start
16 16
 // @ts-ignore
17 17
 import StopRecordingDialog from '../../recording/components/Recording/web/StopRecordingDialog';
18 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 26
 import MiddlewareRegistry from '../redux/MiddlewareRegistry';
20 27
 
21 28
 import { OPEN_DIALOG } from './actionTypes';
@@ -25,7 +32,8 @@ import { OPEN_DIALOG } from './actionTypes';
25 32
 
26 33
 const NEW_DIALOG_LIST = [ KeyboardShortcutsDialog, ChatPrivacyDialog, DisplayNamePrompt, EmbedMeetingDialog,
27 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 38
 // This function is necessary while the transition from @atlaskit dialog to our component is ongoing.
31 39
 const isNewDialog = (component: any) => NEW_DIALOG_LIST.some(comp => comp === component);

+ 1
- 0
react/features/display-name/components/web/DisplayNamePrompt.tsx 파일 보기

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

react/features/screen-share/components/ShareScreenWarningDialog.js → react/features/screen-share/components/ShareScreenWarningDialog.tsx 파일 보기

@@ -1,29 +1,23 @@
1
-// @flow
2
-
3 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 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,14 +30,12 @@ class ShareScreenWarningDialog extends Component<Props> {
36 30
      *
37 31
      * @inheritdoc
38 32
      */
39
-    constructor(props) {
33
+    constructor(props: Props) {
40 34
         super(props);
41 35
 
42 36
         this._onStopSharing = this._onStopSharing.bind(this);
43 37
     }
44 38
 
45
-    _onStopSharing: () => boolean;
46
-
47 39
     /**
48 40
      * Stop current screen sharing session.
49 41
      *
@@ -86,11 +78,9 @@ class ShareScreenWarningDialog extends Component<Props> {
86 78
         }
87 79
 
88 80
         return (<Dialog
89
-            hideCancelButton = { false }
90
-            okKey = { t(stopSharing) }
81
+            ok = {{ translationKey: stopSharing }}
91 82
             onSubmit = { this._onStopSharing }
92
-            titleKey = { t(title) }
93
-            width = { 'small' }>
83
+            titleKey = { t(title) }>
94 84
             <div className = 'share-screen-warn-dialog'>
95 85
                 <p className = 'header'> { t(header1) } </p>
96 86
                 <p className = 'description' > { t(description1) } </p>
@@ -99,7 +89,6 @@ class ShareScreenWarningDialog extends Component<Props> {
99 89
                 <p className = 'description' > { t(description2) } </p>
100 90
             </div>
101 91
         </Dialog>);
102
-
103 92
     }
104 93
 }
105 94
 

+ 4
- 6
react/features/security/components/security-dialog/web/SecurityDialog.tsx 파일 보기

@@ -4,10 +4,9 @@ import React, { useEffect, useState } from 'react';
4 4
 import { IState } from '../../../../app/types';
5 5
 // @ts-ignore
6 6
 import { setPassword as setPass } from '../../../../base/conference';
7
-// @ts-ignore
8
-import { Dialog } from '../../../../base/dialog';
9 7
 import { isLocalParticipantModerator } from '../../../../base/participants/functions';
10 8
 import { connect } from '../../../../base/redux/functions';
9
+import Dialog from '../../../../base/ui/components/web/Dialog';
11 10
 // @ts-ignore
12 11
 import { E2EESection } from '../../../../e2ee/components';
13 12
 // @ts-ignore
@@ -90,10 +89,9 @@ function SecurityDialog({
90 89
 
91 90
     return (
92 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 95
             <div className = 'security-dialog'>
98 96
                 <LobbySection />
99 97
                 <PasswordSection

+ 7
- 7
react/features/shared-video/components/web/SharedVideoDialog.tsx 파일 보기

@@ -1,9 +1,8 @@
1 1
 import React from 'react';
2 2
 
3
-// @ts-ignore
4
-import { Dialog } from '../../../base/dialog';
5 3
 import { translate } from '../../../base/i18n/functions';
6 4
 import { connect } from '../../../base/redux/functions';
5
+import Dialog from '../../../base/ui/components/web/Dialog';
7 6
 import Input from '../../../base/ui/components/web/Input';
8 7
 import AbstractSharedVideoDialog from '../AbstractSharedVideoDialog';
9 8
 
@@ -73,14 +72,15 @@ class SharedVideoDialog extends AbstractSharedVideoDialog<any> {
73 72
 
74 73
         return (
75 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 79
                 onSubmit = { this._onSubmitValue }
80
-                titleKey = { t('dialog.shareVideoTitle') }
81
-                width = { 'small' }>
80
+                titleKey = 'dialog.shareVideoTitle'>
82 81
                 <Input
83 82
                     autoFocus = { true }
83
+                    className = 'dialog-bottom-margin'
84 84
                     error = { error }
85 85
                     label = { t('dialog.videoLink') }
86 86
                     name = 'sharedVideoUrl'

+ 5
- 11
react/features/speaker-stats/components/web/SpeakerStats.tsx 파일 보기

@@ -5,8 +5,7 @@ import { useDispatch, useSelector } from 'react-redux';
5 5
 import { makeStyles } from 'tss-react/mui';
6 6
 
7 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 9
 import { escapeRegexp } from '../../../base/util/helpers';
11 10
 // @ts-ignore
12 11
 import { initSearch, resetSearchCriteria, toggleFaceExpressions } from '../../actions';
@@ -56,9 +55,6 @@ const useStyles = makeStyles()((theme: Theme) => {
56 55
                 }
57 56
             }
58 57
         },
59
-        footer: {
60
-            display: 'none !important'
61
-        },
62 58
         labelsContainer: {
63 59
             position: 'relative'
64 60
         },
@@ -115,12 +111,10 @@ const SpeakerStats = () => {
115 111
 
116 112
     return (
117 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 118
             <div className = { classes.speakerStats }>
125 119
                 <div
126 120
                     className = {

+ 9
- 8
react/features/subtitles/components/LanguageSelectorDialog.web.tsx 파일 보기

@@ -4,10 +4,9 @@ import { useDispatch } from 'react-redux';
4 4
 
5 5
 import { IState } from '../../app/types';
6 6
 // @ts-ignore
7
-import { Dialog } from '../../base/dialog';
8
-// @ts-ignore
9 7
 import { TRANSLATION_LANGUAGES, TRANSLATION_LANGUAGES_HEAD } from '../../base/i18n';
10 8
 import { connect } from '../../base/redux/functions';
9
+import Dialog from '../../base/ui/components/web/Dialog';
11 10
 // @ts-ignore
12 11
 import { setRequestingSubtitles, toggleLanguageSelectorDialog, updateTranslationLanguage } from '../actions';
13 12
 
@@ -25,8 +24,11 @@ interface ILanguageSelectorDialogProps {
25 24
  *
26 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 33
     const dispatch = useDispatch();
32 34
     const off = 'transcribing.subtitlesOff';
@@ -65,10 +67,9 @@ const LanguageSelectorDialog = ({ _language, _translationLanguages, _translation
65 67
 
66 68
     return (
67 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 73
             <LanguageList
73 74
                 items = { listItems }
74 75
                 onLanguageSelected = { onLanguageSelected }

react/features/video-menu/components/AbstractMuteEveryoneDialog.js → react/features/video-menu/components/AbstractMuteEveryoneDialog.ts 파일 보기

@@ -1,12 +1,12 @@
1
-// @flow
2
-
3
-import React from 'react';
1
+import { WithTranslation } from 'react-i18next';
4 2
 
3
+import { IState } from '../../app/types';
5 4
 import { requestDisableAudioModeration, requestEnableAudioModeration } from '../../av-moderation/actions';
6 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 10
 import { muteAllParticipants } from '../actions';
11 11
 
12 12
 import AbstractMuteRemoteParticipantDialog, {
@@ -17,19 +17,18 @@ import AbstractMuteRemoteParticipantDialog, {
17 17
  * The type of the React {@code Component} props of
18 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 29
 type State = {
31
-    audioModerationEnabled: boolean,
32
-    content: string
30
+    audioModerationEnabled: boolean;
31
+    content: string;
33 32
 };
34 33
 
35 34
 /**
@@ -39,7 +38,7 @@ type State = {
39 38
  *
40 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 42
     static defaultProps = {
44 43
         exclude: [],
45 44
         muteLocal: false
@@ -67,31 +66,21 @@ export default class AbstractMuteEveryoneDialog<P: Props> extends AbstractMuteRe
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 85
      * Callback to be invoked when the value of this dialog is submitted.
97 86
      *
@@ -117,16 +106,16 @@ export default class AbstractMuteEveryoneDialog<P: Props> extends AbstractMuteRe
117 106
 /**
118 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 110
  * @param {Object} ownProps - The properties explicitly passed to the component.
122 111
  * @returns {Props}
123 112
  */
124
-export function abstractMapStateToProps(state: Object, ownProps: Props) {
113
+export function abstractMapStateToProps(state: IState, ownProps: Props) {
125 114
     const { exclude = [], t } = ownProps;
126 115
 
127 116
     const whom = exclude
128 117
         // eslint-disable-next-line no-confusing-arrow
129
-        .map(id => id === getLocalParticipant(state).id
118
+        .map(id => id === getLocalParticipant(state)?.id
130 119
             ? t('dialog.muteEveryoneSelf')
131 120
             : getParticipantDisplayName(state, id))
132 121
         .join(', ');

react/features/video-menu/components/AbstractMuteEveryonesVideoDialog.js → react/features/video-menu/components/AbstractMuteEveryonesVideoDialog.ts 파일 보기

@@ -1,12 +1,12 @@
1
-// @flow
2
-
3
-import React from 'react';
1
+import { WithTranslation } from 'react-i18next';
4 2
 
3
+import { IState } from '../../app/types';
5 4
 import { requestDisableVideoModeration, requestEnableVideoModeration } from '../../av-moderation/actions';
6 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 10
 import { muteAllParticipants } from '../actions';
11 11
 
12 12
 import AbstractMuteRemoteParticipantsVideoDialog, {
@@ -17,19 +17,18 @@ import AbstractMuteRemoteParticipantsVideoDialog, {
17 17
  * The type of the React {@code Component} props of
18 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 29
 type State = {
31
-    moderationEnabled: boolean;
32 30
     content: string;
31
+    moderationEnabled: boolean;
33 32
 };
34 33
 
35 34
 /**
@@ -39,7 +38,7 @@ type State = {
39 38
  *
40 39
  * @augments AbstractMuteRemoteParticipantsVideoDialog
41 40
  */
42
-export default class AbstractMuteEveryonesVideoDialog<P: Props>
41
+export default class AbstractMuteEveryonesVideoDialog<P extends Props>
43 42
     extends AbstractMuteRemoteParticipantsVideoDialog<P, State> {
44 43
     static defaultProps = {
45 44
         exclude: [],
@@ -68,31 +67,21 @@ export default class AbstractMuteEveryonesVideoDialog<P: Props>
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 86
      * Callback to be invoked when the value of this dialog is submitted.
98 87
      *
@@ -118,17 +107,17 @@ export default class AbstractMuteEveryonesVideoDialog<P: Props>
118 107
 /**
119 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 111
  * @param {Object} ownProps - The properties explicitly passed to the component.
123 112
  * @returns {Props}
124 113
  */
125
-export function abstractMapStateToProps(state: Object, ownProps: Props) {
114
+export function abstractMapStateToProps(state: IState, ownProps: Props) {
126 115
     const { exclude = [], t } = ownProps;
127 116
     const isVideoModerationEnabled = isEnabledFromState(MEDIA_TYPE.VIDEO, state);
128 117
 
129 118
     const whom = exclude
130 119
         // eslint-disable-next-line no-confusing-arrow
131
-        .map(id => id === getLocalParticipant(state).id
120
+        .map(id => id === getLocalParticipant(state)?.id
132 121
             ? t('dialog.muteEveryoneSelf')
133 122
             : getParticipantDisplayName(state, id))
134 123
         .join(', ');

react/features/video-menu/components/AbstractMuteRemoteParticipantDialog.js → react/features/video-menu/components/AbstractMuteRemoteParticipantDialog.ts 파일 보기

@@ -1,8 +1,8 @@
1
-// @flow
2
-
3 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 6
 import { muteRemote } from '../actions';
7 7
 
8 8
 /**
@@ -14,17 +14,17 @@ export type Props = {
14 14
     /**
15 15
      * The Redux dispatch function.
16 16
      */
17
-    dispatch: Function,
17
+    dispatch: Function;
18 18
 
19 19
     /**
20 20
      * The ID of the remote participant to be muted.
21 21
      */
22
-    participantID: string,
22
+    participantID: string;
23 23
 
24 24
     /**
25 25
      * Function to translate i18n labels.
26 26
      */
27
-    t: Function
27
+    t: Function;
28 28
 };
29 29
 
30 30
 /**
@@ -32,7 +32,7 @@ export type Props = {
32 32
  *
33 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 36
     extends Component<P, State> {
37 37
     /**
38 38
      * Initializes a new {@code AbstractMuteRemoteParticipantDialog} instance.
@@ -47,8 +47,6 @@ export default class AbstractMuteRemoteParticipantDialog<P:Props = Props, State=
47 47
         this._onSubmit = this._onSubmit.bind(this);
48 48
     }
49 49
 
50
-    _onSubmit: () => boolean;
51
-
52 50
     /**
53 51
      * Handles the submit button action.
54 52
      *

react/features/video-menu/components/AbstractMuteRemoteParticipantsVideoDialog.js → react/features/video-menu/components/AbstractMuteRemoteParticipantsVideoDialog.ts 파일 보기

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

+ 0
- 16
react/features/video-menu/components/native/MuteEveryoneDialog.js 파일 보기

@@ -34,22 +34,6 @@ class MuteEveryoneDialog extends AbstractMuteEveryoneDialog<Props> {
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 38
      * Implements {@code Component#render}.
55 39
      *

+ 0
- 16
react/features/video-menu/components/native/MuteEveryonesVideoDialog.js 파일 보기

@@ -34,22 +34,6 @@ class MuteEveryonesVideoDialog extends AbstractMuteEveryonesVideoDialog<Props> {
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 38
      * Implements {@code Component#render}.
55 39
      *

+ 3
- 33
react/features/video-menu/components/web/MuteEveryoneDialog.tsx 파일 보기

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

+ 3
- 33
react/features/video-menu/components/web/MuteEveryonesVideoDialog.tsx 파일 보기

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

Loading…
취소
저장