mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-08-10 18:17:46 +00:00
Currently if a button in the main toolbar is not visible, the button is not replaced by another button from the overflow menu.
64 lines
2.1 KiB
TypeScript
64 lines
2.1 KiB
TypeScript
import { useSelector } from 'react-redux';
|
|
|
|
import { IReduxState } from '../app/types';
|
|
import { isJwtFeatureEnabled } from '../base/jwt/functions';
|
|
import { isLocalParticipantModerator } from '../base/participants/functions';
|
|
import { isInBreakoutRoom } from '../breakout-rooms/functions';
|
|
|
|
import { getLiveStreaming } from './components/LiveStream/functions';
|
|
import LiveStreamButton from './components/LiveStream/web/LiveStreamButton';
|
|
import RecordButton from './components/Recording/web/RecordButton';
|
|
import { getRecordButtonProps, isLiveStreamingButtonVisible } from './functions';
|
|
|
|
|
|
const recording = {
|
|
key: 'recording',
|
|
Content: RecordButton,
|
|
group: 2
|
|
};
|
|
|
|
const livestreaming = {
|
|
key: 'livestreaming',
|
|
Content: LiveStreamButton,
|
|
group: 2
|
|
};
|
|
|
|
/**
|
|
* A hook that returns the recording button if it is enabled and undefined otherwise.
|
|
*
|
|
* @returns {Object | undefined}
|
|
*/
|
|
export function useRecordingButton() {
|
|
const recordingProps = useSelector(getRecordButtonProps);
|
|
const toolbarButtons = useSelector((state: IReduxState) => state['features/toolbox'].toolbarButtons);
|
|
|
|
if (toolbarButtons?.includes('recording') && recordingProps.visible) {
|
|
return recording;
|
|
}
|
|
|
|
}
|
|
|
|
/**
|
|
* A hook that returns the livestreaming button if it is enabled and undefined otherwise.
|
|
*
|
|
* @returns {Object | undefined}
|
|
*/
|
|
export function useLiveStreamingButton() {
|
|
const toolbarButtons = useSelector((state: IReduxState) => state['features/toolbox'].toolbarButtons);
|
|
const localParticipantIsModerator = useSelector(isLocalParticipantModerator);
|
|
const liveStreaming = useSelector(getLiveStreaming);
|
|
const liveStreamingEnabledInJwt
|
|
= useSelector((state: IReduxState) => isJwtFeatureEnabled(state, 'livestreaming', true));
|
|
const _isInBreakoutRoom = useSelector(isInBreakoutRoom);
|
|
|
|
if (toolbarButtons?.includes('recording')
|
|
&& isLiveStreamingButtonVisible({
|
|
localParticipantIsModerator,
|
|
liveStreamingEnabled: liveStreaming?.enabled,
|
|
liveStreamingEnabledInJwt,
|
|
isInBreakoutRoom: _isInBreakoutRoom
|
|
})) {
|
|
return livestreaming;
|
|
}
|
|
}
|