2021-04-21 13:48:05 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import React, { useCallback } from 'react';
|
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
import { useDispatch } from 'react-redux';
|
|
|
|
|
2021-05-19 10:08:30 +00:00
|
|
|
import { createToolbarEvent, sendAnalytics } from '../../../analytics';
|
|
|
|
import { Icon, IconInviteMore } from '../../../base/icons';
|
|
|
|
import { beginAddPeople } from '../../../invite';
|
2021-04-21 13:48:05 +00:00
|
|
|
|
|
|
|
import { ParticipantInviteButton } from './styled';
|
|
|
|
|
|
|
|
export const InviteButton = () => {
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
const { t } = useTranslation();
|
|
|
|
|
|
|
|
const onInvite = useCallback(() => {
|
|
|
|
sendAnalytics(createToolbarEvent('invite'));
|
|
|
|
dispatch(beginAddPeople());
|
|
|
|
}, [ dispatch ]);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<ParticipantInviteButton
|
2021-06-10 12:48:44 +00:00
|
|
|
aria-label = { t('participantsPane.actions.invite') }
|
2021-04-21 13:48:05 +00:00
|
|
|
onClick = { onInvite }>
|
|
|
|
<Icon
|
|
|
|
size = { 20 }
|
|
|
|
src = { IconInviteMore } />
|
2021-05-16 16:04:33 +00:00
|
|
|
<span>{t('participantsPane.actions.invite')}</span>
|
2021-04-21 13:48:05 +00:00
|
|
|
</ParticipantInviteButton>
|
|
|
|
);
|
|
|
|
};
|