Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

SharedVideoDialog.js 1.7KB

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