| … | … | @@ -682,10 +682,15 @@ |
| 682 | 682 | |
| 683 | 683 | async function loadRecentFeed () { |
| 684 | 684 | var container = $viewHome |
| 685 | | container.innerHTML = '<h1>Recent Notes</h1><p class="text-muted">Loading...</p>' |
| 685 | container.innerHTML = '<h1>Recent Notes</h1><p class="text-muted" id="home-loading">Loading...</p>' |
| 686 | var loadingEl = document.getElementById('home-loading') |
| 687 | var loadTimer = setTimeout(function () { |
| 688 | if (loadingEl) loadingEl.textContent = 'Syncing notes from P2P network, this may take a moment...' |
| 689 | }, 3000) |
| 686 | 690 | |
| 687 | 691 | try { |
| 688 | 692 | var data = await HnApi.recentNotes(20) |
| 693 | clearTimeout(loadTimer) |
| 689 | 694 | var notes = data.notes || [] |
| 690 | 695 | |
| 691 | 696 | if (notes.length === 0) { |
| … | … | @@ -790,7 +795,13 @@ |
| 790 | 795 | } catch (e) { /* multi-writer not available, skip */ } |
| 791 | 796 | } |
| 792 | 797 | |
| 798 | $notebookNotes.innerHTML = '<p class="text-muted" id="nb-loading">Loading notes...</p>' |
| 799 | var nbLoadTimer = setTimeout(function () { |
| 800 | var el = document.getElementById('nb-loading') |
| 801 | if (el) el.textContent = 'Syncing notes from P2P network, this may take a moment...' |
| 802 | }, 3000) |
| 793 | 803 | await loadNoteList(slug) |
| 804 | clearTimeout(nbLoadTimer) |
| 794 | 805 | renderNotebookCards(slug) |
| 795 | 806 | |
| 796 | 807 | // Handle wiki-link redirect |
| … | … | @@ -917,6 +928,15 @@ |
| 917 | 928 | |
| 918 | 929 | async function loadNote (notebook, noteId) { |
| 919 | 930 | try { |
| 931 | // Show loading state immediately |
| 932 | showView('note') |
| 933 | $noteContent.className = 'markdown-body' |
| 934 | $noteContent.innerHTML = '<p class="text-muted" id="note-loading">Loading...</p>' |
| 935 | var noteLoadTimer = setTimeout(function () { |
| 936 | var el = document.getElementById('note-loading') |
| 937 | if (el) el.textContent = 'Syncing note from P2P network, this may take a moment...' |
| 938 | }, 3000) |
| 939 | |
| 920 | 940 | // Load notebook context if needed |
| 921 | 941 | if (!state.currentNotebook || state.currentNotebook.slug !== notebook) { |
| 922 | 942 | var nbData = await HnApi.getNotebook(notebook) |
| … | … | @@ -925,6 +945,7 @@ |
| 925 | 945 | } |
| 926 | 946 | |
| 927 | 947 | var data = await HnApi.getNote(notebook, noteId) |
| 948 | clearTimeout(noteLoadTimer) |
| 928 | 949 | state.currentNote = data.note || data |
| 929 | 950 | showView('note') |
| 930 | 951 | updateBreadcrumb() |