@@ -24,9 +24,11 @@ import {
2424import { Tile , TileDescription } from '../assets/styles/tile' ;
2525import ArrowSvg from '../assets/images/arrow.svg' ;
2626import BlueArrowSvg from '../assets/images/arrow-blue.svg' ;
27+ import CircleSvg from '../assets/images/circle.svg' ;
2728import { useNavigate , createSearchParams } from 'react-router-dom' ;
2829import styled from 'styled-components' ;
2930import { Slate , SlateDark } from '../assets/styles/colors' ;
31+ import DataBox from './data-box' ;
3032
3133const TextElipsis = styled ( ScriptText ) `
3234 overflow: hidden;
@@ -46,6 +48,17 @@ const SelectedPill = styled.div`
4648 font-size: 16px;
4749` ;
4850
51+ const TxAddressLink = styled . span `
52+ overflow: hidden;
53+ text-overflow: ellipsis;
54+ text-align: left;
55+ width: 100%;
56+ margin-right: 7px;
57+ &:hover {
58+ cursor: pointer;
59+ }
60+ `
61+
4962interface TransactionDetailsProps {
5063 transaction : Transaction ;
5164 currency : string ;
@@ -157,9 +170,12 @@ const TransactionDetails: FC<TransactionDetailsProps> = ({
157170 { vi . items . map ( ( item : any , itemIndex : number ) => (
158171 < div key = { item . mintTxid + itemIndex } >
159172 { isInputSelected ( item ) ? < SelectedPill > Selected</ SelectedPill > : null }
160-
161- < Tile invertedBorderColor = { arr . length > 1 && arr . length !== i + 1 } >
162- < ArrowDiv margin = 'auto .5rem auto 0' >
173+ < div style = { {
174+ display : 'flex' ,
175+ marginTop : '1rem' ,
176+ ...( showDetails && { borderBottom : '2px solid' , paddingBottom : '0.25rem' } )
177+ } } >
178+ < ArrowDiv margin = 'auto .5rem auto 0' pointer >
163179 < img
164180 src = { BlueArrowSvg }
165181 width = { 17 }
@@ -168,53 +184,60 @@ const TransactionDetails: FC<TransactionDetailsProps> = ({
168184 onClick = { ( ) => goToTx ( item . mintTxid , undefined , item . mintIndex ) }
169185 />
170186 </ ArrowDiv >
171-
172- < TileDescription padding = '0 1rem 0 0' value >
173- { getAddress ( vi ) !== 'Unparsed address' ? (
174- < SpanLink onClick = { ( ) => goToAddress ( getAddress ( vi ) ) } >
175- { getAddress ( vi ) }
176- </ SpanLink >
177- ) : (
178- < span > Unparsed address</ span >
179- ) }
180-
181- { showDetails && (
182- < >
183- < TextElipsis >
184- < b > Tx ID </ b >
185- < SpanLink
186- onClick = { ( ) =>
187- goToTx ( item . mintTxid , undefined , item . mintIndex )
188- } >
189- { item . mintTxid }
190- </ SpanLink >
191- </ TextElipsis >
192-
193- < TextElipsis >
194- < b > Tx Index</ b > { item . mintIndex }
195- </ TextElipsis >
196-
197- { item . uiConfirmations && confirmations > 0 ? (
198- < ScriptText >
199- < b > Confirmations</ b > { item . uiConfirmations + confirmations }
200- </ ScriptText >
201- ) : null }
187+ { getAddress ( vi ) !== 'Unparsed address' ? (
188+ < TxAddressLink onClick = { ( ) => goToAddress ( getAddress ( vi ) ) } style = { { wordBreak : showDetails ? 'break-all' : 'unset' } } >
189+ { getAddress ( vi ) }
190+ </ TxAddressLink >
191+ ) : (
192+ < span style = { { textAlign : 'left' , width : '100%' } } >
193+ Unparsed address
194+ </ span >
195+ ) }
196+ < div style = { { minInlineSize : 'fit-content' } } >
197+ { getConvertedValue ( item . value , currency ) } { currency }
198+ </ div >
199+ </ div >
200+
201+ < Tile invertedBorderColor = { arr . length > 1 && arr . length !== i + 1 } padding = { showDetails ? undefined : '0.4rem' } >
202+ { showDetails &&
203+ < >
204+
205+ < TileDescription padding = '0 1rem 0 0' value >
206+ < DataBox label = 'Tx ID' >
207+ < TextElipsis >
208+ < SpanLink
209+ onClick = { ( ) =>
210+ goToTx ( item . mintTxid , undefined , item . mintIndex )
211+ } >
212+ { item . mintTxid }
213+ </ SpanLink >
214+ </ TextElipsis >
215+ </ DataBox >
216+
217+ < div style = { { display : 'flex' , gap : '0.7rem' , margin : '0 0.2rem' } } >
218+ < DataBox label = 'Tx Index' style = { { margin : 0 } } >
219+ < TextElipsis >
220+ { item . mintIndex }
221+ </ TextElipsis >
222+ </ DataBox >
223+ { item . uiConfirmations && confirmations > 0 ? (
224+ < DataBox label = 'Confirmations' style = { { margin : 0 } } >
225+ < ScriptText >
226+ { item . uiConfirmations + confirmations }
227+ </ ScriptText >
228+ </ DataBox >
229+ ) : null }
230+ </ div >
202231
203232 { item . script && (
204233 < >
205- < b > Script Hex</ b >
206- < ScriptText > { item . script } </ ScriptText >
207- < b > Script ASM</ b >
208- < ScriptText > { new lib . Script ( item . script ) . toASM ( ) } </ ScriptText >
234+ < DataBox label = 'Script Hex' > { item . script } </ DataBox >
235+ < DataBox label = 'Script ASM' > { new lib . Script ( item . script ) . toASM ( ) } </ DataBox >
209236 </ >
210237 ) }
211- </ >
212- ) }
213- </ TileDescription >
214-
215- < TileDescription value textAlign = 'right' >
216- { getConvertedValue ( item . value , currency ) } { currency }
217- </ TileDescription >
238+ </ TileDescription >
239+ </ >
240+ }
218241 </ Tile >
219242 </ div >
220243 ) ) }
@@ -234,56 +257,61 @@ const TransactionDetails: FC<TransactionDetailsProps> = ({
234257 return (
235258 < div key = { i } >
236259 { isOutputSelected ( i ) ? < SelectedPill > Selected</ SelectedPill > : null }
237- < Tile invertedBorderColor = { outputsLength > 1 && outputsLength !== i + 1 } >
238- < TileDescription padding = '0 1rem 0 0' value >
239- { getAddress ( vo ) !== 'Unparsed address' ? (
240- < SpanLink onClick = { ( ) => goToAddress ( getAddress ( vo ) ) } >
241- { getAddress ( vo ) }
242- </ SpanLink >
243- ) : (
244- < span > { isOpReturn ( vo ) ? 'OP_RETURN' : 'Unparsed address' } </ span >
245- ) }
246-
247- { showDetails && (
248- < >
249- { vo . spentTxid && (
250- < TextElipsis >
251- < b > Spent By </ b >
252- < SpanLink onClick = { ( ) => goToTx ( vo . spentTxid , transaction . txid , i ) } >
253- { vo . spentTxid }
254- </ SpanLink >
255- </ TextElipsis >
256- ) }
257- { isOpReturn ( vo ) && < ScriptText > { getOpReturnText ( vo ) } </ ScriptText > }
258- { vo . script && (
259- < >
260- < b > Script Hex</ b >
261- < ScriptText > { new lib . Script ( vo . script ) . toHex ( ) } </ ScriptText >
262- < b > Script ASM</ b >
263- < ScriptText > { new lib . Script ( vo . script ) . toASM ( ) } </ ScriptText >
264- </ >
265- ) }
266- </ >
267- ) }
268- </ TileDescription >
269-
270- < TileDescription value textAlign = 'right' >
260+ < div style = { {
261+ display : 'flex' ,
262+ marginTop : '1rem' ,
263+ ...( showDetails && { borderBottom : '2px solid' , paddingBottom : '0.25rem' } )
264+ } } >
265+ { getAddress ( vo ) !== 'Unparsed address' ? (
266+ < TxAddressLink onClick = { ( ) => goToAddress ( getAddress ( vo ) ) } style = { { wordBreak : showDetails ? 'break-all' : 'unset' } } >
267+ { getAddress ( vo ) }
268+ </ TxAddressLink >
269+ ) : (
270+ < span style = { { textAlign : 'left' , width : '100%' } } >
271+ { isOpReturn ( vo ) ? 'OP_RETURN' : 'Unparsed address' }
272+ </ span >
273+ ) }
274+ < div style = { { minInlineSize : 'fit-content' , display : 'flex' } } >
271275 { getConvertedValue ( vo . value , currency ) } { currency } { ' ' }
272- </ TileDescription >
273- < ArrowDiv margin = 'auto 0 auto .5rem' >
276+ < ArrowDiv margin = 'auto 0 auto .5rem' pointer = { vo . spentTxid } >
274277 < img
275- src = { vo . spentTxid ? BlueArrowSvg : ArrowSvg }
278+ src = { vo . spentTxid ? BlueArrowSvg : ( isOpReturn ( vo ) ? CircleSvg : ArrowSvg ) }
276279 width = { 17 }
277280 height = { 17 }
278281 alt = 'Spent'
279- title = { vo . spentTxid ? 'Spent' : 'Unspent' }
280- style = { {
281- visibility : ( isOpReturn ( vo ) ? 'hidden' : 'visible' ) ,
282- margin : '0px 5px'
283- } }
282+ title = { vo . spentTxid ? 'Spent' : ( isOpReturn ( vo ) ? 'Unspendable' : 'Unspent' ) }
283+ style = { { margin : `0px ${ isOpReturn ( vo ) ? '4px' : '5px' } ` } }
284284 onClick = { ( ) => vo . spentTxid && goToTx ( vo . spentTxid , transaction . txid , i ) }
285285 />
286286 </ ArrowDiv >
287+ </ div >
288+ </ div >
289+ < Tile invertedBorderColor = { outputsLength > 1 && outputsLength !== i + 1 } padding = { showDetails ? undefined : '0.4rem' } >
290+ { showDetails &&
291+ < >
292+ < TileDescription padding = '0 1rem 0 0' value >
293+ { vo . spentTxid && (
294+ < DataBox label = 'Spent By' >
295+ < TextElipsis >
296+ < SpanLink onClick = { ( ) => goToTx ( vo . spentTxid , transaction . txid , i ) } >
297+ { vo . spentTxid }
298+ </ SpanLink >
299+ </ TextElipsis >
300+ </ DataBox >
301+ ) }
302+ { isOpReturn ( vo ) &&
303+ < DataBox label = "Text" >
304+ < ScriptText > { getOpReturnText ( vo ) } </ ScriptText >
305+ </ DataBox > }
306+ { vo . script && (
307+ < >
308+ < DataBox label = 'Script Hex' > { new lib . Script ( vo . script ) . toHex ( ) } </ DataBox >
309+ < DataBox label = 'Script ASM' > { new lib . Script ( vo . script ) . toASM ( ) } </ DataBox >
310+ </ >
311+ ) }
312+ </ TileDescription >
313+ </ >
314+ }
287315 </ Tile >
288316 </ div >
289317 ) ;
0 commit comments