diff --git a/templates/assets/css/index.css b/templates/assets/css/index.css index 96c002a..d1db299 100644 --- a/templates/assets/css/index.css +++ b/templates/assets/css/index.css @@ -136,6 +136,136 @@ main { box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4); } +/* Mempool Transaction List */ +.mempool-txs-container { + margin-top: 1rem; +} + +.mempool-header { + padding: 0.75rem; + background: rgba(255, 107, 53, 0.1); + border-radius: 6px; + margin-bottom: 0.75rem; + color: #ff6b35; +} + +.tx-list { + max-height: 400px; + overflow-y: auto; +} + +.tx-item { + display: flex; + align-items: center; + gap: 0.75rem; + padding: 0.5rem; + background: rgba(20, 20, 20, 0.5); + border: 1px solid rgba(255, 107, 53, 0.15); + border-radius: 6px; + margin-bottom: 0.5rem; +} + +.tx-hash { + flex: 1; + font-size: 0.8rem; + color: #b0b0b0; + overflow: hidden; + text-overflow: ellipsis; +} + +.tx-view-btn { + padding: 0.4rem 0.8rem; + background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%); + color: #ffffff; + border: none; + border-radius: 4px; + cursor: pointer; + font-size: 0.85rem; + font-weight: 600; + transition: all 0.3s ease; + flex-shrink: 0; +} + +.tx-view-btn:hover { + transform: translateY(-1px); + box-shadow: 0 2px 8px rgba(255, 107, 53, 0.4); +} + +/* Transaction Modal */ +.tx-modal { + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + background: rgba(0, 0, 0, 0.8); + display: flex; + align-items: center; + justify-content: center; + z-index: 1000; + padding: 1rem; +} + +.tx-modal-content { + background: rgba(30, 30, 30, 0.95); + border-radius: 12px; + max-width: 900px; + width: 100%; + max-height: 80vh; + border: 1px solid rgba(255, 107, 53, 0.3); + display: flex; + flex-direction: column; +} + +.tx-modal-header { + display: flex; + justify-content: space-between; + align-items: center; + padding: 1.5rem; + border-bottom: 1px solid rgba(255, 107, 53, 0.2); +} + +.tx-modal-header h3 { + margin: 0; + color: #ff6b35; +} + +.tx-modal-close { + background: none; + border: none; + color: #e0e0e0; + font-size: 2rem; + cursor: pointer; + padding: 0; + width: 2rem; + height: 2rem; + display: flex; + align-items: center; + justify-content: center; + border-radius: 4px; + transition: all 0.3s ease; +} + +.tx-modal-close:hover { + background: rgba(255, 107, 53, 0.2); + color: #ff6b35; +} + +.tx-modal-body { + padding: 1.5rem; + overflow-y: auto; + flex: 1; +} + +.tx-modal-body pre { + color: #b0b0b0; + font-family: 'Courier New', monospace; + font-size: 0.9rem; + white-space: pre-wrap; + word-wrap: break-word; + margin: 0; +} + /* Tabs */ .search-tabs { display: flex; diff --git a/templates/index.html b/templates/index.html index fa0c5e2..f629e43 100644 --- a/templates/index.html +++ b/templates/index.html @@ -31,6 +31,7 @@

Mempool

Loading...
+
@@ -161,14 +162,25 @@ function formatMempoolData(mempool) { // Check if mempool is an array of transaction IDs if (Array.isArray(mempool)) { - return ` -
-
Transactions: ${mempool.length.toLocaleString()}
-
- View All Transactions -
+ // Hide the loading status + document.getElementById('mempool-status').style.display = 'none'; + + // Display transaction count and list + const mempoolTxsContainer = document.getElementById('mempool-txs'); + mempoolTxsContainer.innerHTML = ` +
+ Transactions: ${mempool.length.toLocaleString()} +
+
+ ${mempool.map(txId => ` +
+ ${txId} + +
+ `).join('')}
`; + return ''; } // Fallback for object format return ` @@ -182,6 +194,32 @@ `; } + // View transaction details + async function viewTransaction(txId) { + const data = await apiCall(`tx/${txId}`); + + // Create a modal or use the search result area + const modal = document.createElement('div'); + modal.className = 'tx-modal'; + modal.onclick = (e) => { + if (e.target === modal) { + modal.remove(); + } + }; + modal.innerHTML = ` +
+
+

Transaction Details

+ +
+
+ ${data.error ? `
Error: ${data.error}
` : `
${JSON.stringify(data, null, 2)}
`} +
+
+ `; + document.body.appendChild(modal); + } + // Display helper function displayResult(elementId, data, key = null) { const element = document.getElementById(elementId); @@ -223,7 +261,7 @@ // Search functions async function searchBlock() { - const blockId = document.getElementById('block-input').value.trim(); + const blockId = document.getElementById('block-input').value.trim().replace(/,/g, ''); if (!blockId) { alert('Please enter a block height or hash'); return; @@ -233,7 +271,7 @@ } async function searchHeader() { - const blockId = document.getElementById('block-input').value.trim(); + const blockId = document.getElementById('block-input').value.trim().replace(/,/g, ''); if (!blockId) { alert('Please enter a block height or hash'); return; @@ -243,7 +281,7 @@ } async function searchTx() { - const txId = document.getElementById('tx-input').value.trim(); + const txId = document.getElementById('tx-input').value.trim().replace(/,/g, ''); if (!txId) { alert('Please enter a transaction ID'); return; @@ -253,7 +291,7 @@ } async function searchAddressTx() { - const address = document.getElementById('address-input').value.trim(); + const address = document.getElementById('address-input').value.trim().replace(/,/g, ''); if (!address) { alert('Please enter an address'); return; @@ -263,7 +301,7 @@ } async function searchAddressCoins() { - const address = document.getElementById('address-input').value.trim(); + const address = document.getElementById('address-input').value.trim().replace(/,/g, ''); if (!address) { alert('Please enter an address'); return; @@ -273,7 +311,7 @@ } async function searchName() { - const name = document.getElementById('name-input').value.trim(); + const name = document.getElementById('name-input').value.trim().replace(/,/g, ''); if (!name) { alert('Please enter a name'); return; @@ -283,7 +321,7 @@ } async function searchNameResource() { - const name = document.getElementById('name-input').value.trim(); + const name = document.getElementById('name-input').value.trim().replace(/,/g, ''); if (!name) { alert('Please enter a name'); return; @@ -293,7 +331,7 @@ } async function searchNameSummary() { - const name = document.getElementById('name-input').value.trim(); + const name = document.getElementById('name-input').value.trim().replace(/,/g, ''); if (!name) { alert('Please enter a name'); return; @@ -303,7 +341,7 @@ } async function searchNameHash() { - const nameHash = document.getElementById('namehash-input').value.trim(); + const nameHash = document.getElementById('namehash-input').value.trim().replace(/,/g, ''); if (!nameHash) { alert('Please enter a name hash'); return; @@ -313,8 +351,8 @@ } async function searchCoin() { - const coinHash = document.getElementById('coin-hash').value.trim(); - const coinIndex = document.getElementById('coin-index').value.trim(); + const coinHash = document.getElementById('coin-hash').value.trim().replace(/,/g, ''); + const coinIndex = document.getElementById('coin-index').value.trim().replace(/,/g, ''); if (!coinHash || !coinIndex) { alert('Please enter both coin hash and index'); return;