From f74b7b204f3c34049b37785c7a637f94c7f1d56f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Fri, 28 May 2021 16:16:34 +0200 Subject: [PATCH] MOBILE-3320 loading: Improve core-loading layout and animations --- .../addon-block-activitymodules.html | 2 +- .../myoverview/addon-block-myoverview.html | 2 +- .../addon-block-recentlyaccessedcourses.html | 2 +- .../addon-block-recentlyaccesseditems.html | 2 +- .../sitemainmenu/addon-block-sitemainmenu.html | 2 +- .../starredcourses/addon-block-starredcourses.html | 2 +- .../components/timeline/addon-block-timeline.html | 6 +++--- .../components/index/addon-mod-assign-index.html | 2 +- .../submission/addon-mod-assign-submission.html | 2 +- .../book/components/index/addon-mod-book-index.html | 2 +- .../chat/components/index/addon-mod-chat-index.html | 2 +- .../components/index/addon-mod-choice-index.html | 2 +- .../data/components/index/addon-mod-data-index.html | 2 +- .../components/index/addon-mod-feedback-index.html | 2 +- .../components/index/addon-mod-folder-index.html | 2 +- src/addons/mod/forum/components/index/index.html | 2 +- .../post-options-menu/post-options-menu.html | 2 +- .../components/index/addon-mod-glossary-index.html | 2 +- .../index/addon-mod-h5pactivity-index.html | 2 +- .../components/index/addon-mod-imscp-index.html | 2 +- .../components/index/addon-mod-lesson-index.html | 2 +- .../lti/components/index/addon-mod-lti-index.html | 2 +- .../page/components/index/addon-mod-page-index.html | 2 +- .../quiz/components/index/addon-mod-quiz-index.html | 2 +- .../components/index/addon-mod-resource-index.html | 2 +- .../components/index/addon-mod-scorm-index.html | 2 +- .../components/index/addon-mod-survey-index.html | 2 +- .../url/components/index/addon-mod-url-index.html | 2 +- .../wiki/components/index/addon-mod-wiki-index.html | 2 +- .../components/index/addon-mod-workshop-index.html | 2 +- src/addons/notes/pages/list/list.html | 2 +- src/core/components/loading/loading.scss | 13 +++++++++++-- src/core/components/loading/loading.ts | 12 ++++++------ .../course-blocks/core-block-course-blocks.html | 2 +- .../pre-rendered-block/core-block-pre-rendered.html | 2 +- .../h5p/components/h5p-iframe/core-h5p-iframe.html | 2 +- .../features/sharedfiles/components/list/list.html | 2 +- .../sharedfiles/services/handlers/upload.ts | 2 +- .../core-siteplugins-plugin-content.html | 2 +- 39 files changed, 56 insertions(+), 47 deletions(-) diff --git a/src/addons/block/activitymodules/components/activitymodules/addon-block-activitymodules.html b/src/addons/block/activitymodules/components/activitymodules/addon-block-activitymodules.html index df2d9979c..fbd46e52c 100644 --- a/src/addons/block/activitymodules/components/activitymodules/addon-block-activitymodules.html +++ b/src/addons/block/activitymodules/components/activitymodules/addon-block-activitymodules.html @@ -3,7 +3,7 @@

{{ 'addon.block_activitymodules.pluginname' | translate }}

