2021-06-23 11:23:44 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
import { QUICK_ACTION_BUTTON } from '../constants';
|
|
|
|
|
|
|
|
import AskToUnmuteButton from './AskToUnmuteButton';
|
2021-06-24 13:26:55 +00:00
|
|
|
import { QuickActionButton } from './web/styled';
|
2021-06-23 11:23:44 +00:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
|
2021-08-15 05:27:18 +00:00
|
|
|
/**
|
|
|
|
* The translated ask unmute aria label.
|
|
|
|
*/
|
|
|
|
ariaLabel?: boolean,
|
|
|
|
|
2021-06-23 11:23:44 +00:00
|
|
|
/**
|
2021-07-09 12:36:19 +00:00
|
|
|
* The translated "ask unmute" text.
|
2021-06-23 11:23:44 +00:00
|
|
|
*/
|
2021-07-09 12:36:19 +00:00
|
|
|
askUnmuteText: string,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The type of button to be displayed.
|
|
|
|
*/
|
|
|
|
buttonType: string,
|
2021-06-23 11:23:44 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Callback used to open a confirmation dialog for audio muting.
|
|
|
|
*/
|
|
|
|
muteAudio: Function,
|
|
|
|
|
2021-08-15 05:27:18 +00:00
|
|
|
/**
|
|
|
|
* Label for mute participant button.
|
|
|
|
*/
|
2021-07-09 12:36:19 +00:00
|
|
|
muteParticipantButtonText: string,
|
|
|
|
|
2021-06-23 11:23:44 +00:00
|
|
|
/**
|
2021-07-09 12:36:19 +00:00
|
|
|
* The ID of the participant.
|
2021-06-23 11:23:44 +00:00
|
|
|
*/
|
2021-07-09 12:36:19 +00:00
|
|
|
participantID: string,
|
2021-06-23 11:23:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Component used to display mute/ask to unmute button.
|
|
|
|
*
|
|
|
|
* @param {Props} props - The props of the component.
|
|
|
|
* @returns {React$Element<'button'>}
|
|
|
|
*/
|
2021-07-09 12:36:19 +00:00
|
|
|
export default function ParticipantQuickAction({
|
|
|
|
askUnmuteText,
|
|
|
|
buttonType,
|
|
|
|
muteAudio,
|
|
|
|
muteParticipantButtonText,
|
|
|
|
participantID
|
|
|
|
}: Props) {
|
2021-06-23 11:23:44 +00:00
|
|
|
switch (buttonType) {
|
|
|
|
case QUICK_ACTION_BUTTON.MUTE: {
|
|
|
|
return (
|
|
|
|
<QuickActionButton
|
2021-10-04 11:05:53 +00:00
|
|
|
aria-label = { `mute-${participantID}` }
|
2021-07-09 12:36:19 +00:00
|
|
|
onClick = { muteAudio(participantID) }
|
2021-06-23 11:23:44 +00:00
|
|
|
primary = { true }>
|
2021-07-09 12:36:19 +00:00
|
|
|
{ muteParticipantButtonText }
|
2021-06-23 11:23:44 +00:00
|
|
|
</QuickActionButton>
|
|
|
|
);
|
|
|
|
}
|
2021-10-01 13:47:13 +00:00
|
|
|
case QUICK_ACTION_BUTTON.ASK_TO_UNMUTE: {
|
2021-07-09 12:36:19 +00:00
|
|
|
return (
|
|
|
|
<AskToUnmuteButton
|
|
|
|
askUnmuteText = { askUnmuteText }
|
2021-08-15 05:27:18 +00:00
|
|
|
participantID = { participantID } />
|
2021-07-09 12:36:19 +00:00
|
|
|
);
|
2021-06-23 11:23:44 +00:00
|
|
|
}
|
2021-10-01 13:47:13 +00:00
|
|
|
default: {
|
|
|
|
return null;
|
|
|
|
}
|
2021-06-23 11:23:44 +00:00
|
|
|
}
|
|
|
|
}
|