2020-07-23 08:16:40 +00:00
|
|
|
// @flow
|
|
|
|
|
2021-11-04 21:10:43 +00:00
|
|
|
/* eslint-disable react/jsx-no-bind */
|
|
|
|
|
2020-07-23 08:16:40 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { connect } from 'react-redux';
|
|
|
|
|
|
|
|
import { openDialog } from '../../base/dialog';
|
|
|
|
import { translate } from '../../base/i18n';
|
|
|
|
|
|
|
|
import EmbedMeetingDialog from './EmbedMeetingDialog';
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
|
|
|
/**
|
2021-11-04 21:10:43 +00:00
|
|
|
* Open the embed meeting dialog.
|
2020-07-23 08:16:40 +00:00
|
|
|
*/
|
|
|
|
openEmbedDialog: Function,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Invoked to obtain translated strings.
|
|
|
|
*/
|
|
|
|
t: Function,
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Component meant to trigger showing the EmbedMeetingDialog.
|
|
|
|
*
|
|
|
|
* @returns {React$Element<any>}
|
|
|
|
*/
|
|
|
|
function EmbedMeetingTrigger({ t, openEmbedDialog }: Props) {
|
|
|
|
/**
|
2021-03-16 15:59:33 +00:00
|
|
|
* Handles opening the embed dialog.
|
2020-07-23 08:16:40 +00:00
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
function onClick() {
|
|
|
|
openEmbedDialog(EmbedMeetingDialog);
|
|
|
|
}
|
|
|
|
|
2021-06-10 12:48:44 +00:00
|
|
|
/**
|
|
|
|
* KeyPress handler for accessibility.
|
|
|
|
*
|
|
|
|
* @param {React.KeyboardEventHandler<HTMLDivElement>} e - The key event to handle.
|
|
|
|
*
|
|
|
|
* @returns {void}
|
|
|
|
*/
|
|
|
|
function onKeyPress(e) {
|
|
|
|
if (e.key === ' ' || e.key === 'Enter') {
|
|
|
|
e.preventDefault();
|
|
|
|
onClick();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-07-23 08:16:40 +00:00
|
|
|
return (
|
|
|
|
<div
|
2021-06-10 12:48:44 +00:00
|
|
|
aria-label = { t('embedMeeting.title') }
|
2020-07-23 08:16:40 +00:00
|
|
|
className = 'embed-meeting-trigger'
|
2021-06-10 12:48:44 +00:00
|
|
|
onClick = { onClick }
|
|
|
|
onKeyPress = { onKeyPress }
|
|
|
|
role = 'button'
|
|
|
|
tabIndex = { 0 }>
|
2020-07-23 08:16:40 +00:00
|
|
|
{t('embedMeeting.title')}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
const mapDispatchToProps = { openEmbedDialog: openDialog };
|
|
|
|
|
|
|
|
export default translate(connect(null, mapDispatchToProps)(EmbedMeetingTrigger));
|