feat: add release notes overlay with Markdown rendering
- Replace truncated plaintext release notes with full-screen overlay rendered via `marked` library - Server reconnection does a hard page reload instead of custom event
This commit is contained in:
@@ -36,6 +36,7 @@ interface UpdateStatus {
|
||||
}
|
||||
|
||||
let _lastStatus: UpdateStatus | null = null;
|
||||
let _releaseNotesBody = '';
|
||||
|
||||
// ─── Version badge highlight ────────────────────────────────
|
||||
|
||||
@@ -383,18 +384,33 @@ function _renderUpdatePanel(status: UpdateStatus): void {
|
||||
progressBar.parentElement!.style.display = show ? '' : 'none';
|
||||
}
|
||||
|
||||
// Release notes preview
|
||||
const notesEl = document.getElementById('update-release-notes');
|
||||
if (notesEl) {
|
||||
// Release notes button visibility
|
||||
const notesGroup = document.getElementById('update-release-notes-group');
|
||||
if (notesGroup) {
|
||||
if (status.has_update && status.release && status.release.body) {
|
||||
const truncated = status.release.body.length > 500
|
||||
? status.release.body.slice(0, 500) + '...'
|
||||
: status.release.body;
|
||||
notesEl.textContent = truncated;
|
||||
notesEl.parentElement!.style.display = '';
|
||||
_releaseNotesBody = status.release.body;
|
||||
notesGroup.style.display = '';
|
||||
} else {
|
||||
notesEl.textContent = '';
|
||||
notesEl.parentElement!.style.display = 'none';
|
||||
_releaseNotesBody = '';
|
||||
notesGroup.style.display = 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ─── Release Notes Overlay ─────────────────────────────────
|
||||
|
||||
export function openReleaseNotes(): void {
|
||||
const overlay = document.getElementById('release-notes-overlay');
|
||||
const content = document.getElementById('release-notes-content');
|
||||
if (overlay && content) {
|
||||
import('marked').then(({ marked }) => {
|
||||
content.innerHTML = marked.parse(_releaseNotesBody) as string;
|
||||
overlay.style.display = 'flex';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function closeReleaseNotes(): void {
|
||||
const overlay = document.getElementById('release-notes-overlay');
|
||||
if (overlay) overlay.style.display = 'none';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user