Skip to content

Commit 437c767

Browse files
committed
Tone down sync status banner
1 parent ee81a7a commit 437c767

2 files changed

Lines changed: 45 additions & 12 deletions

File tree

app/css/main.css

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,12 +290,31 @@ body {
290290

291291
/* Connection status */
292292
#connection-status {
293-
position: fixed; top: 0; left: 0; right: 0; text-align: center;
294-
padding: 8px; background: var(--color-surface-2); color: var(--color-text-muted);
295-
font-size: 0.85rem; z-index: 300; transform: translateY(-100%);
296-
transition: transform 0.3s ease;
293+
position: fixed;
294+
top: 8px;
295+
left: 50%;
296+
transform: translate(-50%, -120%);
297+
text-align: center;
298+
padding: 6px 12px;
299+
background: rgba(13, 17, 23, 0.88);
300+
color: var(--color-text-muted);
301+
font-size: 0.82rem;
302+
line-height: 1.2;
303+
border: 1px solid rgba(255,255,255,0.08);
304+
border-radius: 999px;
305+
z-index: 300;
306+
transition: transform 0.25s ease, opacity 0.25s ease;
307+
opacity: 0;
308+
pointer-events: none;
309+
white-space: nowrap;
310+
max-width: calc(100vw - 24px);
311+
overflow: hidden;
312+
text-overflow: ellipsis;
313+
}
314+
#connection-status.show {
315+
transform: translate(-50%, 0);
316+
opacity: 1;
297317
}
298-
#connection-status.show { transform: translateY(0); }
299318

300319
/* Duel Screen */
301320
.duel-screen { max-width: 480px; margin: 0 auto; text-align: center; }

app/js/ui/app.js

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ var App = (function() {
1212
var _lastPolledBlock = 0;
1313
var _pollBusy = false;
1414
var _syncStartBlock = 0;
15+
var _syncVisible = false;
16+
var _lastSyncPercent = -1;
1517
var POLL_INTERVAL_MS = 3000;
1618

1719
/**
@@ -224,15 +226,22 @@ var App = (function() {
224226
if (!statusEl) return;
225227

226228
percent = Math.max(0, Math.min(100, Math.ceil(percent || 0)));
227-
statusEl.textContent = 'Синхронизация с Миром... ' + percent + '%';
228229

229-
if (forceShow || percent < 100) {
230-
statusEl.classList.add('show');
231-
} else {
232-
setTimeout(function() {
233-
statusEl.classList.remove('show');
234-
}, 1500);
230+
if (!forceShow && percent >= 100) {
231+
_syncVisible = false;
232+
_lastSyncPercent = percent;
233+
statusEl.classList.remove('show');
234+
return;
235+
}
236+
237+
if (_syncVisible && _lastSyncPercent === percent) {
238+
return;
235239
}
240+
241+
statusEl.textContent = 'Синхронизация с Миром... ' + percent + '%';
242+
statusEl.classList.add('show');
243+
_syncVisible = true;
244+
_lastSyncPercent = percent;
236245
}
237246

238247
/**
@@ -287,6 +296,11 @@ var App = (function() {
287296
return;
288297
}
289298

299+
if (!(_lastPolledBlock === 0 || (headBlock - _lastPolledBlock) >= 10)) {
300+
_pollBusy = false;
301+
return;
302+
}
303+
290304
if (_syncStartBlock === 0 || _lastPolledBlock < _syncStartBlock) {
291305
_syncStartBlock = _lastPolledBlock;
292306
}

0 commit comments

Comments
 (0)