Add mark-read actions to DM UI

This commit is contained in:
thePR0M3TH3AN committed 2026-01-19 14:48:05 -05:00
1 parent d3a9eb45d9
commit ce7077da2d
5 files changed
+192 -1

No files matched your search

+18
View File
@@ -24,6 +24,7 @@ export function MessageThread({
zapReceipts = [],
conversationZapTotalSats = 0,
profileZapTotalSats = 0,
onMarkRead,
} = {}) {
if (!doc) {
throw new Error("MessageThread requires a document reference.");
@@ -82,6 +83,23 @@ export function MessageThread({
),
);
header.appendChild(zapSummary);
if (typeof onMarkRead === "function") {
const actions = createElement(doc, "div", "ml-auto flex items-center gap-2");
const markReadButton = createElement(doc, "button", "btn-ghost", "Mark read");
markReadButton.type = "button";
markReadButton.dataset.size = "sm";
const conversationId =
typeof contact.id === "string" ? contact.id.trim() : "";
if (!conversationId) {
markReadButton.disabled = true;
}
markReadButton.addEventListener("click", () => {
onMarkRead(contact);
});
actions.appendChild(markReadButton);
header.appendChild(actions);
}
root.appendChild(header);
const timeline = createElement(doc, "div", "dm-message-thread__timeline");