Skip to content

Commit

Permalink
feat: Close in call reaction menu on outside click (WPB-12197) (#18409)
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisamir98 authored Dec 2, 2024
1 parent bad9962 commit 3c885c1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/script/components/calling/FullscreenVideoCall.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
*/

import React, {useEffect, useState} from 'react';
import React, {useEffect, useRef, useState} from 'react';

import {DefaultConversationRoleName} from '@wireapp/api-client/lib/conversation/';
import {TabIndex} from '@wireapp/react-ui-kit/lib/types/enums';
Expand All @@ -39,6 +39,7 @@ import {useCallAlertState} from 'Components/calling/useCallAlertState';
import {ConversationClassifiedBar} from 'Components/ClassifiedBar/ClassifiedBar';
import * as Icon from 'Components/Icon';
import {ModalComponent} from 'Components/Modals/ModalComponent';
import {useClickOutside} from 'Hooks/useClickOutside';
import {CallingRepository} from 'src/script/calling/CallingRepository';
import {Config} from 'src/script/Config';
import {isCallViewOption} from 'src/script/guards/CallView';
Expand Down Expand Up @@ -149,6 +150,11 @@ const FullscreenVideoCall: React.FC<FullscreenVideoCallProps> = ({
'sharesCamera',
]);

const emojiBarRef = useRef(null);
const emojiBarToggleButtonRef = useRef(null);

useClickOutside(emojiBarRef, () => setShowEmojisBar(false), emojiBarToggleButtonRef);

const {blurredVideoStream} = useKoSubscribableChildren(selfParticipant, ['blurredVideoStream']);
const hasBlurredBackground = !!blurredVideoStream;

Expand Down Expand Up @@ -794,6 +800,7 @@ const FullscreenVideoCall: React.FC<FullscreenVideoCallProps> = ({
<li className="video-controls__item">
{showEmojisBar && (
<div
ref={emojiBarRef}
role="toolbar"
className="video-controls-emoji-bar"
data-uie-name="video-controls-emoji-bar"
Expand All @@ -818,6 +825,7 @@ const FullscreenVideoCall: React.FC<FullscreenVideoCallProps> = ({
</div>
)}
<button
ref={emojiBarToggleButtonRef}
title={t('callReactions')}
className={classNames('video-controls__button_primary', {active: showEmojisBar})}
onClick={() => setShowEmojisBar(prev => !prev)}
Expand Down

0 comments on commit 3c885c1

Please sign in to comment.