Explorer: Display block utc timestamp in account history (#28248)

This commit is contained in:
Justin Starry 2022-10-06 14:04:04 +08:00 committed by GitHub
parent 435d4aded9
commit 40ebebe140
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 6 deletions

View File

@ -15,6 +15,7 @@ import {
import { FetchStatus } from "providers/cache";
import { LoadingCard } from "components/common/LoadingCard";
import { ErrorCard } from "components/common/ErrorCard";
import { displayTimestampUtc } from "utils/date";
export function TransactionHistoryCard({ pubkey }: { pubkey: PublicKey }) {
const address = pubkey.toBase58();
@ -56,7 +57,7 @@ export function TransactionHistoryCard({ pubkey }: { pubkey: PublicKey }) {
return (
<tr key={signature}>
<td>
<Signature signature={signature} link truncate />
<Signature signature={signature} link truncateChars={60} />
</td>
<td className="w-1">
@ -64,9 +65,16 @@ export function TransactionHistoryCard({ pubkey }: { pubkey: PublicKey }) {
</td>
{hasTimestamps && (
<td className="text-muted">
{blockTime ? <Moment date={blockTime * 1000} fromNow /> : "---"}
</td>
<>
<td className="text-muted">
{blockTime ? <Moment date={blockTime * 1000} fromNow /> : "---"}
</td>
<td className="text-muted">
{blockTime
? displayTimestampUtc(blockTime * 1000, true)
: "---"}
</td>
</>
)}
<td>
@ -90,8 +98,13 @@ export function TransactionHistoryCard({ pubkey }: { pubkey: PublicKey }) {
<thead>
<tr>
<th className="text-muted w-1">Transaction Signature</th>
<th className="text-muted w-1">Slot</th>
{hasTimestamps && <th className="text-muted w-1">Age</th>}
<th className="text-muted w-1">Block</th>
{hasTimestamps && (
<>
<th className="text-muted w-1">Age</th>
<th className="text-muted w-1">Timestamp</th>
</>
)}
<th className="text-muted">Result</th>
</tr>
</thead>