Move toasts in calls up and fix click to dismiss

This commit is contained in:
Jamie Kyle 2024-05-15 17:07:13 -07:00 committed by GitHub
parent 31cbb89b0d
commit 8fd3059de8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 34 additions and 4 deletions

View file

@ -43,3 +43,7 @@
// Roughly size of composer + a bit of padding // Roughly size of composer + a bit of padding
bottom: 40px; bottom: 40px;
} }
.ToastManager--full-screen-call {
bottom: calc($CallControls__height + 32px);
}

View file

@ -265,7 +265,16 @@ export function CallingLobby({
useWasInitiallyMutedToast(hasLocalAudio, i18n); useWasInitiallyMutedToast(hasLocalAudio, i18n);
return ( return (
<FocusTrap> <FocusTrap
focusTrapOptions={{
allowOutsideClick: ({ target }) => {
if (!target || !(target instanceof HTMLElement)) {
return false;
}
return target.matches('.Toast, .Toast *');
},
}}
>
<div className="module-calling__container dark-theme"> <div className="module-calling__container dark-theme">
{shouldShowLocalVideo ? ( {shouldShowLocalVideo ? (
<video <video

View file

@ -157,6 +157,7 @@ export function DebugLogWindow({
openFileInFolder={shouldNeverBeCalled} openFileInFolder={shouldNeverBeCalled}
toast={toast} toast={toast}
containerWidthBreakpoint={null} containerWidthBreakpoint={null}
isInFullScreenCall={false}
/> />
</div> </div>
); );
@ -213,6 +214,7 @@ export function DebugLogWindow({
openFileInFolder={shouldNeverBeCalled} openFileInFolder={shouldNeverBeCalled}
toast={toast} toast={toast}
containerWidthBreakpoint={null} containerWidthBreakpoint={null}
isInFullScreenCall={false}
/> />
</div> </div>
); );

View file

@ -264,6 +264,7 @@ const useProps = (overrideProps: OverridePropsType = {}): PropsType => {
toast={undefined} toast={undefined}
megaphone={undefined} megaphone={undefined}
containerWidthBreakpoint={containerWidthBreakpoint} containerWidthBreakpoint={containerWidthBreakpoint}
isInFullScreenCall={false}
/> />
), ),
selectedConversationId: undefined, selectedConversationId: undefined,

View file

@ -1656,6 +1656,7 @@ export function Preferences({
openFileInFolder={shouldNeverBeCalled} openFileInFolder={shouldNeverBeCalled}
toast={toast} toast={toast}
containerWidthBreakpoint={WidthBreakpoint.Narrow} containerWidthBreakpoint={WidthBreakpoint.Narrow}
isInFullScreenCall={false}
/> />
</> </>
); );

View file

@ -222,6 +222,7 @@ export default {
toastType: ToastType.AddingUserToGroup, toastType: ToastType.AddingUserToGroup,
megaphoneType: MegaphoneType.UsernameOnboarding, megaphoneType: MegaphoneType.UsernameOnboarding,
OS: 'macOS', OS: 'macOS',
isInFullScreenCall: false,
}, },
} satisfies Meta<Args>; } satisfies Meta<Args>;

View file

@ -29,6 +29,7 @@ export type PropsType = {
centerToast?: boolean; centerToast?: boolean;
containerWidthBreakpoint: WidthBreakpoint | null; containerWidthBreakpoint: WidthBreakpoint | null;
isCompositionAreaVisible?: boolean; isCompositionAreaVisible?: boolean;
isInFullScreenCall: boolean;
}; };
const SHORT_TIMEOUT = 3 * SECOND; const SHORT_TIMEOUT = 3 * SECOND;
@ -554,8 +555,12 @@ export function renderMegaphone({
} }
export function ToastManager(props: PropsType): JSX.Element { export function ToastManager(props: PropsType): JSX.Element {
const { centerToast, containerWidthBreakpoint, isCompositionAreaVisible } = const {
props; centerToast,
containerWidthBreakpoint,
isCompositionAreaVisible,
isInFullScreenCall,
} = props;
const toast = renderToast(props); const toast = renderToast(props);
@ -569,7 +574,13 @@ export function ToastManager(props: PropsType): JSX.Element {
> >
{centerToast {centerToast
? createPortal( ? createPortal(
<div className="ToastManager__root">{toast}</div>, <div
className={classNames('ToastManager__root', {
'ToastManager--full-screen-call': isInFullScreenCall,
})}
>
{toast}
</div>,
document.body document.body
) )
: toast} : toast}

View file

@ -96,6 +96,7 @@ export const SmartToastManager = memo(function SmartToastManager({
centerToast={centerToast} centerToast={centerToast}
containerWidthBreakpoint={containerWidthBreakpoint} containerWidthBreakpoint={containerWidthBreakpoint}
isCompositionAreaVisible={isCompositionAreaVisible} isCompositionAreaVisible={isCompositionAreaVisible}
isInFullScreenCall={isInFullScreenCall}
/> />
); );
}); });