Welcome screen: add Ready button with loading bar for instant feed access
Progress bar animates during backend readiness check. Once local feed is loaded from SQLite, button enables with teal highlight. Click switches to feed tab with cached content — no network wait needed for returning users. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9be6a0e40b
commit
e354ccc388
2 changed files with 37 additions and 2 deletions
|
|
@ -3570,10 +3570,29 @@ async function init() {
|
|||
}
|
||||
}, 2000);
|
||||
|
||||
// Ready button — click to go to feed
|
||||
const readyBtn = document.getElementById('welcome-ready-btn');
|
||||
const readyBar = document.getElementById('welcome-ready-bar');
|
||||
if (readyBtn) {
|
||||
readyBtn.addEventListener('click', () => {
|
||||
if (readyBtn.disabled) return;
|
||||
document.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
|
||||
document.querySelectorAll('.view').forEach(v => v.classList.remove('active'));
|
||||
const feedTab = document.querySelector('.tab[data-tab="feed"]');
|
||||
if (feedTab) feedTab.classList.add('active');
|
||||
document.getElementById('view-feed').classList.add('active');
|
||||
currentTab = 'feed';
|
||||
_lastFeedViewMs = Date.now();
|
||||
updateTabBadge('feed', 0);
|
||||
});
|
||||
}
|
||||
|
||||
// Wait for backend in the background, then load node info
|
||||
(async () => {
|
||||
for (let attempt = 0; attempt < 30; attempt++) {
|
||||
try {
|
||||
// Animate progress bar toward 90% during readiness checks
|
||||
if (readyBar) readyBar.style.width = Math.min(90, (attempt + 1) * 3) + '%';
|
||||
await invoke('get_node_info');
|
||||
break;
|
||||
} catch (e) {
|
||||
|
|
@ -3586,9 +3605,19 @@ async function init() {
|
|||
setupOverlay.classList.remove('hidden');
|
||||
setupName.focus();
|
||||
}
|
||||
// Reload feed now that backend is ready
|
||||
loadFeed(true).catch(() => {});
|
||||
// Pre-load feed + messages from local DB (instant — no network needed)
|
||||
await loadFeed(true).catch(() => {});
|
||||
loadMessages(true).catch(() => {});
|
||||
// Mark ready button as clickable
|
||||
if (readyBar) readyBar.style.width = '100%';
|
||||
if (readyBtn) {
|
||||
readyBtn.disabled = false;
|
||||
readyBtn.textContent = 'Ready — Go to Feed';
|
||||
readyBtn.style.opacity = '1';
|
||||
readyBtn.style.color = '#7fdbca';
|
||||
readyBtn.style.borderColor = '#7fdbca';
|
||||
readyBtn.style.cursor = 'pointer';
|
||||
}
|
||||
})();
|
||||
|
||||
// Mark notif ready after first welcome fetch succeeds (skip first 2 ticks to avoid spam)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue