You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SharedVideoDialog.js 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // @flow
  2. import React from 'react';
  3. import { InputDialog } from '../../../base/dialog';
  4. import { translate } from '../../../base/i18n';
  5. import { connect } from '../../../base/redux';
  6. import { ColorPalette } from '../../../base/styles';
  7. import AbstractSharedVideoDialog from '../AbstractSharedVideoDialog';
  8. /**
  9. * Implements a component to render a display name prompt.
  10. */
  11. class SharedVideoDialog extends AbstractSharedVideoDialog<*> {
  12. /**
  13. * Instantiates a new component.
  14. *
  15. * @inheritdoc
  16. */
  17. constructor(props) {
  18. super(props);
  19. this.state = {
  20. error: false
  21. };
  22. this._onSubmitValue = this._onSubmitValue.bind(this);
  23. }
  24. _onSubmitValue: () => boolean;
  25. /**
  26. * Callback to be invoked when the value of the link input is submitted.
  27. *
  28. * @param {string} value - The entered video link.
  29. * @returns {boolean}
  30. */
  31. _onSubmitValue(value) {
  32. const result = super._onSetVideoLink(value);
  33. if (!result) {
  34. this.setState({ error: true });
  35. }
  36. return result;
  37. }
  38. /**
  39. * Implements React's {@link Component#render()}.
  40. *
  41. * @inheritdoc
  42. */
  43. render() {
  44. const { t } = this.props;
  45. const { error } = this.state;
  46. return (
  47. <InputDialog
  48. contentKey = 'dialog.shareVideoTitle'
  49. messageKey = { error ? 'dialog.sharedVideoDialogError' : undefined }
  50. onSubmit = { this._onSubmitValue }
  51. textInputProps = {{
  52. autoCapitalize: 'none',
  53. autoCorrect: false,
  54. placeholder: t('dialog.sharedVideoLinkPlaceholder'),
  55. placeholderTextColor: ColorPalette.lightGrey
  56. }} />
  57. );
  58. }
  59. }
  60. export default translate(connect()(SharedVideoDialog));