Skip to content

Commit 95c89d9

Browse files
Add transactions in AccountView component
1 parent 2d2048c commit 95c89d9

File tree

1 file changed

+34
-9
lines changed

1 file changed

+34
-9
lines changed

src/components/ConnectWalletModal/AccountView.tsx

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import React from 'react'
22
import { Box, Typography, Button } from '@mui/material'
3+
import Transaction from '../Transaction'
34
import { SportsVolleyball, MultilineChart } from '@mui/icons-material'
5+
import { Transaction as TransactionI } from '../../types'
46

57

68
const AccountButton = (props: { title: string, onClick: () => void }) => {
@@ -27,6 +29,8 @@ const AccountButton = (props: { title: string, onClick: () => void }) => {
2729

2830
interface AccountViewProps {
2931
address: string
32+
transactions: TransactionI[]
33+
onTransactionClick: (transaction: TransactionI) => void
3034
onDisconnect: () => void
3135
onChange: () => void
3236
}
@@ -100,15 +104,36 @@ export default function AccountView (props: AccountViewProps) {
100104
</Box>
101105
</Box>
102106
<Box mt='15px' />
103-
<Box
104-
component='div'
105-
bgcolor='#2C2F36'
106-
padding='20px'
107-
>
108-
<Typography fontSize={16}>
109-
Your transactions will appear here...
110-
</Typography>
111-
</Box>
107+
{ props.transactions.length > 0 ? (
108+
<Box
109+
component='div'
110+
paddingX='20px'
111+
paddingBottom='20px'
112+
>
113+
{ props.transactions.map(transaction => (
114+
<Transaction
115+
key={transaction.hash}
116+
sellTokenSymbol={transaction.sellTokenSymbol}
117+
sellTokenThumbnail={transaction.sellTokenThumbnail}
118+
sellAmount={transaction.sellAmount}
119+
buyTokenSymbol={transaction.buyTokenSymbol}
120+
buyTokenThumbnail={transaction.buyTokenThumbnail}
121+
buyAmount={transaction.buyAmount}
122+
status={transaction.status}
123+
onClick={() => props.onTransactionClick(transaction)} />
124+
))}
125+
</Box>
126+
): (
127+
<Box
128+
component='div'
129+
bgcolor='#2C2F36'
130+
padding='20px'
131+
>
132+
<Typography fontSize={16}>
133+
Your transactions will appear here...
134+
</Typography>
135+
</Box>
136+
)}
112137
</React.Fragment>
113138
)
114139
}

0 commit comments

Comments
 (0)