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