"Fossies" - the Fresh Open Source Software Archive 
Member "jitsi-meet-7312/react/features/shared-video/components/web/SharedVideoDialog.tsx" (1 Jun 2023, 2796 Bytes) of package /linux/misc/jitsi-meet-7312.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TSX (TypeScript with React) source code syntax highlighting (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
See also the last
Fossies "Diffs" side-by-side code changes report for "SharedVideoDialog.tsx":
jitsi-meet_8319_vs_jitsi-meet_8615.
1 import React from 'react';
2 import { connect } from 'react-redux';
3
4 import { hideDialog } from '../../../base/dialog/actions';
5 import { translate } from '../../../base/i18n/functions';
6 import Dialog from '../../../base/ui/components/web/Dialog';
7 import Input from '../../../base/ui/components/web/Input';
8 import AbstractSharedVideoDialog from '../AbstractSharedVideoDialog';
9
10 /**
11 * Component that renders the video share dialog.
12 *
13 * @returns {React$Element<any>}
14 */
15 class SharedVideoDialog extends AbstractSharedVideoDialog<any> {
16
17 /**
18 * Instantiates a new component.
19 *
20 * @inheritdoc
21 */
22 constructor(props: any) {
23 super(props);
24
25 this.state = {
26 value: '',
27 okDisabled: true,
28 error: false
29 };
30
31 this._onChange = this._onChange.bind(this);
32 this._onSubmitValue = this._onSubmitValue.bind(this);
33 }
34
35 /**
36 * Callback for the onChange event of the field.
37 *
38 * @param {string} value - The static event.
39 * @returns {void}
40 */
41 _onChange(value: string) {
42 this.setState({
43 value,
44 okDisabled: !value
45 });
46 }
47
48 /**
49 * Callback to be invoked when the value of the link input is submitted.
50 *
51 * @returns {boolean}
52 */
53 _onSubmitValue() {
54 const result = super._onSetVideoLink(this.state.value);
55
56 if (result) {
57 this.props.dispatch(hideDialog());
58 } else {
59 this.setState({
60 error: true
61 });
62 }
63
64 return result;
65 }
66
67 /**
68 * Implements React's {@link Component#render()}.
69 *
70 * @inheritdoc
71 */
72 render() {
73 const { t } = this.props;
74 const { error } = this.state;
75
76 return (
77 <Dialog
78 disableAutoHideOnSubmit = { true }
79 ok = {{
80 disabled: this.state.okDisabled,
81 translationKey: 'dialog.Share'
82 }}
83 onSubmit = { this._onSubmitValue }
84 titleKey = 'dialog.shareVideoTitle'>
85 <Input
86 autoFocus = { true }
87 className = 'dialog-bottom-margin'
88 error = { error }
89 label = { t('dialog.videoLink') }
90 name = 'sharedVideoUrl'
91 onChange = { this._onChange }
92 placeholder = { t('dialog.sharedVideoLinkPlaceholder') }
93 type = 'text'
94 value = { this.state.value } />
95 { error && <span className = 'shared-video-dialog-error'>{ t('dialog.sharedVideoDialogError') }</span> }
96 </Dialog>
97 );
98 }
99 }
100
101 export default translate(connect()(SharedVideoDialog));