k-l-lambda commited on
Commit
a6b3d77
·
1 Parent(s): 8565c15

enhanced loading icon.

Browse files
Files changed (1) hide show
  1. app.py +25 -7
app.py CHANGED
@@ -330,13 +330,31 @@ def load_file (label, store):
330
 
331
  SHEET_PLACEHOLDER = '''
332
  <div id="ls-score" class="ls-score-mount" style="height:100%%;min-height:600px;">
333
- <div style="display:flex;align-items:center;justify-content:center;height:100%%;
334
- min-height:600px;border:1px dashed #c9c9c9;border-radius:8px;color:#999;
335
- font-family:sans-serif;text-align:center;">
336
- <div>
337
- <div style="font-size:42px;margin-bottom:8px;">&#127932;</div>
338
- <div>%s</div>
339
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
340
  </div>
341
  </div>
342
  ''' % T('loading_renderer')
 
330
 
331
  SHEET_PLACEHOLDER = '''
332
  <div id="ls-score" class="ls-score-mount" style="height:100%%;min-height:600px;">
333
+ <!-- Self-contained loading placeholder. The spinner styles + keyframes are INLINE
334
+ (not in score-player.css) on purpose: on a slow host (e.g. ModelScope) this
335
+ static HTML is shown for a long time WHILE the vendored scripts and CSS are
336
+ still downloading, so the animation must not depend on any external resource.
337
+ Once score-player.js mounts, it replaces this whole node. -->
338
+ <style>
339
+ @keyframes ls-ph-spin { to { transform: rotate(360deg); } }
340
+ #ls-score .ls-loading-placeholder {
341
+ display: flex; flex-direction: column; align-items: center; justify-content: center;
342
+ height: 100%%; min-height: 600px; border: 1px dashed #c9c9c9; border-radius: 8px;
343
+ color: #999; font-family: sans-serif; text-align: center;
344
+ }
345
+ #ls-score .ls-loading-spinner {
346
+ width: 38px; height: 38px; margin-bottom: 14px;
347
+ border: 4px solid #e3e3ea; border-top-color: #7c5cff; border-radius: 50%%;
348
+ animation: ls-ph-spin 0.8s linear infinite;
349
+ }
350
+ #ls-score .ls-loading-text { font-size: 14px; }
351
+ @media (prefers-reduced-motion: reduce) {
352
+ #ls-score .ls-loading-spinner { animation: ls-ph-spin 2.4s linear infinite; }
353
+ }
354
+ </style>
355
+ <div class="ls-loading-placeholder">
356
+ <div class="ls-loading-spinner" aria-hidden="true"></div>
357
+ <div class="ls-loading-text">%s</div>
358
  </div>
359
  </div>
360
  ''' % T('loading_renderer')