Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

SharedVideoDialog.tsx 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import React from 'react';
  2. import { connect } from 'react-redux';
  3. import InputDialog from '../../../base/dialog/components/native/InputDialog';
  4. import { translate } from '../../../base/i18n/functions';
  5. import AbstractSharedVideoDialog, { IProps } from '../AbstractSharedVideoDialog';
  6. interface IState {
  7. error: boolean;
  8. }
  9. /**
  10. * Implements a component to render a display name prompt.
  11. */
  12. class SharedVideoDialog extends AbstractSharedVideoDialog<IState> {
  13. /**
  14. * Instantiates a new component.
  15. *
  16. * @inheritdoc
  17. */
  18. constructor(props: IProps) {
  19. super(props);
  20. this.state = {
  21. error: false
  22. };
  23. this._onSubmitValue = this._onSubmitValue.bind(this);
  24. }
  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: string) {
  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. messageKey = { error ? 'dialog.sharedVideoDialogError' : undefined }
  49. onSubmit = { this._onSubmitValue }
  50. textInputProps = {{
  51. autoCapitalize: 'none',
  52. autoCorrect: false,
  53. placeholder: t('dialog.sharedVideoLinkPlaceholder')
  54. }}
  55. titleKey = 'dialog.shareVideoTitle' />
  56. );
  57. }
  58. }
  59. export default translate(connect()(SharedVideoDialog));