- + diff --git a/src/addons/block/myoverview/components/myoverview/addon-block-myoverview.html b/src/addons/block/myoverview/components/myoverview/addon-block-myoverview.html index c5b90ffd9..405246a1f 100644 --- a/src/addons/block/myoverview/components/myoverview/addon-block-myoverview.html +++ b/src/addons/block/myoverview/components/myoverview/addon-block-myoverview.html @@ -36,7 +36,7 @@ - +
diff --git a/src/addons/block/recentlyaccessedcourses/components/recentlyaccessedcourses/addon-block-recentlyaccessedcourses.html b/src/addons/block/recentlyaccessedcourses/components/recentlyaccessedcourses/addon-block-recentlyaccessedcourses.html index 0bc7f105f..e5cc1f9e0 100644 --- a/src/addons/block/recentlyaccessedcourses/components/recentlyaccessedcourses/addon-block-recentlyaccessedcourses.html +++ b/src/addons/block/recentlyaccessedcourses/components/recentlyaccessedcourses/addon-block-recentlyaccessedcourses.html @@ -20,7 +20,7 @@
- + diff --git a/src/addons/block/recentlyaccesseditems/components/recentlyaccesseditems/addon-block-recentlyaccesseditems.html b/src/addons/block/recentlyaccesseditems/components/recentlyaccesseditems/addon-block-recentlyaccesseditems.html index db63e5599..4990142ad 100644 --- a/src/addons/block/recentlyaccesseditems/components/recentlyaccesseditems/addon-block-recentlyaccesseditems.html +++ b/src/addons/block/recentlyaccesseditems/components/recentlyaccesseditems/addon-block-recentlyaccesseditems.html @@ -5,7 +5,7 @@ - +
{{ 'addon.block_sitemainmenu.pluginname' | translate }} - + diff --git a/src/addons/block/starredcourses/components/starredcourses/addon-block-starredcourses.html b/src/addons/block/starredcourses/components/starredcourses/addon-block-starredcourses.html index afabaf9b9..21147e0c5 100644 --- a/src/addons/block/starredcourses/components/starredcourses/addon-block-starredcourses.html +++ b/src/addons/block/starredcourses/components/starredcourses/addon-block-starredcourses.html @@ -20,7 +20,7 @@
- + diff --git a/src/addons/block/timeline/components/timeline/addon-block-timeline.html b/src/addons/block/timeline/components/timeline/addon-block-timeline.html index bbce37627..fcba46bf8 100644 --- a/src/addons/block/timeline/components/timeline/addon-block-timeline.html +++ b/src/addons/block/timeline/components/timeline/addon-block-timeline.html @@ -9,7 +9,7 @@ - +
@@ -35,12 +35,12 @@
- + + [fullscreen]="false" class="safe-area-page"> diff --git a/src/addons/mod/assign/components/index/addon-mod-assign-index.html b/src/addons/mod/assign/components/index/addon-mod-assign-index.html index 15a9190fb..57360cf57 100644 --- a/src/addons/mod/assign/components/index/addon-mod-assign-index.html +++ b/src/addons/mod/assign/components/index/addon-mod-assign-index.html @@ -28,7 +28,7 @@ - + + - + - + - + - + - + - + - + diff --git a/src/addons/mod/forum/components/post-options-menu/post-options-menu.html b/src/addons/mod/forum/components/post-options-menu/post-options-menu.html index 10c2c85ae..bb7453974 100644 --- a/src/addons/mod/forum/components/post-options-menu/post-options-menu.html +++ b/src/addons/mod/forum/components/post-options-menu/post-options-menu.html @@ -1,4 +1,4 @@ - + diff --git a/src/addons/mod/glossary/components/index/addon-mod-glossary-index.html b/src/addons/mod/glossary/components/index/addon-mod-glossary-index.html index 5f5ddf3c9..8e3bcab19 100644 --- a/src/addons/mod/glossary/components/index/addon-mod-glossary-index.html +++ b/src/addons/mod/glossary/components/index/addon-mod-glossary-index.html @@ -49,7 +49,7 @@ [autoFocus]="true" [lengthCheck]="2" (onClear)="toggleSearch()" searchArea="AddonModGlossary-{{module.id}}"> - + diff --git a/src/addons/mod/h5pactivity/components/index/addon-mod-h5pactivity-index.html b/src/addons/mod/h5pactivity/components/index/addon-mod-h5pactivity-index.html index 55c0b2c4b..f8d5e23ae 100644 --- a/src/addons/mod/h5pactivity/components/index/addon-mod-h5pactivity-index.html +++ b/src/addons/mod/h5pactivity/components/index/addon-mod-h5pactivity-index.html @@ -30,7 +30,7 @@ - + - + - + diff --git a/src/addons/mod/lti/components/index/addon-mod-lti-index.html b/src/addons/mod/lti/components/index/addon-mod-lti-index.html index ab922bcde..39bfcafab 100644 --- a/src/addons/mod/lti/components/index/addon-mod-lti-index.html +++ b/src/addons/mod/lti/components/index/addon-mod-lti-index.html @@ -17,7 +17,7 @@ - + - + - + - + - + - + - + - + - + - +

