Add explorer link to block details modal

This update introduces a new feature in `blocks.js` that adds an "Explorer Link" to view block details on the mempool.space website. The link is styled for visibility and includes an external link indicator. Additional comments were added for clarity, and minor adjustments were made to the existing code structure, ensuring the overall functionality of the block details modal remains intact.
This commit is contained in:
DJObleezy 2025-04-15 21:24:21 -07:00
parent 1eb17aed80
commit 1dec2ba35b

View File

@ -1,4 +1,4 @@
"use strict";
"use strict";
// Global variables
let currentStartHeight = null;
@ -507,6 +507,42 @@ function showBlockDetails(block) {
}));
headerSection.append(hashItem);
// Add mempool.space link
const linkItem = $("<div>", {
class: "block-detail-item"
});
linkItem.append($("<div>", {
class: "block-detail-label",
text: "Explorer Link"
}));
const mempoolLink = $("<a>", {
href: `${mempoolBaseUrl}/block/${block.id}`,
target: "_blank",
class: "mempool-link",
text: "View on mempool.space",
css: {
color: "#f7931a",
textDecoration: "none"
}
});
// Add icon or indicator that it's an external link
mempoolLink.append($("<span>", {
html: " ↗",
css: {
fontSize: "14px"
}
}));
const linkContainer = $("<div>", {
class: "block-detail-value"
});
linkContainer.append(mempoolLink);
linkItem.append(linkContainer);
headerSection.append(linkItem);
// Add timestamp
const timeItem = $("<div>", {
class: "block-detail-item"
@ -551,6 +587,7 @@ function showBlockDetails(block) {
blockDetails.append(headerSection);
// Rest of the function remains unchanged
// Create the mining section
const miningSection = $("<div>", {
class: "block-detail-section"