fix(prejoin_page): Always show 'join without audio' & add disabled button.

* The prejoin page always displays the 'join without audio' option.
* The join button will be disabled if there is no input.
* Fix some CSS for the case when the user is not anonymous.
This commit is contained in:
Vlad Piersec 2020-05-19 10:52:57 +03:00 committed by Saúl Ibarra Corretgé
parent 2e2d40c1d0
commit 4975f15345
5 changed files with 56 additions and 18 deletions

View File

@ -55,6 +55,23 @@
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
&--disabled {
background: #5E6D7A;
border: 1px solid #5E6D7A;
color: #AFB6BC;
cursor: initial;
.prejoin-btn-icon {
& > svg {
fill: #AFB6BC;
}
}
.prejoin-btn-options {
border-left: 1px solid #AFB6BC;
}
}
} }
&-btn-options { &-btn-options {
@ -150,6 +167,11 @@
@include name-placeholder; @include name-placeholder;
} }
} }
&--text {
margin: 16px 0;
outline: none;
}
} }
&-avatar.avatar { &-avatar.avatar {

View File

@ -15,7 +15,7 @@ import { connect } from '../../base/redux';
import { getDisplayName, updateSettings } from '../../base/settings'; import { getDisplayName, updateSettings } from '../../base/settings';
import ActionButton from './buttons/ActionButton'; import ActionButton from './buttons/ActionButton';
import { import {
areJoinByPhoneButtonsVisible, isJoinByPhoneButtonVisible,
isDeviceStatusVisible, isDeviceStatusVisible,
isJoinByPhoneDialogVisible isJoinByPhoneDialogVisible
} from '../functions'; } from '../functions';
@ -35,6 +35,11 @@ type Props = {
*/ */
deviceStatusVisible: boolean, deviceStatusVisible: boolean,
/**
* If join by phone button should be visible.
*/
hasJoinByPhoneButton: boolean,
/** /**
* Flag signaling if a user is logged in or not. * Flag signaling if a user is logged in or not.
*/ */
@ -80,11 +85,6 @@ type Props = {
*/ */
showDialog: boolean, showDialog: boolean,
/**
* If join by phone buttons should be visible.
*/
hasJoinByPhoneButtons: boolean,
/** /**
* Used for translation. * Used for translation.
*/ */
@ -210,11 +210,11 @@ class Prejoin extends Component<Props, State> {
render() { render() {
const { const {
deviceStatusVisible, deviceStatusVisible,
hasJoinByPhoneButton,
isAnonymousUser, isAnonymousUser,
joinConference, joinConference,
joinConferenceWithoutAudio, joinConferenceWithoutAudio,
name, name,
hasJoinByPhoneButtons,
showDialog, showDialog,
t t
} = this.props; } = this.props;
@ -251,7 +251,7 @@ class Prejoin extends Component<Props, State> {
src = { IconVolumeOff } /> src = { IconVolumeOff } />
{ t('prejoin.joinWithoutAudio') } { t('prejoin.joinWithoutAudio') }
</div> </div>
<div {hasJoinByPhoneButton && <div
className = 'prejoin-preview-dropdown-btn' className = 'prejoin-preview-dropdown-btn'
onClick = { _showDialog }> onClick = { _showDialog }>
<Icon <Icon
@ -259,12 +259,13 @@ class Prejoin extends Component<Props, State> {
size = { 24 } size = { 24 }
src = { IconPhone } /> src = { IconPhone } />
{ t('prejoin.joinAudioByPhone') } { t('prejoin.joinAudioByPhone') }
</div> </div>}
</div> } </div> }
isOpen = { showJoinByPhoneButtons } isOpen = { showJoinByPhoneButtons }
onClose = { _onDropdownClose }> onClose = { _onDropdownClose }>
<ActionButton <ActionButton
hasOptions = { hasJoinByPhoneButtons } disabled = { !name }
hasOptions = { true }
onClick = { joinConference } onClick = { joinConference }
onOptionsClick = { _onOptionsClick } onOptionsClick = { _onOptionsClick }
type = 'primary'> type = 'primary'>
@ -312,7 +313,7 @@ function mapStateToProps(state): Object {
name: getDisplayName(state), name: getDisplayName(state),
roomName: getRoomName(state), roomName: getRoomName(state),
showDialog: isJoinByPhoneDialogVisible(state), showDialog: isJoinByPhoneDialogVisible(state),
hasJoinByPhoneButtons: areJoinByPhoneButtonsVisible(state) hasJoinByPhoneButton: isJoinByPhoneButtonVisible(state)
}; };
} }

View File

@ -21,6 +21,11 @@ type Props = {
*/ */
className?: string, className?: string,
/**
* If the button is disabled or not.
*/
disabled?: boolean,
/** /**
* If the button has options. * If the button has options.
*/ */
@ -47,18 +52,28 @@ type Props = {
* *
* @returns {ReactElement} * @returns {ReactElement}
*/ */
function ActionButton({ children, className, hasOptions, type, onClick, onOptionsClick }: Props) { function ActionButton({ children, className, disabled, hasOptions, type, onClick, onOptionsClick }: Props) {
const ownClassName = `prejoin-btn ${classNameByType[type]}`; let ownClassName = 'prejoin-btn';
let clickHandler = onClick;
let optionsClickHandler = onOptionsClick;
if (disabled) {
clickHandler = null;
optionsClickHandler = null;
ownClassName = `${ownClassName} prejoin-btn--disabled`;
} else {
ownClassName = `${ownClassName} ${classNameByType[type]}`;
}
const cls = className ? `${className} ${ownClassName}` : ownClassName; const cls = className ? `${className} ${ownClassName}` : ownClassName;
return ( return (
<div <div
className = { cls } className = { cls }
onClick = { onClick }> onClick = { clickHandler }>
{children} {children}
{hasOptions && <div {hasOptions && <div
className = 'prejoin-btn-options' className = 'prejoin-btn-options'
onClick = { onOptionsClick }> onClick = { optionsClickHandler }>
<Icon <Icon
className = 'prejoin-btn-icon' className = 'prejoin-btn-icon'
size = { 14 } size = { 14 }

View File

@ -96,7 +96,7 @@ class ParticipantName extends Component<Props> {
value = { value } /> value = { value } />
) )
: <div : <div
className = 'prejoin-preview-name' className = 'prejoin-preview-name prejoin-preview-name--text'
onKeyDown = { _onKeyDown } onKeyDown = { _onKeyDown }
tabIndex = '0' > tabIndex = '0' >
{value} {value}

View File

@ -23,12 +23,12 @@ function applyMuteOptionsToTrack(track, shouldMute) {
} }
/** /**
* Selector for the visibility of the 'join by phone' buttons. * Selector for the visibility of the 'join by phone' button.
* *
* @param {Object} state - The state of the app. * @param {Object} state - The state of the app.
* @returns {boolean} * @returns {boolean}
*/ */
export function areJoinByPhoneButtonsVisible(state: Object): boolean { export function isJoinByPhoneButtonVisible(state: Object): boolean {
return Boolean(getDialOutUrl(state) && getDialOutStatusUrl(state)); return Boolean(getDialOutUrl(state) && getDialOutStatusUrl(state));
} }