Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
186 changes: 96 additions & 90 deletions pages/object/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,6 @@ export default function LedgerObject({ data: initialData, initialErrorMessage })
<br />
Loading...
</div>
) : errorMessage ? (
<div className="center orange bold">
<br />
{errorMessage}
</div>
) : (
<>
<div className="column-left">
Expand Down Expand Up @@ -384,106 +379,117 @@ export default function LedgerObject({ data: initialData, initialErrorMessage })
</button>
</div>
<br />
<table className="table-details">
<thead>
<tr>
<th colSpan="2">History</th>
</tr>
</thead>
<tbody>
<tr>
<td>Current Ledger</td>
<td>
<Link
href={`/object/${router.query.id}?ledgerIndex=${data?.ledger_index}`}
className={router.query.ledgerIndex === data?.ledger_index?.toString() ? 'active' : ''}
>
{data?.ledger_index}
</Link>
</td>
</tr>
{data?.node?.PreviousTxnLgrSeq && data?.node?.PreviousTxnLgrSeq !== data?.ledger_index && (
<tr>
<td>Previous Ledger</td>
<td>
<Link
href={`/object/${router.query.id}?ledgerIndex=${data.node.PreviousTxnLgrSeq}`}
className={
router.query.ledgerIndex === data.node.PreviousTxnLgrSeq?.toString() ? 'active' : ''
}
>
{data.node.PreviousTxnLgrSeq}
</Link>
</td>
</tr>
)}

{router.query.previousTxHash && (
{!errorMessage && (data?.node?.PreviousTxnLgrSeq || data?.node?.PreviousTxnID) && (
<table className="table-details">
<thead>
<tr>
<td>Current Transaction</td>
<td>
<Link
href={`/object/${router.query.id}?previousTxHash=${data.node.PreviousTxnID}`}
className={router.query.previousTxHash === data.node.PreviousTxnID ? 'active' : ''}
>
{shortAddress(router.query.previousTxHash)}
</Link>
</td>
<th colSpan="2">History</th>
</tr>
)}
{data?.node?.PreviousTxnID && (
</thead>
<tbody>
<tr>
<td>Previous Transaction</td>
<td>Current Ledger</td>
<td>
<Link
href={`/object/${router.query.id}?previousTxHash=${data.node.PreviousTxnID}`}
className={router.query.previousTxHash === data.node.PreviousTxnID ? 'active' : ''}
href={`/object/${router.query.id}?ledgerIndex=${data?.ledger_index}`}
className={router.query.ledgerIndex === data?.ledger_index?.toString() ? 'active' : ''}
>
{shortAddress(data.node.PreviousTxnID)}
{data?.ledger_index}
</Link>
</td>
</tr>
)}
</tbody>
</table>
{data?.node?.PreviousTxnLgrSeq && data?.node?.PreviousTxnLgrSeq !== data?.ledger_index && (
<tr>
<td>Previous Ledger</td>
<td>
<Link
href={`/object/${router.query.id}?ledgerIndex=${data.node.PreviousTxnLgrSeq}`}
className={
router.query.ledgerIndex === data.node.PreviousTxnLgrSeq?.toString() ? 'active' : ''
}
>
{data.node.PreviousTxnLgrSeq}
</Link>
</td>
</tr>
)}

{router.query.previousTxHash && (
<tr>
<td>Current Transaction</td>
<td>
<Link
href={`/object/${router.query.id}?previousTxHash=${data.node.PreviousTxnID}`}
className={router.query.previousTxHash === data.node.PreviousTxnID ? 'active' : ''}
>
{shortAddress(router.query.previousTxHash)}
</Link>
</td>
</tr>
)}
{data?.node?.PreviousTxnID && (
<tr>
<td>Previous Transaction</td>
<td>
<Link
href={`/object/${router.query.id}?previousTxHash=${data.node.PreviousTxnID}`}
className={router.query.previousTxHash === data.node.PreviousTxnID ? 'active' : ''}
>
{shortAddress(data.node.PreviousTxnID)}
</Link>
</td>
</tr>
)}
</tbody>
</table>
)}

<br />
</div>
<div className="column-right">
{detailsTable()}
{errorMessage ? (
<div className="center orange bold">
<br />
{errorMessage}
</div>
) : (
<>
{detailsTable()}

{data?.metadata && (
<table className="table-details">
<tbody>
<tr>
<td>Metadata</td>
<td>
<span className="link" onClick={() => setShowMetadata(!showMetadata)}>
{showMetadata ? 'hide' : 'show'}
</span>
</td>
</tr>
</tbody>
</table>
)}

{data?.metadata && (
<table className="table-details">
<tbody>
<tr>
<td>Metadata</td>
<td>
<span className="link" onClick={() => setShowMetadata(!showMetadata)}>
{showMetadata ? 'hide' : 'show'}
</span>
</td>
</tr>
</tbody>
</table>
<div className={'slide ' + (showMetadata ? 'opened' : 'closed')}>
{showMetadata && codeHighlight(data.metadata)}
</div>

<table className="table-details">
<tbody>
<tr>
<td>Raw JSON</td>
<td>
<span className="link" onClick={() => setShowRaw(!showRaw)}>
{showRaw ? 'hide' : 'show'}
</span>
</td>
</tr>
</tbody>
</table>
<div className={'slide ' + (showRaw ? 'opened' : 'closed')}>{showRaw && codeHighlight(data)}</div>
</>
)}

<div className={'slide ' + (showMetadata ? 'opened' : 'closed')}>
{showMetadata && codeHighlight(data.metadata)}
</div>

<table className="table-details">
<tbody>
<tr>
<td>Raw JSON</td>
<td>
<span className="link" onClick={() => setShowRaw(!showRaw)}>
{showRaw ? 'hide' : 'show'}
</span>
</td>
</tr>
</tbody>
</table>
<div className={'slide ' + (showRaw ? 'opened' : 'closed')}>{showRaw && codeHighlight(data)}</div>
</div>
</>
)}
Expand Down