-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat: use account API v4 transactions #29536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 15 commits
1955f4b
3def3f0
e0230a0
8800a3c
327c92b
9ebaab5
0b8ffdd
4ff4a7e
f9b523f
f0e3bfa
fd05fb6
4897d39
d498edb
17a39f6
3ef4b58
643ac31
6596ada
0dac0e3
8b8ef87
ff4138f
7e9d3e0
2095c21
5dd9d93
a3e6592
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ import BadgeWrapper from '../../../component-library/components/Badges/BadgeWrap | |
| import Badge, { | ||
| BadgeVariant, | ||
| } from '../../../component-library/components/Badges/Badge'; | ||
| import { AvatarSize } from '../../../component-library/components/Avatars/Avatar'; | ||
| import { getNetworkImageSource } from '../../../util/networks'; | ||
| import Routes from '../../../constants/navigation/Routes'; | ||
| import { useAnalytics } from '../../hooks/useAnalytics/useAnalytics'; | ||
|
|
@@ -91,10 +92,13 @@ const MultichainTransactionListItem = ({ | |
|
|
||
| return ( | ||
| <BadgeWrapper | ||
| badgePosition={{ bottom: -4, right: -4 }} | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make it bottom right, aligns with most avatars and extension |
||
| badgeElement={ | ||
| <Badge | ||
| variant={BadgeVariant.Network} | ||
| imageSource={networkImageSource} | ||
| isScaled={false} | ||
| size={AvatarSize.Xs} | ||
| /> | ||
| } | ||
| > | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,6 +46,7 @@ import BadgeWrapper from '../../../component-library/components/Badges/BadgeWrap | |
| import Badge, { | ||
| BadgeVariant, | ||
| } from '../../../component-library/components/Badges/Badge'; | ||
| import { AvatarSize } from '../../../component-library/components/Avatars/Avatar'; | ||
| import { NetworkBadgeSource } from '../AssetOverview/Balance/Balance'; | ||
| import { | ||
| getFontFamily, | ||
|
|
@@ -98,6 +99,10 @@ const createStyles = (colors, typography) => | |
| width: 32, | ||
| height: 32, | ||
| }, | ||
| iconBadgePosition: { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. UI improvements: align network badge placement (bottom right) |
||
| bottom: -4, | ||
| right: -4, | ||
| }, | ||
| importText: { | ||
| color: colors.text.alternative, | ||
| fontSize: 14, | ||
|
|
@@ -264,13 +269,13 @@ class TransactionElement extends PureComponent { | |
| mounted = false; | ||
|
|
||
| componentDidMount = async () => { | ||
| this.mounted = true; | ||
| const [transactionElement, transactionDetails] = await decodeTransaction({ | ||
| ...this.props, | ||
| swapsTransactions: this.props.swapsTransactions, | ||
| assetSymbol: this.props.assetSymbol, | ||
| ticker: this.props.ticker, | ||
| }); | ||
| this.mounted = true; | ||
|
|
||
| this.mounted && this.setState({ transactionElement, transactionDetails }); | ||
| }; | ||
|
|
@@ -461,10 +466,13 @@ class TransactionElement extends PureComponent { | |
|
|
||
| return ( | ||
| <BadgeWrapper | ||
| badgePosition={styles.iconBadgePosition} | ||
| badgeElement={ | ||
| <Badge | ||
| variant={BadgeVariant.Network} | ||
| imageSource={NetworkBadgeSource(chainId)} | ||
| isScaled={false} | ||
| size={AvatarSize.Xs} | ||
| /> | ||
| } | ||
| > | ||
|
|
@@ -707,14 +715,43 @@ class TransactionElement extends PureComponent { | |
| ); | ||
| }; | ||
|
|
||
| renderPendingElement = () => { | ||
| const { i, tx } = this.props; | ||
| const { colors, typography } = this.context || mockTheme; | ||
| const styles = createStyles(colors, typography); | ||
|
|
||
| return ( | ||
| <ListItem> | ||
| <ListItem.Date style={styles.listItemDate}> | ||
| {this.renderTxTime()} | ||
| </ListItem.Date> | ||
| <ListItem.Content style={styles.listItemContent}> | ||
| <ListItem.Icon> | ||
| <View style={styles.icon} /> | ||
| </ListItem.Icon> | ||
| <ListItem.Body> | ||
| <ListItem.Title numberOfLines={1} style={styles.listItemTitle}> | ||
| ... | ||
| </ListItem.Title> | ||
| <StatusText | ||
| testID={`transaction-status-${i}`} | ||
| status={tx.status} | ||
| style={styles.listItemStatus} | ||
| /> | ||
| </ListItem.Body> | ||
| </ListItem.Content> | ||
| </ListItem> | ||
| ); | ||
| }; | ||
|
|
||
| render() { | ||
| const { tx, selectedInternalAccount } = this.props; | ||
| const { transactionElement, transactionDetails } = this.state; | ||
|
|
||
| const { colors, typography } = this.context || mockTheme; | ||
| const styles = createStyles(colors, typography); | ||
|
|
||
| if (!transactionElement || !transactionDetails) return null; | ||
| const isReady = Boolean(transactionElement && transactionDetails); | ||
|
|
||
| const accountImportTime = selectedInternalAccount?.metadata.importTime; | ||
| const { time } = tx; | ||
|
|
@@ -726,11 +763,13 @@ class TransactionElement extends PureComponent { | |
| style={ | ||
| this.props.showBottomBorder ? styles.rowWithBorder : styles.row | ||
| } | ||
| onPress={this.onPressItem} | ||
| onPress={isReady ? this.onPressItem : undefined} | ||
| underlayColor={colors.background.alternative} | ||
| activeOpacity={1} | ||
| > | ||
| {this.renderTxElement(transactionElement)} | ||
| {isReady | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. UI improvements: prefer a stable layout |
||
| ? this.renderTxElement(transactionElement) | ||
| : this.renderPendingElement()} | ||
| </TouchableHighlight> | ||
| {accountImportTime <= time && this.renderImportTime()} | ||
| </> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it bottom right, aligns with most avatars and extension