jiti-meet/react/features/shared-video/components/native/SharedVideoDialog.js

71 lines
1.7 KiB
JavaScript
Raw Normal View History

2020-06-12 10:15:16 +00:00
// @flow
import React from 'react';
import { InputDialog } from '../../../base/dialog';
import { translate } from '../../../base/i18n';
2020-06-12 10:15:16 +00:00
import { connect } from '../../../base/redux';
import AbstractSharedVideoDialog from '../AbstractSharedVideoDialog';
2020-06-12 10:15:16 +00:00
/**
* Implements a component to render a display name prompt.
*/
class SharedVideoDialog extends AbstractSharedVideoDialog<*> {
/**
* Instantiates a new component.
*
* @inheritdoc
*/
constructor(props) {
super(props);
this.state = {
error: false
};
this._onSubmitValue = this._onSubmitValue.bind(this);
}
_onSubmitValue: () => boolean;
/**
* Callback to be invoked when the value of the link input is submitted.
*
* @param {string} value - The entered video link.
* @returns {boolean}
*/
_onSubmitValue(value) {
const result = super._onSetVideoLink(value);
if (!result) {
this.setState({ error: true });
}
return result;
}
2021-05-13 11:36:19 +00:00
2020-06-12 10:15:16 +00:00
/**
* Implements React's {@link Component#render()}.
*
* @inheritdoc
*/
render() {
const { t } = this.props;
const { error } = this.state;
2020-06-12 10:15:16 +00:00
return (
<InputDialog
messageKey = { error ? 'dialog.sharedVideoDialogError' : undefined }
onSubmit = { this._onSubmitValue }
2020-06-12 10:15:16 +00:00
textInputProps = {{
autoCapitalize: 'none',
autoCorrect: false,
2022-02-04 10:20:47 +00:00
placeholder: t('dialog.sharedVideoLinkPlaceholder')
}}
titleKey = 'dialog.shareVideoTitle' />
2020-06-12 10:15:16 +00:00
);
}
}
export default translate(connect()(SharedVideoDialog));