When joining an empty group call, the button should say "Start Call"

This commit is contained in:
Evan Hahn 2020-12-08 16:28:44 -06:00 committed by GitHub
parent 5b0e267fb2
commit 1d8c7a368e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 36 deletions

View file

@ -34,6 +34,7 @@ const createProps = (overrideProps: Partial<PropsType> = {}): PropsType => ({
hasLocalVideo: boolean('hasLocalVideo', overrideProps.hasLocalVideo || false), hasLocalVideo: boolean('hasLocalVideo', overrideProps.hasLocalVideo || false),
i18n, i18n,
isGroupCall: boolean('isGroupCall', overrideProps.isGroupCall || false), isGroupCall: boolean('isGroupCall', overrideProps.isGroupCall || false),
isCallFull: boolean('isCallFull', overrideProps.isCallFull || false),
me: overrideProps.me || { me: overrideProps.me || {
color: 'ultramarine' as ColorType, color: 'ultramarine' as ColorType,
uuid: generateUuid(), uuid: generateUuid(),
@ -147,3 +148,12 @@ story.add('Group Call - 4 peeked participants (participants list)', () => {
}); });
return <CallingLobby {...props} />; return <CallingLobby {...props} />;
}); });
story.add('Group Call - call full', () => {
const props = createProps({
isGroupCall: true,
isCallFull: true,
peekedParticipants: ['Sam', 'Cayce'].map(fakePeekedParticipant),
});
return <CallingLobby {...props} />;
});

View file

@ -1,7 +1,7 @@
// Copyright 2020 Signal Messenger, LLC // Copyright 2020 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only // SPDX-License-Identifier: AGPL-3.0-only
import React from 'react'; import React, { ReactNode } from 'react';
import { import {
SetLocalAudioType, SetLocalAudioType,
SetLocalPreviewType, SetLocalPreviewType,
@ -126,43 +126,17 @@ export const CallingLobby = ({
: participant.firstName || participant.title : participant.firstName || participant.title
); );
let joinButton: JSX.Element; const canJoin = !isCallFull && !isCallConnecting;
let joinButtonChildren: ReactNode;
if (isCallFull) { if (isCallFull) {
joinButton = ( joinButtonChildren = i18n('calling__call-is-full');
<button
className="module-button__green module-calling-lobby__button"
disabled
tabIndex={0}
type="button"
>
{i18n('calling__call-is-full')}
</button>
);
} else if (isCallConnecting) { } else if (isCallConnecting) {
joinButton = ( joinButtonChildren = <Spinner svgSize="small" />;
<button } else if (peekedParticipants.length) {
className="module-button__green module-calling-lobby__button" joinButtonChildren = i18n('calling__join');
disabled
tabIndex={0}
type="button"
>
<Spinner svgSize="small" />
</button>
);
} else { } else {
joinButton = ( joinButtonChildren = i18n('calling__start');
<button
className="module-button__green module-calling-lobby__button"
onClick={() => {
setIsCallConnecting(true);
onJoinCall();
}}
tabIndex={0}
type="button"
>
{isGroupCall ? i18n('calling__join') : i18n('calling__start')}
</button>
);
} }
return ( return (
@ -244,7 +218,22 @@ export const CallingLobby = ({
> >
{i18n('cancel')} {i18n('cancel')}
</button> </button>
{joinButton} <button
className="module-button__green module-calling-lobby__button"
disabled={!canJoin}
onClick={
canJoin
? () => {
setIsCallConnecting(true);
onJoinCall();
}
: undefined
}
tabIndex={0}
type="button"
>
{joinButtonChildren}
</button>
</div> </div>
</div> </div>
); );