forked from jitsi/jitsi-meet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(raise-hand) add ability for the moderator to lower hands
- Loading branch information
1 parent
74b02af
commit 1376f59
Showing
10 changed files
with
188 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
react/features/video-menu/components/native/LowerHandButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { connect } from 'react-redux'; | ||
|
||
import { IReduxState } from '../../../app/types'; | ||
import { getCurrentConference } from '../../../base/conference/functions'; | ||
import { IJitsiConference } from '../../../base/conference/reducer'; | ||
import { translate } from '../../../base/i18n/functions'; | ||
import { IconRaiseHand } from '../../../base/icons/svg'; | ||
import AbstractButton, { IProps as AbstractButtonProps } from '../../../base/toolbox/components/AbstractButton'; | ||
import { LOWER_HAND_MESSAGE } from '../../../base/tracks/constants'; | ||
|
||
interface IProps extends AbstractButtonProps { | ||
|
||
/** | ||
* The current conference. | ||
*/ | ||
_conference: IJitsiConference | undefined; | ||
|
||
/** | ||
* The ID of the participant object that this button is supposed to | ||
* ask to lower the hand. | ||
*/ | ||
participantId: String | undefined; | ||
} | ||
|
||
/** | ||
* Implements a React {@link Component} which displays a button for lowering certain | ||
* participant raised hands. | ||
* | ||
* @returns {JSX.Element} | ||
*/ | ||
class LowerHandButton extends AbstractButton<IProps> { | ||
icon = IconRaiseHand; | ||
accessibilityLabel = 'participantsPane.actions.lowerHand'; | ||
label = 'participantsPane.actions.lowerHand'; | ||
|
||
/** | ||
* Handles clicking / pressing the button, and asks the participant to lower hand. | ||
* | ||
* @private | ||
* @returns {void} | ||
*/ | ||
_handleClick() { | ||
const { participantId, _conference } = this.props; | ||
|
||
_conference?.sendEndpointMessage( | ||
participantId, | ||
{ | ||
name: LOWER_HAND_MESSAGE | ||
} | ||
); | ||
} | ||
} | ||
|
||
/** | ||
* Maps part of the Redux state to the props of this component. | ||
* | ||
* @param {Object} state - The Redux state. | ||
* @param {Object} ownProps - Properties of component. | ||
* @returns {IProps} | ||
*/ | ||
function mapStateToProps(state: IReduxState, ownProps: any) { | ||
const { participantID } = ownProps; | ||
const currentConference = getCurrentConference(state); | ||
|
||
return { | ||
_conference: currentConference, | ||
participantId: participantID | ||
}; | ||
} | ||
|
||
export default translate(connect(mapStateToProps)(LowerHandButton)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
react/features/video-menu/components/web/LowerHandButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React, { useCallback } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { useDispatch, useSelector } from 'react-redux'; | ||
|
||
import { getCurrentConference } from '../../../base/conference/functions'; | ||
import { IconRaiseHand } from '../../../base/icons/svg'; | ||
import { raiseHand } from '../../../base/participants/actions'; | ||
import { LOWER_HAND_MESSAGE } from '../../../base/tracks/constants'; | ||
import ContextMenuItem from '../../../base/ui/components/web/ContextMenuItem'; | ||
|
||
interface IProps { | ||
|
||
/** | ||
* The ID of the participant that's linked to the button. | ||
*/ | ||
participantID?: String; | ||
} | ||
|
||
/** | ||
* Implements a React {@link Component} which displays a button for notifying certain | ||
* participant who raised hand to lower hand. | ||
* | ||
* @returns {JSX.Element} | ||
*/ | ||
const LowerHandButton = ({ | ||
participantID = '' | ||
}: IProps): JSX.Element => { | ||
const { t } = useTranslation(); | ||
const dispatch = useDispatch(); | ||
const currentConference = useSelector(getCurrentConference); | ||
const accessibilityText = participantID | ||
? t('participantsPane.actions.lowerHand') | ||
: t('participantsPane.actions.lowerAllHands'); | ||
|
||
const handleClick = useCallback(() => { | ||
if (!participantID) { | ||
dispatch(raiseHand(false)); | ||
} | ||
currentConference?.sendEndpointMessage( | ||
participantID, | ||
{ | ||
name: LOWER_HAND_MESSAGE | ||
} | ||
); | ||
}, [ participantID ]); | ||
|
||
return ( | ||
<ContextMenuItem | ||
accessibilityLabel = { accessibilityText } | ||
icon = { IconRaiseHand } | ||
onClick = { handleClick } | ||
text = { accessibilityText } /> | ||
); | ||
}; | ||
|
||
export default LowerHandButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters