Skip to content

Commit

Permalink
fix issue with last and first txns:
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadhassoun366 committed Sep 19, 2024
1 parent 845d0d0 commit 786345a
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 64 deletions.
140 changes: 78 additions & 62 deletions src/app/(header-footer-layout)/address/[address]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,40 +204,48 @@ export default function AddressPage({ params }: AddressPageProps) {
LAST TXN SENT
</div>
<div className="flex gap-x-2">
<Link
href={`${ROUTES.transactions}/${txnHistoryData.firstLastTransactions.lastTransaction.txnHash}`}
className="text-medium dark:text-ablue-100 text-ablue-500 dark:hover:text-ablue-300 hover:text-ablue-200"
>
{shortenAddress(
txnHistoryData.firstLastTransactions.lastTransaction
.txnHash
)}
</Link>

<Tooltip
position="up"
trigger="click"
text="copied to clipboard"
>
<button
className="dark:text-ablue-100 text-ablue-500 dark:hover:text-ablue-300 hover:text-ablue-200"
onClick={() =>
copyToClipboard(
{txnHistoryData.firstLastTransactions.lastTransaction ? (
<>
<Link
href={`${ROUTES.transactions}/${txnHistoryData.firstLastTransactions.lastTransaction.txnHash}`}
className="text-medium dark:text-ablue-100 text-ablue-500 dark:hover:text-ablue-300 hover:text-ablue-200"
>
{shortenAddress(
txnHistoryData.firstLastTransactions
.lastTransaction.txnHash
)
}
>
<i className="far fa-clone "></i>
</button>
</Tooltip>
)}
</Link>

<Tooltip
position="up"
trigger="click"
text="copied to clipboard"
>
<button
className="dark:text-ablue-100 text-ablue-500 dark:hover:text-ablue-300 hover:text-ablue-200"
onClick={() =>
copyToClipboard(
txnHistoryData.firstLastTransactions
.lastTransaction?.txnHash || ''
)
}
>
<i className="far fa-clone "></i>
</button>
</Tooltip>

<div className="text-agrey-500 dark:text-agrey-600 text-sm font-medium">
{timeAgo(
txnHistoryData.firstLastTransactions.lastTransaction
.timeStamp
)}
</div>
<div className="text-agrey-500 dark:text-agrey-600 text-sm font-medium">
{timeAgo(
txnHistoryData.firstLastTransactions
.lastTransaction.timeStamp
)}
</div>
</>
) : (
<div className="dark:text-white text-black font-bold">
No transactions yet
</div>
)}
</div>
</div>

Expand All @@ -247,40 +255,48 @@ export default function AddressPage({ params }: AddressPageProps) {
FIRST TXN SENT
</span>
<div className="flex gap-x-2">
<Link
href={`${ROUTES.transactions}/${txnHistoryData.firstLastTransactions.firstTransaction.txnHash}`}
className="text-medium dark:text-ablue-100 text-ablue-500 dark:hover:text-ablue-300 hover:text-ablue-200"
>
{shortenAddress(
txnHistoryData.firstLastTransactions
.firstTransaction.txnHash
)}
</Link>

<Tooltip
position="up"
trigger="click"
text="copied to clipboard"
>
<button
className="dark:text-ablue-100 text-ablue-500 dark:hover:text-ablue-300 hover:text-ablue-200"
onClick={() =>
copyToClipboard(
{txnHistoryData.firstLastTransactions.firstTransaction ? (
<>
<Link
href={`${ROUTES.transactions}/${txnHistoryData.firstLastTransactions.firstTransaction.txnHash}`}
className="text-medium dark:text-ablue-100 text-ablue-500 dark:hover:text-ablue-300 hover:text-ablue-200"
>
{shortenAddress(
txnHistoryData.firstLastTransactions
.firstTransaction.txnHash
)
}
>
<i className="far fa-clone "></i>
</button>
</Tooltip>
)}
</Link>

<Tooltip
position="up"
trigger="click"
text="copied to clipboard"
>
<button
className="dark:text-ablue-100 text-ablue-500 dark:hover:text-ablue-300 hover:text-ablue-200"
onClick={() =>
copyToClipboard(
txnHistoryData.firstLastTransactions
.firstTransaction?.txnHash || ''
)
}
>
<i className="far fa-clone "></i>
</button>
</Tooltip>

<div className="text-agrey-500 dark:text-agrey-600 text-sm font-medium">
{timeAgo(
txnHistoryData.firstLastTransactions
.firstTransaction.timeStamp
)}
</div>
<div className="text-agrey-500 dark:text-agrey-600 text-sm font-medium">
{timeAgo(
txnHistoryData.firstLastTransactions
.firstTransaction.timeStamp
)}
</div>
</>
) : (
<div className="dark:text-white text-black font-bold">
No transactions yet
</div>
)}
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/shared/api/responses/addresss/txn-history.response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
// }
// },
type firstLastTransactions = {
lastTransaction: {
lastTransaction?: {
txnHash: string;
timeStamp: number;
block: number;
};
firstTransaction: {
firstTransaction?: {
txnHash: string;
timeStamp: number;
block: number;
Expand Down

0 comments on commit 786345a

Please sign in to comment.