|
@@ -1,11 +1,12 @@
|
1
|
|
-// @flow
|
2
|
1
|
import React, { Component } from 'react';
|
3
|
|
-import type { Dispatch } from 'redux';
|
4
|
|
-
|
5
|
|
-import { setPassword } from '../../base/conference';
|
6
|
|
-import { Dialog } from '../../base/dialog';
|
7
|
|
-import { translate } from '../../base/i18n';
|
8
|
|
-import { connect } from '../../base/redux';
|
|
2
|
+import { WithTranslation } from 'react-i18next';
|
|
3
|
+import { connect } from 'react-redux';
|
|
4
|
+
|
|
5
|
+import { IStore } from '../../app/types';
|
|
6
|
+import { setPassword } from '../../base/conference/actions';
|
|
7
|
+import { IJitsiConference } from '../../base/conference/reducer';
|
|
8
|
+import { translate } from '../../base/i18n/functions';
|
|
9
|
+import Dialog from '../../base/ui/components/web/Dialog';
|
9
|
10
|
import Input from '../../base/ui/components/web/Input';
|
10
|
11
|
import { _cancelPasswordRequiredPrompt } from '../actions';
|
11
|
12
|
|
|
@@ -13,23 +14,18 @@ import { _cancelPasswordRequiredPrompt } from '../actions';
|
13
|
14
|
* The type of the React {@code Component} props of
|
14
|
15
|
* {@link PasswordRequiredPrompt}.
|
15
|
16
|
*/
|
16
|
|
-type Props = {
|
|
17
|
+interface IProps extends WithTranslation {
|
17
|
18
|
|
18
|
19
|
/**
|
19
|
20
|
* The JitsiConference which requires a password.
|
20
|
21
|
*/
|
21
|
|
- conference: Object,
|
|
22
|
+ conference: IJitsiConference;
|
22
|
23
|
|
23
|
24
|
/**
|
24
|
25
|
* The redux store's {@code dispatch} function.
|
25
|
26
|
*/
|
26
|
|
- dispatch: Dispatch<any>,
|
27
|
|
-
|
28
|
|
- /**
|
29
|
|
- * The translate function.
|
30
|
|
- */
|
31
|
|
- t: Function
|
32
|
|
-};
|
|
27
|
+ dispatch: IStore['dispatch'];
|
|
28
|
+}
|
33
|
29
|
|
34
|
30
|
/**
|
35
|
31
|
* The type of the React {@code Component} state of
|
|
@@ -40,14 +36,14 @@ type State = {
|
40
|
36
|
/**
|
41
|
37
|
* The password entered by the local participant.
|
42
|
38
|
*/
|
43
|
|
- password: string
|
44
|
|
-}
|
|
39
|
+ password?: string;
|
|
40
|
+};
|
45
|
41
|
|
46
|
42
|
/**
|
47
|
43
|
* Implements a React Component which prompts the user when a password is
|
48
|
44
|
* required to join a conference.
|
49
|
45
|
*/
|
50
|
|
-class PasswordRequiredPrompt extends Component<Props, State> {
|
|
46
|
+class PasswordRequiredPrompt extends Component<IProps, State> {
|
51
|
47
|
state = {
|
52
|
48
|
password: ''
|
53
|
49
|
};
|
|
@@ -58,7 +54,7 @@ class PasswordRequiredPrompt extends Component<Props, State> {
|
58
|
54
|
* @param {Object} props - The read-only properties with which the new
|
59
|
55
|
* instance is to be initialized.
|
60
|
56
|
*/
|
61
|
|
- constructor(props: Props) {
|
|
57
|
+ constructor(props: IProps) {
|
62
|
58
|
super(props);
|
63
|
59
|
|
64
|
60
|
// Bind event handlers so they are only bound once per instance.
|
|
@@ -76,12 +72,10 @@ class PasswordRequiredPrompt extends Component<Props, State> {
|
76
|
72
|
render() {
|
77
|
73
|
return (
|
78
|
74
|
<Dialog
|
79
|
|
- disableBlanketClickDismiss = { true }
|
80
|
|
- isModal = { false }
|
|
75
|
+ disableBackdropClose = { true }
|
81
|
76
|
onCancel = { this._onCancel }
|
82
|
77
|
onSubmit = { this._onSubmit }
|
83
|
|
- titleKey = 'dialog.passwordRequired'
|
84
|
|
- width = 'small'>
|
|
78
|
+ titleKey = 'dialog.passwordRequired'>
|
85
|
79
|
{ this._renderBody() }
|
86
|
80
|
</Dialog>
|
87
|
81
|
);
|
|
@@ -98,6 +92,7 @@ class PasswordRequiredPrompt extends Component<Props, State> {
|
98
|
92
|
<div>
|
99
|
93
|
<Input
|
100
|
94
|
autoFocus = { true }
|
|
95
|
+ className = 'dialog-bottom-margin'
|
101
|
96
|
label = { this.props.t('dialog.passwordLabel') }
|
102
|
97
|
name = 'lockKey'
|
103
|
98
|
onChange = { this._onPasswordChanged }
|
|
@@ -107,8 +102,6 @@ class PasswordRequiredPrompt extends Component<Props, State> {
|
107
|
102
|
);
|
108
|
103
|
}
|
109
|
104
|
|
110
|
|
- _onPasswordChanged: ({ target: { value: * }}) => void;
|
111
|
|
-
|
112
|
105
|
/**
|
113
|
106
|
* Notifies this dialog that password has changed.
|
114
|
107
|
*
|
|
@@ -122,8 +115,6 @@ class PasswordRequiredPrompt extends Component<Props, State> {
|
122
|
115
|
});
|
123
|
116
|
}
|
124
|
117
|
|
125
|
|
- _onCancel: () => boolean;
|
126
|
|
-
|
127
|
118
|
/**
|
128
|
119
|
* Dispatches action to cancel and dismiss this dialog.
|
129
|
120
|
*
|
|
@@ -138,8 +129,6 @@ class PasswordRequiredPrompt extends Component<Props, State> {
|
138
|
129
|
return true;
|
139
|
130
|
}
|
140
|
131
|
|
141
|
|
- _onSubmit: () => boolean;
|
142
|
|
-
|
143
|
132
|
/**
|
144
|
133
|
* Dispatches action to submit value from this dialog.
|
145
|
134
|
*
|