@@ -1282,6 +1282,9 @@ class UI extends EventListener {
1282
1282
}
1283
1283
}
1284
1284
1285
+ #showTime = null ;
1286
+ #hideTimeout = null ;
1287
+
1285
1288
showSpinner ( ) {
1286
1289
if ( this . #overlayActive) return ;
1287
1290
@@ -1301,7 +1304,6 @@ class UI extends EventListener {
1301
1304
}
1302
1305
1303
1306
.puter-loading-text {
1304
- color: white;
1305
1307
font-family: Arial, sans-serif;
1306
1308
font-size: 16px;
1307
1309
margin-top: 10px;
@@ -1332,7 +1334,7 @@ class UI extends EventListener {
1332
1334
left : '0' ,
1333
1335
width : '100%' ,
1334
1336
height : '100%' ,
1335
- backgroundColor : 'rgba(0, 0, 0 , 0.5 )' ,
1337
+ backgroundColor : 'rgba(255, 255, 255 , 0.9 )' ,
1336
1338
zIndex : '2147483647' ,
1337
1339
display : 'flex' ,
1338
1340
justifyContent : 'center' ,
@@ -1356,11 +1358,12 @@ class UI extends EventListener {
1356
1358
document . body . appendChild ( overlay ) ;
1357
1359
1358
1360
this . #overlayActive = true ;
1361
+ this . #showTime = Date . now ( ) ; // Add show time tracking
1359
1362
this . #overlayTimer = setTimeout ( ( ) => {
1360
1363
this . #overlayTimer = null ;
1361
1364
} , 1000 ) ;
1362
1365
}
1363
-
1366
+
1364
1367
hideSpinner ( ) {
1365
1368
if ( ! this . #overlayActive) return ;
1366
1369
@@ -1369,12 +1372,34 @@ class UI extends EventListener {
1369
1372
this . #overlayTimer = null ;
1370
1373
}
1371
1374
1375
+ // Calculate how long the spinner has been shown
1376
+ const elapsedTime = Date . now ( ) - this . #showTime;
1377
+ const remainingTime = Math . max ( 0 , 1200 - elapsedTime ) ;
1378
+
1379
+ // If less than 1 second has passed, delay the hide
1380
+ if ( remainingTime > 0 ) {
1381
+ if ( this . #hideTimeout) {
1382
+ clearTimeout ( this . #hideTimeout) ;
1383
+ }
1384
+
1385
+ this . #hideTimeout = setTimeout ( ( ) => {
1386
+ this . #removeSpinner( ) ;
1387
+ } , remainingTime ) ;
1388
+ } else {
1389
+ this . #removeSpinner( ) ;
1390
+ }
1391
+ }
1392
+
1393
+ // Add private method to handle spinner removal
1394
+ #removeSpinner( ) {
1372
1395
const overlay = document . querySelector ( '.puter-loading-overlay' ) ;
1373
1396
if ( overlay ) {
1374
1397
overlay . parentNode ?. removeChild ( overlay ) ;
1375
1398
}
1376
1399
1377
1400
this . #overlayActive = false ;
1401
+ this . #showTime = null ;
1402
+ this . #hideTimeout = null ;
1378
1403
}
1379
1404
1380
1405
isWorkingActive ( ) {
0 commit comments