mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-05-22 13:47:47 +00:00
* feat(lobby): lobby chat lobby chat support knocking participants list updates knocking participants conditonal checks to show message button handle lobby chat message events lobby messages from or to moderators only Co-authored-by: Fecri Kaan Ulubey <f.kaan93@gmail.com> * squash: Drop typos. Co-authored-by: Kusi Musah Hussein <kusimusah@gmail.com> Co-authored-by: Fecri Kaan Ulubey <f.kaan93@gmail.com> Co-authored-by: Дамян Минков <damencho@jitsi.org>
52 lines
1.6 KiB
JavaScript
52 lines
1.6 KiB
JavaScript
import { useCallback, useState } from 'react';
|
|
import { useDispatch } from 'react-redux';
|
|
|
|
import { handleLobbyChatInitialized } from '../chat/actions.any';
|
|
import { approveKnockingParticipant, rejectKnockingParticipant } from '../lobby/actions';
|
|
|
|
/**
|
|
* Hook used to create admit/reject lobby actions.
|
|
*
|
|
* @param {Object} participant - The participant for which the actions are created.
|
|
* @param {Function} closeDrawer - Callback for closing the drawer.
|
|
* @returns {Array<Function>}
|
|
*/
|
|
export function useLobbyActions(participant, closeDrawer) {
|
|
const dispatch = useDispatch();
|
|
|
|
return [
|
|
useCallback(e => {
|
|
e.stopPropagation();
|
|
dispatch(approveKnockingParticipant(participant && participant.participantID));
|
|
closeDrawer && closeDrawer();
|
|
}, [ dispatch, closeDrawer ]),
|
|
|
|
useCallback(() => {
|
|
dispatch(rejectKnockingParticipant(participant && participant.participantID));
|
|
closeDrawer && closeDrawer();
|
|
}, [ dispatch, closeDrawer ]),
|
|
|
|
useCallback(() => {
|
|
dispatch(handleLobbyChatInitialized(participant && participant.participantID));
|
|
}, [ dispatch ])
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Hook used to create actions & state for opening a drawer.
|
|
*
|
|
* @returns {Array<any>}
|
|
*/
|
|
export function useParticipantDrawer() {
|
|
const [ drawerParticipant, openDrawerForParticipant ] = useState(null);
|
|
const closeDrawer = useCallback(() => {
|
|
openDrawerForParticipant(null);
|
|
});
|
|
|
|
return [
|
|
drawerParticipant,
|
|
closeDrawer,
|
|
openDrawerForParticipant
|
|
];
|
|
}
|