{{user!.fullname}}

diff --git a/src/core/components/loading/loading.scss b/src/core/components/loading/loading.scss index 40ff0d19d..2cb4ac8ea 100644 --- a/src/core/components/loading/loading.scss +++ b/src/core/components/loading/loading.scss @@ -6,7 +6,6 @@ --loading-text-color: var(--ion-text-color); position: static; - @include core-transition(height, 200ms); color: var(--loading-text-color); ion-spinner { @@ -48,7 +47,7 @@ position: unset; } - &.core-loading-center { + &.core-loading-inline { display: block; .core-loading-container { @@ -56,4 +55,14 @@ position: relative; } } + + &.core-loading-loaded.core-loading-inline { + position: relative; + min-height: 102px; + + .core-loading-container { + padding-top: 10px; + position: absolute; + } + } } diff --git a/src/core/components/loading/loading.ts b/src/core/components/loading/loading.ts index 2c0e80675..7b3f0743d 100644 --- a/src/core/components/loading/loading.ts +++ b/src/core/components/loading/loading.ts @@ -49,6 +49,8 @@ export class CoreLoadingComponent implements OnInit, OnChanges, AfterViewInit { @Input() hideUntil: unknown; // Determine when should the contents be shown. @Input() message?: string; // Message to show while loading. + @Input() protected fullscreen = true; // Use the whole screen. + @ViewChild('content') content?: ElementRef; uniqueId: string; @@ -69,6 +71,8 @@ export class CoreLoadingComponent implements OnInit, OnChanges, AfterViewInit { // Default loading message. this.message = Translate.instant('core.loading'); } + + this.element.classList.toggle('core-loading-inline', !this.fullscreen); } /** @@ -78,11 +82,9 @@ export class CoreLoadingComponent implements OnInit, OnChanges, AfterViewInit { // Add class if loaded on init. if (this.hideUntil) { this.element.classList.add('core-loading-loaded'); - this.content?.nativeElement.classList.add('core-loading-content'); - } else { - this.content?.nativeElement.classList.remove('core-loading-content'); - this.content?.nativeElement.classList.add('core-loading-content-loading'); } + + this.content?.nativeElement.classList.toggle('core-loading-content', !!this.hideUntil); } /** @@ -99,12 +101,10 @@ export class CoreLoadingComponent implements OnInit, OnChanges, AfterViewInit { // Change CSS to force calculate height. // Removed 500ms timeout to avoid reallocating html. this.content?.nativeElement.classList.add('core-loading-content'); - this.content?.nativeElement.classList.remove('core-loading-content-loading'); }); } else { this.element.classList.remove('core-loading-loaded'); this.content?.nativeElement.classList.remove('core-loading-content'); - this.content?.nativeElement.classList.add('core-loading-content-loading'); } // Trigger the event after a timeout since the elements inside ngIf haven't been added to DOM yet. diff --git a/src/core/features/block/components/course-blocks/core-block-course-blocks.html b/src/core/features/block/components/course-blocks/core-block-course-blocks.html index 3eaacf421..120e60749 100644 --- a/src/core/features/block/components/course-blocks/core-block-course-blocks.html +++ b/src/core/features/block/components/course-blocks/core-block-course-blocks.html @@ -3,7 +3,7 @@
- + diff --git a/src/core/features/block/components/pre-rendered-block/core-block-pre-rendered.html b/src/core/features/block/components/pre-rendered-block/core-block-pre-rendered.html index c0c1ed41e..46b579a07 100644 --- a/src/core/features/block/components/pre-rendered-block/core-block-pre-rendered.html +++ b/src/core/features/block/components/pre-rendered-block/core-block-pre-rendered.html @@ -7,7 +7,7 @@ - + + diff --git a/src/core/features/sharedfiles/components/list/list.html b/src/core/features/sharedfiles/components/list/list.html index 558525bdb..f41a0080a 100644 --- a/src/core/features/sharedfiles/components/list/list.html +++ b/src/core/features/sharedfiles/components/list/list.html @@ -6,7 +6,7 @@ - + +