-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f374f99
commit 2d59104
Showing
5 changed files
with
89 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,42 @@ | ||
import React, { useState, useEffect, use } from 'react'; | ||
// import { getOnRampTransactions } from '../transfer/page'; | ||
import TransactionCard from '../../../components/TransactionCard'; | ||
import { getOnRampTransactions } from '../../lib/actions/serverAction'; | ||
|
||
const TransactionPage = async () => { | ||
// const transactions = await getOnRampTransactions(); | ||
export default async function() { | ||
const transactions = await getOnRampTransactions(); | ||
|
||
return ( | ||
<div className="container mx-auto px-4 py-8"> | ||
<h2 className="text-3xl font-semibold mb-6">Transaction History</h2> | ||
{/* <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"> | ||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6"> | ||
{transactions.map(transaction => ( | ||
<div key={transaction.token} className="relative"> | ||
<div className={`rounded-lg shadow-md p-6 ${getTransactionColor(transaction.status)}`}> | ||
<h3 className="text-lg font-semibold mb-2">{transaction.date}</h3> | ||
<h3 className="text-lg font-semibold mb-2">Date: {getTimeinUTC(transaction.time)}</h3> | ||
<p className="text-gray-600 mb-4">Status: {transaction.status}</p> | ||
<p className="text-gray-600 mb-4">Provider: {transaction.provider}</p> | ||
<p className="text-gray-600 mb-4">Amount: {transaction.amount}</p> | ||
</div> | ||
</div> | ||
))} | ||
</div> */} | ||
</div> | ||
|
||
</div> | ||
); | ||
}; | ||
|
||
const getTimeinUTC = (time: Date) =>{ | ||
return time.toUTCString(); | ||
} | ||
// Function to get appropriate background color based on transaction status | ||
const getTransactionColor = (status: any) => { | ||
switch (status) { | ||
case 'success': | ||
case 'Success': | ||
return 'bg-green-50'; // Greenish background for successful transactions | ||
case 'failed': | ||
case 'Failed': | ||
return 'bg-red-50'; // Reddish background for failed transactions | ||
case 'pending': | ||
case 'Processing': | ||
return 'bg-yellow-50'; // Yellowish background for pending transactions | ||
default: | ||
return 'bg-white'; // Default background color | ||
} | ||
}; | ||
|
||
export default TransactionPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters