fix(calendar): join button goes to meeting

This commit is contained in:
Leonard Kim 2018-09-06 08:23:38 -07:00 committed by yanas
parent 95785a9585
commit f148b50100
2 changed files with 36 additions and 3 deletions

View File

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

View File

@ -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<Props> {
/**
* 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 (
<Tooltip
@ -43,13 +61,26 @@ class JoinButton extends Component<Props> {
<Button
appearance = 'primary'
className = 'join-button'
onClick = { onPress }
onClick = { this._onClick }
type = 'button'>
{ t('calendarSync.join') }
</Button>
</Tooltip>
);
}
_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);