|
|
@@ -26,7 +26,8 @@ class SharedVideoDialog extends AbstractSharedVideoDialog<*> {
|
|
26
|
26
|
|
|
27
|
27
|
this.state = {
|
|
28
|
28
|
value: '',
|
|
29
|
|
- okDisabled: true
|
|
|
29
|
+ okDisabled: true,
|
|
|
30
|
+ error: false
|
|
30
|
31
|
};
|
|
31
|
32
|
|
|
32
|
33
|
this._onChange = this._onChange.bind(this);
|
|
|
@@ -58,7 +59,15 @@ class SharedVideoDialog extends AbstractSharedVideoDialog<*> {
|
|
58
|
59
|
* @returns {boolean}
|
|
59
|
60
|
*/
|
|
60
|
61
|
_onSubmitValue() {
|
|
61
|
|
- return super._onSetVideoLink(this.state.value);
|
|
|
62
|
+ const result = super._onSetVideoLink(this.state.value);
|
|
|
63
|
+
|
|
|
64
|
+ if (!result) {
|
|
|
65
|
+ this.setState({
|
|
|
66
|
+ error: true
|
|
|
67
|
+ });
|
|
|
68
|
+ }
|
|
|
69
|
+
|
|
|
70
|
+ return result;
|
|
62
|
71
|
}
|
|
63
|
72
|
|
|
64
|
73
|
/**
|
|
|
@@ -68,6 +77,7 @@ class SharedVideoDialog extends AbstractSharedVideoDialog<*> {
|
|
68
|
77
|
*/
|
|
69
|
78
|
render() {
|
|
70
|
79
|
const { t } = this.props;
|
|
|
80
|
+ const { error } = this.state;
|
|
71
|
81
|
|
|
72
|
82
|
return (
|
|
73
|
83
|
<Dialog
|
|
|
@@ -81,6 +91,7 @@ class SharedVideoDialog extends AbstractSharedVideoDialog<*> {
|
|
81
|
91
|
autoFocus = { true }
|
|
82
|
92
|
className = 'input-control'
|
|
83
|
93
|
compact = { false }
|
|
|
94
|
+ isInvalid = { error }
|
|
84
|
95
|
label = { t('dialog.videoLink') }
|
|
85
|
96
|
name = 'sharedVideoUrl'
|
|
86
|
97
|
onChange = { this._onChange }
|
|
|
@@ -88,6 +99,7 @@ class SharedVideoDialog extends AbstractSharedVideoDialog<*> {
|
|
88
|
99
|
shouldFitContainer = { true }
|
|
89
|
100
|
type = 'text'
|
|
90
|
101
|
value = { this.state.value } />
|
|
|
102
|
+ { error && <span className = 'shared-video-dialog-error'>{ t('dialog.sharedVideoDialogError') }</span> }
|
|
91
|
103
|
</Dialog>
|
|
92
|
104
|
);
|
|
93
|
105
|
}
|