1
1
import React from 'react'
2
2
import { Box , Typography , Button } from '@mui/material'
3
+ import Transaction from '../Transaction'
3
4
import { SportsVolleyball , MultilineChart } from '@mui/icons-material'
5
+ import { Transaction as TransactionI } from '../../types'
4
6
5
7
6
8
const AccountButton = ( props : { title : string , onClick : ( ) => void } ) => {
@@ -27,6 +29,8 @@ const AccountButton = (props: { title: string, onClick: () => void }) => {
27
29
28
30
interface AccountViewProps {
29
31
address : string
32
+ transactions : TransactionI [ ]
33
+ onTransactionClick : ( transaction : TransactionI ) => void
30
34
onDisconnect : ( ) => void
31
35
onChange : ( ) => void
32
36
}
@@ -100,15 +104,36 @@ export default function AccountView (props: AccountViewProps) {
100
104
</ Box >
101
105
</ Box >
102
106
< 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
+ ) }
112
137
</ React . Fragment >
113
138
)
114
139
}
0 commit comments