Make update changelog collapsible in confirm dialog

Long changelogs made the update dialog unscrollable, preventing users
from reaching the install button. Changelog is now in a collapsed
<details> element. Dialog also has max-height with overflow scroll.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Sucukdeluxe 2026-03-05 04:12:47 +01:00
parent 83626017b9
commit 9ddc7d31bb
2 changed files with 42 additions and 14 deletions

View File

@ -36,6 +36,7 @@ interface ConfirmPromptState {
message: string; message: string;
confirmLabel: string; confirmLabel: string;
danger?: boolean; danger?: boolean;
details?: string;
} }
interface ContextMenuState { interface ContextMenuState {
@ -990,45 +991,36 @@ export function App(): ReactElement {
if (source === "manual") { showToast(`Kein Update verfügbar (v${result.currentVersion})`, 2000); } if (source === "manual") { showToast(`Kein Update verfügbar (v${result.currentVersion})`, 2000); }
return; return;
} }
let changelogBlock = ""; let changelogText = "";
if (result.releaseNotes) { if (result.releaseNotes) {
// Build compact changelog: only top-level list items, no sub-items or long descriptions
const lines = result.releaseNotes.split("\n"); const lines = result.releaseNotes.split("\n");
const compactLines: string[] = []; const compactLines: string[] = [];
for (const line of lines) { for (const line of lines) {
// Skip indented sub-items (2+ spaces before dash)
if (/^\s{2,}[-*]/.test(line)) continue; if (/^\s{2,}[-*]/.test(line)) continue;
// Skip heading markers
if (/^#{1,6}\s/.test(line)) continue; if (/^#{1,6}\s/.test(line)) continue;
// Skip empty lines
if (!line.trim()) continue; if (!line.trim()) continue;
// Strip markdown: **bold**, *italic*, `code`
let clean = line let clean = line
.replace(/\*\*([^*]+)\*\*/g, "$1") .replace(/\*\*([^*]+)\*\*/g, "$1")
.replace(/\*([^*]+)\*/g, "$1") .replace(/\*([^*]+)\*/g, "$1")
.replace(/`([^`]+)`/g, "$1") .replace(/`([^`]+)`/g, "$1")
.replace(/^\s*[-*]\s+/, "- ") .replace(/^\s*[-*]\s+/, "- ")
.trim(); .trim();
// Truncate long lines after the first colon/sentence
const colonIdx = clean.indexOf(":"); const colonIdx = clean.indexOf(":");
if (colonIdx > 0 && colonIdx < clean.length - 1) { if (colonIdx > 0 && colonIdx < clean.length - 1) {
const afterColon = clean.slice(colonIdx + 1).trim(); const afterColon = clean.slice(colonIdx + 1).trim();
// Keep short descriptions, cut long ones
if (afterColon.length > 60) { if (afterColon.length > 60) {
clean = clean.slice(0, colonIdx + 1).trim(); clean = clean.slice(0, colonIdx + 1).trim();
} }
} }
if (clean) compactLines.push(clean); if (clean) compactLines.push(clean);
} }
const notes = compactLines.join("\n"); changelogText = compactLines.join("\n");
if (notes) {
changelogBlock = `\n\n--- Changelog ---\n${notes}`;
}
} }
const approved = await askConfirmPrompt({ const approved = await askConfirmPrompt({
title: "Update verfügbar", title: "Update verfügbar",
message: `${result.latestTag} (aktuell v${result.currentVersion})${changelogBlock}\n\nJetzt automatisch herunterladen und installieren?`, message: `${result.latestTag} (aktuell v${result.currentVersion})\n\nJetzt automatisch herunterladen und installieren?`,
confirmLabel: "Jetzt installieren" confirmLabel: "Jetzt installieren",
details: changelogText || undefined
}); });
if (!mountedRef.current) { if (!mountedRef.current) {
return; return;
@ -2889,6 +2881,12 @@ export function App(): ReactElement {
<div className="modal-card" onClick={(event) => event.stopPropagation()}> <div className="modal-card" onClick={(event) => event.stopPropagation()}>
<h3>{confirmPrompt.title}</h3> <h3>{confirmPrompt.title}</h3>
<p style={{ whiteSpace: "pre-line" }}>{confirmPrompt.message}</p> <p style={{ whiteSpace: "pre-line" }}>{confirmPrompt.message}</p>
{confirmPrompt.details && (
<details className="modal-details">
<summary>Changelog anzeigen</summary>
<pre>{confirmPrompt.details}</pre>
</details>
)}
<div className="modal-actions"> <div className="modal-actions">
<button className="btn" onClick={() => closeConfirmPrompt(false)}>Abbrechen</button> <button className="btn" onClick={() => closeConfirmPrompt(false)}>Abbrechen</button>
<button <button

View File

@ -1764,6 +1764,8 @@ td {
.modal-card { .modal-card {
width: min(560px, 100%); width: min(560px, 100%);
max-height: calc(100vh - 40px);
overflow-y: auto;
border: 1px solid var(--border); border: 1px solid var(--border);
border-radius: 14px; border-radius: 14px;
background: linear-gradient(180deg, color-mix(in srgb, var(--card) 98%, transparent), color-mix(in srgb, var(--surface) 98%, transparent)); background: linear-gradient(180deg, color-mix(in srgb, var(--card) 98%, transparent), color-mix(in srgb, var(--surface) 98%, transparent));
@ -1782,6 +1784,34 @@ td {
color: var(--muted); color: var(--muted);
} }
.modal-details {
border: 1px solid var(--border);
border-radius: 6px;
padding: 0;
}
.modal-details summary {
padding: 6px 10px;
cursor: pointer;
font-size: 13px;
color: var(--muted);
user-select: none;
}
.modal-details summary:hover {
color: var(--text);
}
.modal-details pre {
margin: 0;
padding: 8px 10px;
border-top: 1px solid var(--border);
font-size: 12px;
line-height: 1.5;
white-space: pre-wrap;
word-break: break-word;
max-height: 260px;
overflow-y: auto;
color: var(--muted);
}
.modal-path { .modal-path {
font-size: 12px; font-size: 12px;
word-break: break-all; word-break: break-all;