Procházet zdrojové kódy

fix(calendar): join button goes to meeting

master
Leonard Kim před 7 roky
rodič
revize
f148b50100

+ 3
- 1
react/features/calendar-sync/components/BaseCalendarList.js Zobrazit soubor

@@ -202,7 +202,9 @@ class BaseCalendarList extends Component<Props> {
202 202
     _toDisplayableItem(event) {
203 203
         return {
204 204
             elementAfter: event.url
205
-                ? <JoinButton onPress = { this._onJoinPress } />
205
+                ? <JoinButton
206
+                    onPress = { this._onJoinPress }
207
+                    url = { event.url } />
206 208
                 : (<AddMeetingUrlButton
207 209
                     calendarId = { event.calendarId }
208 210
                     eventId = { event.id } />),

+ 33
- 2
react/features/calendar-sync/components/JoinButton.web.js Zobrazit soubor

@@ -16,6 +16,11 @@ type Props = {
16 16
      */
17 17
     onPress: Function,
18 18
 
19
+    /**
20
+     * The meeting URL associated with the {@link JoinButton} instance.
21
+     */
22
+    url: string,
23
+
19 24
     /**
20 25
      * Invoked to obtain translated strings.
21 26
      */
@@ -29,13 +34,26 @@ type Props = {
29 34
  */
30 35
 class JoinButton extends Component<Props> {
31 36
 
37
+    /**
38
+     * Initializes a new {@code JoinButton} instance.
39
+     *
40
+     * @param {*} props - The read-only properties with which the new instance
41
+     * is to be initialized.
42
+     */
43
+    constructor(props) {
44
+        super(props);
45
+
46
+        // Bind event handler so it is only bound once for every instance.
47
+        this._onClick = this._onClick.bind(this);
48
+    }
49
+
32 50
     /**
33 51
      * Implements React's {@link Component#render}.
34 52
      *
35 53
      * @inheritdoc
36 54
      */
37 55
     render() {
38
-        const { onPress, t } = this.props;
56
+        const { t } = this.props;
39 57
 
40 58
         return (
41 59
             <Tooltip
@@ -43,13 +61,26 @@ class JoinButton extends Component<Props> {
43 61
                 <Button
44 62
                     appearance = 'primary'
45 63
                     className = 'join-button'
46
-                    onClick = { onPress }
64
+                    onClick = { this._onClick }
47 65
                     type = 'button'>
48 66
                     { t('calendarSync.join') }
49 67
                 </Button>
50 68
             </Tooltip>
51 69
         );
52 70
     }
71
+
72
+    _onClick: (Object) => void;
73
+
74
+    /**
75
+     * Callback invoked when the component is clicked.
76
+     *
77
+     * @param {Object} event - The DOM click event.
78
+     * @private
79
+     * @returns {void}
80
+     */
81
+    _onClick(event) {
82
+        this.props.onPress(event, this.props.url);
83
+    }
53 84
 }
54 85
 
55 86
 export default translate(JoinButton);

Načítá se…
Zrušit
Uložit