Show row tooltips and keep HP delta icon

This commit is contained in:
centron\schwoerer
2025-11-21 22:03:29 +01:00
parent cbe66969fe
commit 1019af2219

View File

@@ -933,12 +933,9 @@ function buildHistoryContent(actor, tabArg) {
{ {
label: "Details", label: "Details",
render: (entry) => { render: (entry) => {
const parts = []; if (entry.breakdown) return entry.breakdown;
if (entry.source) parts.push(entry.source); if (entry.amount != null) return `${entry.amount} damage`;
if (entry.breakdown || entry.amount != null) { return "";
parts.push(entry.breakdown ? entry.breakdown : `${entry.amount} damage`);
}
return parts.join(" → ");
}, },
getTitle: (entry) => entry.breakdown ?? "", getTitle: (entry) => entry.breakdown ?? "",
}, },
@@ -1069,21 +1066,24 @@ function renderHistoryTable(entries, columns, id, rowsPerPage = 10, currentPage
const itemsToShow = rowsPerPage === "all" ? entries.length : rowsPerPage; const itemsToShow = rowsPerPage === "all" ? entries.length : rowsPerPage;
const startIdx = (currentPage - 1) * itemsToShow; const startIdx = (currentPage - 1) * itemsToShow;
const endIdx = startIdx + itemsToShow; const endIdx = startIdx + itemsToShow;
const paginatedEntries = entries.slice(startIdx, endIdx); const paginatedEntries = entries.slice(startIdx, endIdx);
const rows = paginatedEntries const rows = paginatedEntries
.map( .map(
(entry) => ` (entry) => `
<tr> <tr${(() => {
${columns.map((col) => { const rowTitle = columns.map((col) => (col.getTitle ? col.getTitle(entry) : "")).find((t) => t);
const cellContent = col.render(entry) ?? ""; return rowTitle ? ` title="${rowTitle}"` : "";
const title = col.getTitle ? col.getTitle(entry) : ""; })()}>
const titleAttr = title ? ` title="${title}"` : ""; ${columns.map((col) => {
return `<td${titleAttr}>${cellContent}</td>`; const cellContent = col.render(entry) ?? "";
}).join("")} const title = col.getTitle ? col.getTitle(entry) : "";
</tr>` const titleAttr = title ? ` title="${title}"` : "";
) return `<td${titleAttr}>${cellContent}</td>`;
.join(""); }).join("")}
</tr>`
)
.join("");
return ` return `
<table class="history-table history-${id}"> <table class="history-table history-${id}">