MOBILE-3320 home: Try to prevent empty box displayed for an instant
parent
da050a66c8
commit
c2e82f7ad1
|
@ -12,9 +12,7 @@
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
<core-loading [hideUntil]="loaded">
|
<core-loading [hideUntil]="loaded">
|
||||||
<ng-container *ngIf="tabs.length == 0">
|
<core-empty-box *ngIf="tabs.length == 0" icon="fas-home" [message]="'core.courses.nocourses' | translate"></core-empty-box>
|
||||||
<core-empty-box icon="fas-home" [message]="'core.courses.nocourses' | translate"></core-empty-box>
|
|
||||||
</ng-container>
|
|
||||||
</core-loading>
|
</core-loading>
|
||||||
<core-tabs-outlet *ngIf="tabs.length > 0" [selectedIndex]="selectedTab" [hideUntil]="loaded" [tabs]="tabs"
|
<core-tabs-outlet *ngIf="tabs.length > 0" [selectedIndex]="selectedTab" [hideUntil]="loaded" [tabs]="tabs"
|
||||||
(ionChange)="tabSelected()">
|
(ionChange)="tabSelected()">
|
||||||
|
|
|
@ -86,6 +86,7 @@ export class CoreMainMenuHomePage implements OnInit {
|
||||||
*/
|
*/
|
||||||
initHandlers(handlers: CoreMainMenuHomeHandlerToDisplay[]): void {
|
initHandlers(handlers: CoreMainMenuHomeHandlerToDisplay[]): void {
|
||||||
// Re-build the list of tabs.
|
// Re-build the list of tabs.
|
||||||
|
const loaded = CoreMainMenuHomeDelegate.areHandlersLoaded();
|
||||||
const handlersMap = CoreUtils.arrayToObject(handlers, 'title');
|
const handlersMap = CoreUtils.arrayToObject(handlers, 'title');
|
||||||
const newTabs = handlers.map((handler): CoreTabsOutletTab => {
|
const newTabs = handlers.map((handler): CoreTabsOutletTab => {
|
||||||
const tab = this.tabs.find(tab => tab.title == handler.title);
|
const tab = this.tabs.find(tab => tab.title == handler.title);
|
||||||
|
@ -125,7 +126,10 @@ export class CoreMainMenuHomePage implements OnInit {
|
||||||
|
|
||||||
this.tabs = newTabs;
|
this.tabs = newTabs;
|
||||||
|
|
||||||
this.loaded = CoreMainMenuHomeDelegate.areHandlersLoaded();
|
// Try to prevent empty box displayed for an instant when it shouldn't.
|
||||||
|
setTimeout(() => {
|
||||||
|
this.loaded = loaded;
|
||||||
|
}, 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue