@@ -92,15 +92,24 @@ function render(data) {
9292 html += '<tr><th>Source</th><th>Location</th><th class="number">BTC</th></tr>' ;
9393 for ( var i = 0 ; i < holdings . length ; i ++ ) {
9494 var h = holdings [ i ] ;
95- html += '<tr>' ;
96- html += '<td>' + h . source + '</td>' ;
97- if ( h . explorer ) {
98- html += '<td><a href="' + h . explorer + '" target="_blank" rel="noopener">' + h . location + '</a></td>' ;
99- } else {
95+ if ( h . source === 'Onchain BTC' ) {
96+ html += '<tr class="expandable" id="onchain-row">' ;
97+ html += '<td>' + h . source + '</td>' ;
10098 html += '<td>' + h . location + '</td>' ;
99+ html += '<td class="number">' + fmtBtc ( h . btc ) + '</td>' ;
100+ html += '</tr>' ;
101+ html += '<tr class="utxo-details" id="utxo-row"><td colspan="3"><div id="utxo-content"><span class="loading">Loading UTXOs...</span></div></td></tr>' ;
102+ } else {
103+ html += '<tr>' ;
104+ html += '<td>' + h . source + '</td>' ;
105+ if ( h . explorer ) {
106+ html += '<td><a href="' + h . explorer + '" target="_blank" rel="noopener">' + h . location + '</a></td>' ;
107+ } else {
108+ html += '<td>' + h . location + '</td>' ;
109+ }
110+ html += '<td class="number">' + fmtBtc ( h . btc ) + '</td>' ;
111+ html += '</tr>' ;
101112 }
102- html += '<td class="number">' + fmtBtc ( h . btc ) + '</td>' ;
103- html += '</tr>' ;
104113 }
105114 html += '<tr class="total-row">' ;
106115 html += '<td>Total</td><td></td>' ;
@@ -124,6 +133,20 @@ function render(data) {
124133 html += '</div>' ;
125134
126135 content . innerHTML = html ;
136+
137+ var onchainRow = document . getElementById ( 'onchain-row' ) ;
138+ var utxoRow = document . getElementById ( 'utxo-row' ) ;
139+ var utxosLoaded = false ;
140+ if ( onchainRow && utxoRow ) {
141+ onchainRow . addEventListener ( 'click' , function ( ) {
142+ onchainRow . classList . toggle ( 'open' ) ;
143+ utxoRow . classList . toggle ( 'open' ) ;
144+ if ( ! utxosLoaded ) {
145+ utxosLoaded = true ;
146+ loadUtxos ( ) ;
147+ }
148+ } ) ;
149+ }
127150}
128151
129152var btcChart = null ;
@@ -244,7 +267,6 @@ function renderUtxos(data) {
244267
245268loadData ( ) ;
246269loadChart ( '24h' ) ;
247- loadUtxos ( ) ;
248270
249271var rangeButtons = document . querySelectorAll ( '.range-buttons button[data-range]' ) ;
250272for ( var i = 0 ; i < rangeButtons . length ; i ++ ) {
0 commit comments