mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-05-14 14:17:46 +00:00
code review
This commit is contained in:
@@ -4,13 +4,15 @@ import React from 'react';
|
||||
|
||||
import { InputDialog } from '../../../base/dialog';
|
||||
import { connect } from '../../../base/redux';
|
||||
import { defaultSharedVideoLink } from '../../constants';
|
||||
import { defaultMobileSharedVideoLink } from '../../constants';
|
||||
import { getYoutubeId } from '../../functions';
|
||||
import AbstractSharedVideoDialog from '../AbstractSharedVideoDialog';
|
||||
|
||||
/**
|
||||
* Implements a component to render a display name prompt.
|
||||
*/
|
||||
class SharedVideoDialog extends AbstractSharedVideoDialog<*> {
|
||||
|
||||
/**
|
||||
* Implements React's {@link Component#render()}.
|
||||
*
|
||||
@@ -22,12 +24,38 @@ class SharedVideoDialog extends AbstractSharedVideoDialog<*> {
|
||||
contentKey = 'dialog.shareVideoTitle'
|
||||
onSubmit = { this._onSetVideoLink }
|
||||
textInputProps = {{
|
||||
placeholder: defaultSharedVideoLink
|
||||
placeholder: defaultMobileSharedVideoLink
|
||||
}} />
|
||||
);
|
||||
}
|
||||
|
||||
_onSetVideoLink: string => boolean;
|
||||
/**
|
||||
* Validates the entered video link by extracting the id and dispatches it.
|
||||
*
|
||||
* It returns a boolean to comply the Dialog behaviour:
|
||||
* {@code true} - the dialog should be closed.
|
||||
* {@code false} - the dialog should be left open.
|
||||
*
|
||||
* @param {string} link - The entered video link.
|
||||
* @returns {boolean}
|
||||
*/
|
||||
_onSetVideoLink(link: string) {
|
||||
if (!link || !link.trim()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const videoId = getYoutubeId(link);
|
||||
|
||||
if (videoId) {
|
||||
const { onPostSubmit } = this.props;
|
||||
|
||||
onPostSubmit && onPostSubmit(link);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export default connect()(SharedVideoDialog);
|
||||
|
||||
Reference in New Issue
Block a user