feat(shared-video): show invalid URL error.
This commit is contained in:
parent
c34d2de519
commit
b5551880f7
|
@ -140,3 +140,12 @@
|
||||||
margin: 16px auto 0 auto;
|
margin: 16px auto 0 auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Styling shared video dialog errors.
|
||||||
|
*/
|
||||||
|
.shared-video-dialog-error {
|
||||||
|
color: #E04757;
|
||||||
|
margin-top: 2px;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
|
@ -365,6 +365,7 @@
|
||||||
"shareVideoTitle": "Share video",
|
"shareVideoTitle": "Share video",
|
||||||
"shareYourScreen": "Share your screen",
|
"shareYourScreen": "Share your screen",
|
||||||
"shareYourScreenDisabled": "Screen sharing disabled.",
|
"shareYourScreenDisabled": "Screen sharing disabled.",
|
||||||
|
"sharedVideoDialogError": "Error: Invalid URL",
|
||||||
"sharedVideoLinkPlaceholder": "YouTube link or direct video link",
|
"sharedVideoLinkPlaceholder": "YouTube link or direct video link",
|
||||||
"startLiveStreaming": "Start live stream",
|
"startLiveStreaming": "Start live stream",
|
||||||
"startRecording": "Start recording",
|
"startRecording": "Start recording",
|
||||||
|
|
|
@ -20,6 +20,10 @@ class SharedVideoDialog extends AbstractSharedVideoDialog<*> {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
|
this.state = {
|
||||||
|
error: false
|
||||||
|
};
|
||||||
|
|
||||||
this._onSubmitValue = this._onSubmitValue.bind(this);
|
this._onSubmitValue = this._onSubmitValue.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +36,13 @@ class SharedVideoDialog extends AbstractSharedVideoDialog<*> {
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
_onSubmitValue(value) {
|
_onSubmitValue(value) {
|
||||||
return super._onSetVideoLink(value);
|
const result = super._onSetVideoLink(value);
|
||||||
|
|
||||||
|
if (!result) {
|
||||||
|
this.setState({ error: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,10 +52,12 @@ class SharedVideoDialog extends AbstractSharedVideoDialog<*> {
|
||||||
*/
|
*/
|
||||||
render() {
|
render() {
|
||||||
const { t } = this.props;
|
const { t } = this.props;
|
||||||
|
const { error } = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<InputDialog
|
<InputDialog
|
||||||
contentKey = 'dialog.shareVideoTitle'
|
contentKey = 'dialog.shareVideoTitle'
|
||||||
|
messageKey = { error ? 'dialog.sharedVideoDialogError' : undefined }
|
||||||
onSubmit = { this._onSubmitValue }
|
onSubmit = { this._onSubmitValue }
|
||||||
textInputProps = {{
|
textInputProps = {{
|
||||||
autoCapitalize: 'none',
|
autoCapitalize: 'none',
|
||||||
|
|
|
@ -26,7 +26,8 @@ class SharedVideoDialog extends AbstractSharedVideoDialog<*> {
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
value: '',
|
value: '',
|
||||||
okDisabled: true
|
okDisabled: true,
|
||||||
|
error: false
|
||||||
};
|
};
|
||||||
|
|
||||||
this._onChange = this._onChange.bind(this);
|
this._onChange = this._onChange.bind(this);
|
||||||
|
@ -58,7 +59,15 @@ class SharedVideoDialog extends AbstractSharedVideoDialog<*> {
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
_onSubmitValue() {
|
_onSubmitValue() {
|
||||||
return super._onSetVideoLink(this.state.value);
|
const result = super._onSetVideoLink(this.state.value);
|
||||||
|
|
||||||
|
if (!result) {
|
||||||
|
this.setState({
|
||||||
|
error: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -68,6 +77,7 @@ class SharedVideoDialog extends AbstractSharedVideoDialog<*> {
|
||||||
*/
|
*/
|
||||||
render() {
|
render() {
|
||||||
const { t } = this.props;
|
const { t } = this.props;
|
||||||
|
const { error } = this.state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog
|
<Dialog
|
||||||
|
@ -81,6 +91,7 @@ class SharedVideoDialog extends AbstractSharedVideoDialog<*> {
|
||||||
autoFocus = { true }
|
autoFocus = { true }
|
||||||
className = 'input-control'
|
className = 'input-control'
|
||||||
compact = { false }
|
compact = { false }
|
||||||
|
isInvalid = { error }
|
||||||
label = { t('dialog.videoLink') }
|
label = { t('dialog.videoLink') }
|
||||||
name = 'sharedVideoUrl'
|
name = 'sharedVideoUrl'
|
||||||
onChange = { this._onChange }
|
onChange = { this._onChange }
|
||||||
|
@ -88,6 +99,7 @@ class SharedVideoDialog extends AbstractSharedVideoDialog<*> {
|
||||||
shouldFitContainer = { true }
|
shouldFitContainer = { true }
|
||||||
type = 'text'
|
type = 'text'
|
||||||
value = { this.state.value } />
|
value = { this.state.value } />
|
||||||
|
{ error && <span className = 'shared-video-dialog-error'>{ t('dialog.sharedVideoDialogError') }</span> }
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue