mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-05 12:22:28 +00:00
Add mark-read actions to DM UI
This commit is contained in:
1 parent
d3a9eb45d9
commit
ce7077da2d
5 files changed
+192
-1
No files matched your search
@@ -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");
|
||||
|
||||
Reference in new issue
Block a user