feat(config) defaultLocalDisplayName and defaultRemoteDisplayName

This commit is contained in:
Calin Chitu
2021-11-26 17:39:34 +02:00
committed by Calinteodor
parent 00a74ca47a
commit 5c67e8b4ce
12 changed files with 86 additions and 75 deletions

View File

@@ -14,6 +14,11 @@ import ProfileButtonAvatar from './ProfileButtonAvatar';
*/
type Props = AbstractButtonProps & {
/**
* Default displayed name for local participant.
*/
_defaultLocalDisplayName: string,
/**
* The redux representation of the local participant.
*/
@@ -43,13 +48,16 @@ class ProfileButton extends AbstractButton<Props, *> {
* Retrieves the label.
*/
get label() {
const { _localParticipant } = this.props;
const {
_defaultLocalDisplayName,
_localParticipant
} = this.props;
let displayName;
if (_localParticipant && _localParticipant.name) {
if (_localParticipant?.name) {
displayName = _localParticipant.name;
} else {
displayName = interfaceConfig.DEFAULT_LOCAL_DISPLAY_NAME;
displayName = _defaultLocalDisplayName;
}
return displayName;
@@ -119,7 +127,10 @@ class ProfileButton extends AbstractButton<Props, *> {
* @returns {Object}
*/
const mapStateToProps = state => {
const { defaultLocalDisplayName } = state['features/base/config'];
return {
_defaultLocalDisplayName: defaultLocalDisplayName,
_localParticipant: getLocalParticipant(state),
_unclickable: !interfaceConfig.SETTINGS_SECTIONS.includes('profile'),
customClass: 'profile-button-avatar'