Skip to content

Commit efaca5e

Browse files
committed
fix(loading): enhance loading skeleton visibility for smoother transitions
1 parent 291b16b commit efaca5e

3 files changed

Lines changed: 59 additions & 11 deletions

File tree

www/css/fpp-dark.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,3 +536,23 @@
536536
[data-bs-theme="dark"] .modal-backdrop.show {
537537
opacity: 0.7;
538538
}
539+
540+
/* ------------------------------------------------------------- */
541+
/* Loading skeletons */
542+
/* fpp-bootstrap ships these in light greys (#f8f9fa/#dee2e6), */
543+
/* which read as a glaring white block against a dark page — */
544+
/* most obvious as the large rounded bar standing in for the */
545+
/* playlist controls on the status page. Re-tint to match the */
546+
/* dark surfaces they sit on. */
547+
/* ------------------------------------------------------------- */
548+
549+
[data-bs-theme="dark"] .skeleton-loader div {
550+
background: #20222e;
551+
background: linear-gradient(
552+
90deg,
553+
#2c3048 0%,
554+
#20222e 39%,
555+
#20222e 57%,
556+
#2c3048 100%
557+
);
558+
}

www/css/fpp.css

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,22 +1120,35 @@ body.modal-open #scrollTopButton {
11201120
min-height: 300px;
11211121
}
11221122

1123-
body.is-loading .statusPageLoading {
1123+
/* Gated on .show-loading-skeleton, not on .is-loading alone: fpp.js only adds
1124+
that class if the page is still loading after a short delay, so a fast
1125+
refresh settles without ever painting these placeholders. */
1126+
body.is-loading.show-loading-skeleton .statusPageLoading {
11241127
display: block;
1128+
animation: fppSkeletonFadeIn 0.2s ease-in both;
11251129
}
11261130

1127-
body.is-loading #schedulerInfo .labelHeading,
1128-
body.is-loading #schedulerInfo .labelValue {
1131+
@keyframes fppSkeletonFadeIn {
1132+
from {
1133+
opacity: 0;
1134+
}
1135+
to {
1136+
opacity: 1;
1137+
}
1138+
}
1139+
1140+
body.is-loading.show-loading-skeleton #schedulerInfo .labelHeading,
1141+
body.is-loading.show-loading-skeleton #schedulerInfo .labelValue {
11291142
position: relative;
11301143
color: rgba(0, 0, 0, 0);
11311144
}
11321145

1133-
body.is-loading #schedulerInfo .labelAction {
1146+
body.is-loading.show-loading-skeleton #schedulerInfo .labelAction {
11341147
opacity: 0;
11351148
}
11361149

1137-
body.is-loading #schedulerInfo .labelHeading:before,
1138-
body.is-loading #schedulerInfo .labelValue:before {
1150+
body.is-loading.show-loading-skeleton #schedulerInfo .labelHeading:before,
1151+
body.is-loading.show-loading-skeleton #schedulerInfo .labelValue:before {
11391152
display: block;
11401153
content: '';
11411154
top: 0;
@@ -1158,12 +1171,12 @@ body.is-loading #schedulerInfo .labelValue:before {
11581171
);
11591172
}
11601173

1161-
body.is-loading #schedulerInfo .labelHeading:before {
1174+
body.is-loading.show-loading-skeleton #schedulerInfo .labelHeading:before {
11621175
right: 0;
11631176
height: 14px;
11641177
}
11651178

1166-
body.is-loading #schedulerInfo .labelValue:before {
1179+
body.is-loading.show-loading-skeleton #schedulerInfo .labelValue:before {
11671180
height: 14px;
11681181
width: 60px;
11691182
}
@@ -3235,12 +3248,14 @@ pre.testData,
32353248
#rebootFlag,
32363249
#unsupportedBrowser,
32373250
#warningsRow,
3238-
#bannerRow {
3251+
#bannerRow,
3252+
#bannerHostnameRow {
32393253
display: none;
32403254
clear: both;
32413255
}
32423256

3243-
#bannerRow a {
3257+
#bannerRow a,
3258+
#bannerHostnameRow a {
32443259
color: white;
32453260
}
32463261

www/js/fpp.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,20 @@ once in place pageSpecific_ViewPortChange() - loads any actions unique to the pa
156156
occur on a viewport size change
157157
158158
*/
159+
// Loading skeletons only earn their keep on a slow load. Against a local FPP
160+
// the status APIs answer in tens of milliseconds, so painting the placeholders
161+
// immediately just flashes a big grey block where the playlist controls are
162+
// about to appear. Hold them back and reveal them only if the page is still
163+
// loading once the delay is up; a fast refresh then never shows them at all.
164+
var SKELETON_REVEAL_DELAY_MS = 400;
165+
159166
$(function () {
167+
setTimeout(function () {
168+
if (document.body && document.body.classList.contains('is-loading')) {
169+
document.body.classList.add('show-loading-skeleton');
170+
}
171+
}, SKELETON_REVEAL_DELAY_MS);
172+
160173
// do any page DOM manipulation required
161174
common_PageLoad_DOM_Setup();
162175
if (typeof pageSpecific_PageLoad_DOM_Setup === 'function') {
@@ -5304,7 +5317,7 @@ function SetupUIForMode (fppMode) {
53045317
}
53055318
}
53065319
if ($('body').hasClass('is-loading')) {
5307-
$('body').removeClass('is-loading');
5320+
$('body').removeClass('is-loading show-loading-skeleton');
53085321
}
53095322
}
53105323

0 commit comments

Comments
 (0)