welcome: hide tabs if nothing to show

This commit is contained in:
James Baird 2020-03-31 12:06:04 +01:00 committed by GitHub
parent 4a21882345
commit 9fdc18d1ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 5 deletions

View File

@ -7,6 +7,7 @@ import type { Dispatch } from 'redux';
import { createWelcomePageEvent, sendAnalytics } from '../../analytics'; import { createWelcomePageEvent, sendAnalytics } from '../../analytics';
import { appNavigate } from '../../app'; import { appNavigate } from '../../app';
import { isCalendarEnabled } from '../../calendar-sync'; import { isCalendarEnabled } from '../../calendar-sync';
import { isRecentListEnabled } from '../../recent-list/functions';
/** /**
* {@code AbstractWelcomePage}'s React {@code Component} prop types. * {@code AbstractWelcomePage}'s React {@code Component} prop types.
@ -18,6 +19,11 @@ type Props = {
*/ */
_calendarEnabled: boolean, _calendarEnabled: boolean,
/**
* Whether the recent list is enabled
*/
_recentListEnabled: Boolean,
/** /**
* Room name to join to. * Room name to join to.
*/ */
@ -239,6 +245,7 @@ export class AbstractWelcomePage extends Component<Props, *> {
export function _mapStateToProps(state: Object) { export function _mapStateToProps(state: Object) {
return { return {
_calendarEnabled: isCalendarEnabled(state), _calendarEnabled: isCalendarEnabled(state),
_recentListEnabled: isRecentListEnabled(),
_room: state['features/base/conference'].room, _room: state['features/base/conference'].room,
_settings: state['features/base/settings'] _settings: state['features/base/settings']
}; };

View File

@ -285,7 +285,7 @@ class WelcomePage extends AbstractWelcomePage {
return null; return null;
} }
const { _calendarEnabled, t } = this.props; const { _calendarEnabled, _recentListEnabled, t } = this.props;
const tabs = []; const tabs = [];
@ -296,10 +296,16 @@ class WelcomePage extends AbstractWelcomePage {
}); });
} }
tabs.push({ if (_recentListEnabled) {
label: t('welcomepage.recentList'), tabs.push({
content: <RecentList /> label: t('welcomepage.recentList'),
}); content: <RecentList />
});
}
if (tabs.length === 0) {
return null;
}
return ( return (
<Tabs <Tabs