From f148b5010061a58da801bbc76aa0e3b01ff4d642 Mon Sep 17 00:00:00 2001 From: Leonard Kim Date: Thu, 6 Sep 2018 08:23:38 -0700 Subject: [PATCH] fix(calendar): join button goes to meeting --- .../components/BaseCalendarList.js | 4 ++- .../components/JoinButton.web.js | 35 +++++++++++++++++-- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/react/features/calendar-sync/components/BaseCalendarList.js b/react/features/calendar-sync/components/BaseCalendarList.js index 276430fa0..d55533308 100644 --- a/react/features/calendar-sync/components/BaseCalendarList.js +++ b/react/features/calendar-sync/components/BaseCalendarList.js @@ -202,7 +202,9 @@ class BaseCalendarList extends Component { _toDisplayableItem(event) { return { elementAfter: event.url - ? + ? : (), diff --git a/react/features/calendar-sync/components/JoinButton.web.js b/react/features/calendar-sync/components/JoinButton.web.js index c39405401..c99b6264e 100644 --- a/react/features/calendar-sync/components/JoinButton.web.js +++ b/react/features/calendar-sync/components/JoinButton.web.js @@ -16,6 +16,11 @@ type Props = { */ onPress: Function, + /** + * The meeting URL associated with the {@link JoinButton} instance. + */ + url: string, + /** * Invoked to obtain translated strings. */ @@ -29,13 +34,26 @@ type Props = { */ class JoinButton extends Component { + /** + * Initializes a new {@code JoinButton} instance. + * + * @param {*} props - The read-only properties with which the new instance + * is to be initialized. + */ + constructor(props) { + super(props); + + // Bind event handler so it is only bound once for every instance. + this._onClick = this._onClick.bind(this); + } + /** * Implements React's {@link Component#render}. * * @inheritdoc */ render() { - const { onPress, t } = this.props; + const { t } = this.props; return ( { ); } + + _onClick: (Object) => void; + + /** + * Callback invoked when the component is clicked. + * + * @param {Object} event - The DOM click event. + * @private + * @returns {void} + */ + _onClick(event) { + this.props.onPress(event, this.props.url); + } } export default translate(JoinButton);