From 4c78a6c57f374c176cadb0279eacf8599a677916 Mon Sep 17 00:00:00 2001 From: Evan Hahn <69474926+EvanHahn-Signal@users.noreply.github.com> Date: Tue, 1 Dec 2020 10:46:44 -0600 Subject: [PATCH] Show toast when group call is reconnecting --- stylesheets/_modules.scss | 21 ++++++++++++++ ts/components/CallScreen.stories.tsx | 23 ++++++++++++++- ts/components/CallScreen.tsx | 7 +++++ ts/components/GroupCallToastManager.tsx | 37 +++++++++++++++++++++++++ ts/util/lint/exceptions.json | 2 +- 5 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 ts/components/GroupCallToastManager.tsx diff --git a/stylesheets/_modules.scss b/stylesheets/_modules.scss index 4b53184635c..022db0ed9e8 100644 --- a/stylesheets/_modules.scss +++ b/stylesheets/_modules.scss @@ -6410,6 +6410,27 @@ button.module-image__border-overlay:focus { fill-mode: forwards; } } + + &__toast { + @include font-body-1-bold; + background-color: $color-gray-75; + border-radius: 8px; + color: $color-white; + max-width: 80%; + opacity: 1; + padding: 12px; + position: absolute; + text-align: center; + top: 12px; + transition: top 200ms ease-out, opacity 200ms ease-out; + user-select: none; + z-index: 1; + + &--hidden { + opacity: 0; + top: 5px; + } + } } .module-calling-tools { diff --git a/ts/components/CallScreen.stories.tsx b/ts/components/CallScreen.stories.tsx index 62a52956bc3..8490c43a2ec 100644 --- a/ts/components/CallScreen.stories.tsx +++ b/ts/components/CallScreen.stories.tsx @@ -80,7 +80,7 @@ const createProps = ( hasLocalVideo: true, pip: false, settingsDialogOpen: false, - showParticipantsList: true, + showParticipantsList: false, }, call: overrideProps.callTypeState || getDirectCallState(overrideProps), conversation: { @@ -233,3 +233,24 @@ story.add('Group call - Many', () => ( })} /> )); + +story.add('Group call - reconnecting', () => ( + +)); diff --git a/ts/components/CallScreen.tsx b/ts/components/CallScreen.tsx index 1cab88490bd..4727129198a 100644 --- a/ts/components/CallScreen.tsx +++ b/ts/components/CallScreen.tsx @@ -27,6 +27,7 @@ import { LocalizerType } from '../types/Util'; import { missingCaseError } from '../util/missingCaseError'; import { DirectCallRemoteParticipant } from './DirectCallRemoteParticipant'; import { GroupCallRemoteParticipants } from './GroupCallRemoteParticipants'; +import { GroupCallToastManager } from './GroupCallToastManager'; export type PropsType = { activeCall: ActiveCallType; @@ -224,6 +225,12 @@ export const CallScreen: React.FC = ({ }} role="group" > + {call.callMode === CallMode.Group ? ( + + ) : null}
diff --git a/ts/components/GroupCallToastManager.tsx b/ts/components/GroupCallToastManager.tsx new file mode 100644 index 00000000000..a82267ff071 --- /dev/null +++ b/ts/components/GroupCallToastManager.tsx @@ -0,0 +1,37 @@ +// Copyright 2020 Signal Messenger, LLC +// SPDX-License-Identifier: AGPL-3.0-only + +import React, { useState, useEffect } from 'react'; +import classNames from 'classnames'; +import { GroupCallConnectionState } from '../types/Calling'; +import { LocalizerType } from '../types/Util'; + +interface PropsType { + connectionState: GroupCallConnectionState; + i18n: LocalizerType; +} + +// In the future, this component should show toasts when users join or leave. See +// DESKTOP-902. +export const GroupCallToastManager: React.FC = ({ + connectionState, + i18n, +}) => { + const [isVisible, setIsVisible] = useState(false); + + useEffect(() => { + setIsVisible(connectionState === GroupCallConnectionState.Reconnecting); + }, [connectionState, setIsVisible]); + + const message = i18n('callReconnecting'); + + return ( +
+ {message} +
+ ); +}; diff --git a/ts/util/lint/exceptions.json b/ts/util/lint/exceptions.json index acbfdfc24e6..d6fa2242eb2 100644 --- a/ts/util/lint/exceptions.json +++ b/ts/util/lint/exceptions.json @@ -14382,7 +14382,7 @@ "rule": "React-useRef", "path": "ts/components/CallScreen.js", "line": " const localVideoRef = react_1.useRef(null);", - "lineNumber": 40, + "lineNumber": 41, "reasonCategory": "usageTrusted", "updated": "2020-10-26T21:35:52.858Z", "reasonDetail": "Used to get the local video element for rendering."