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) { _toDisplayableItem(event) {
return { return {
elementAfter: event.url elementAfter: event.url
? <JoinButton onPress = { this._onJoinPress } /> ? <JoinButton
onPress = { this._onJoinPress }
url = { event.url } />
: (<AddMeetingUrlButton : (<AddMeetingUrlButton
calendarId = { event.calendarId } calendarId = { event.calendarId }
eventId = { event.id } />), eventId = { event.id } />),

View File

@ -16,6 +16,11 @@ type Props = {
*/ */
onPress: Function, onPress: Function,
/**
* The meeting URL associated with the {@link JoinButton} instance.
*/
url: string,
/** /**
* Invoked to obtain translated strings. * Invoked to obtain translated strings.
*/ */
@ -29,13 +34,26 @@ type Props = {
*/ */
class JoinButton extends Component<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}. * Implements React's {@link Component#render}.
* *
* @inheritdoc * @inheritdoc
*/ */
render() { render() {
const { onPress, t } = this.props; const { t } = this.props;
return ( return (
<Tooltip <Tooltip
@ -43,13 +61,26 @@ class JoinButton extends Component<Props> {
<Button <Button
appearance = 'primary' appearance = 'primary'
className = 'join-button' className = 'join-button'
onClick = { onPress } onClick = { this._onClick }
type = 'button'> type = 'button'>
{ t('calendarSync.join') } { t('calendarSync.join') }
</Button> </Button>
</Tooltip> </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); export default translate(JoinButton);