Skip to content
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

Complete redesigns for approval flow #1558

Merged
merged 49 commits into from
Jun 24, 2020
Merged
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
2c65685
Confirm: Use TransactionReviewFeeCard, add primaryCurrency prop, add …
EtDu Apr 27, 2020
e46edf7
CustomGas: Implement redesign. Still need to modify styling of indivi…
EtDu Apr 29, 2020
2ff43b1
snapshot update
EtDu Apr 29, 2020
0fb266b
Approve: Use Modal in place of Action Modal, use updated CustomGas
EtDu Apr 29, 2020
54fb44e
Confirm: fix, change props.transactionState to state.transaction (mer…
EtDu May 14, 2020
be6b914
snapshot update
EtDu May 14, 2020
a5816d3
Approve: add in ActionModal styles, use ActionModal
EtDu May 28, 2020
9f742c0
Use ActionModal
rickycodes Jun 1, 2020
46b78c9
Remove transaction direction
rickycodes Jun 1, 2020
65e138c
Add onRequestClose
rickycodes Jun 1, 2020
f2aecf6
Add host and network under website icon
rickycodes May 7, 2020
29b7209
Use TransactionHeader component
rickycodes May 8, 2020
b07722e
Use AccountInfoCard
rickycodes May 9, 2020
36ca846
Add black to text in AccountInfoCard
rickycodes May 9, 2020
6dda43c
Remove up/down arrow icon
rickycodes May 11, 2020
d1748bb
Update: styles
rickycodes Jun 1, 2020
1346d74
Update networkFee
rickycodes Jun 1, 2020
19c920b
Update: translation text
rickycodes Jun 1, 2020
7854403
Update: sync up with PR and update translations
rickycodes Jun 1, 2020
66616d9
Add TransactionReivewDetailsCard
rickycodes Jun 1, 2020
6d292b4
Include getMethodData
rickycodes Jun 1, 2020
c470d1f
Rename onViewDetails -> toggleViewDetails
rickycodes Jun 1, 2020
db01560
Adjust styles
rickycodes Jun 1, 2020
ef2a15a
Remove commented code
rickycodes Jun 1, 2020
3fa0950
Update: tests
rickycodes Jun 2, 2020
c0c005a
Update: TransactionReviewDetailsCard styles
rickycodes Jun 2, 2020
996ed37
Update: Move customGas and editPermission out from Modals
rickycodes Jun 2, 2020
1a4cdcd
Update: remove now redundant infos
rickycodes Jun 2, 2020
8f8b17b
Remove comments
rickycodes Jun 3, 2020
ccbcdd0
Remove padding
rickycodes Jun 3, 2020
82c09ad
Fix eslint issues
rickycodes Jun 16, 2020
de2f91d
Adjust location of KeyboardAwareScrollView for renderEditPermission
rickycodes Jun 17, 2020
02249fb
Update: Create translation for "Total"
rickycodes Jun 18, 2020
289d3ac
Update: secureIcon
rickycodes Jun 18, 2020
50cea90
Update: remove padding
rickycodes Jun 18, 2020
a108bf5
Update: Add ConnectHeader component
rickycodes Jun 18, 2020
82be11f
Update: Make ConnectHeader props isRequired
rickycodes Jun 18, 2020
d6cbb07
Update: move view into RenderCustomGas method
rickycodes Jun 22, 2020
bfd208c
Add activeTabUrl so we get https and secure icon
rickycodes Jun 22, 2020
42e22bc
Update: display network fee in fiat when selected
rickycodes Jun 23, 2020
2dd208a
Update: Add save button to network fee
rickycodes Jun 23, 2020
e93a106
Update: Add Set button for editPermission
rickycodes Jun 23, 2020
d572a69
Update: tests
rickycodes Jun 23, 2020
2cbe738
Fix hitTest issue with network fee
rickycodes Jun 17, 2020
1ae9b6c
Fix transition when opening network fee
rickycodes Jun 18, 2020
3f204ee
Update: Display currencySymbol
rickycodes Jun 23, 2020
818a82d
Update: round fiat price to two decimals
rickycodes Jun 23, 2020
8ff0d93
Update: fallback to just to be safe
rickycodes Jun 24, 2020
5ea88c7
Update: Add getActiveTabUrl method
rickycodes Jun 24, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ exports[`AccountInfoCard should render correctly 1`] = `
numberOfLines={1}
style={
Object {
"color": "#000000",
"fontFamily": "CircularStd-Medium",
"fontSize": 16,
"fontWeight": "600",
Expand All @@ -59,6 +60,7 @@ exports[`AccountInfoCard should render correctly 1`] = `
numberOfLines={1}
style={
Object {
"color": "#000000",
"flexGrow": 1,
"fontFamily": "CircularStd-Medium",
"fontSize": 16,
Expand All @@ -76,6 +78,7 @@ exports[`AccountInfoCard should render correctly 1`] = `
style={
Object {
"alignSelf": "flex-start",
"color": "#000000",
"fontFamily": "CircularStd-Medium",
"fontSize": 14,
"fontWeight": "100",
Expand Down
9 changes: 6 additions & 3 deletions app/components/UI/AccountInfoCard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,20 @@ const styles = StyleSheet.create({
maxWidth: Device.isMediumDevice() ? '35%' : '45%',
...fontStyles.bold,
fontSize: 16,
marginRight: 2
marginRight: 2,
color: colors.black
},
accountAddress: {
flexGrow: 1,
...fontStyles.bold,
fontSize: 16
fontSize: 16,
color: colors.black
},
balanceText: {
...fontStyles.thin,
fontSize: 14,
alignSelf: 'flex-start'
alignSelf: 'flex-start',
color: colors.black
}
});

Expand Down
47 changes: 47 additions & 0 deletions app/components/UI/ConnectHeader/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import React, { Component } from 'react';
import { View, StyleSheet, Text, TouchableOpacity } from 'react-native';
import PropTypes from 'prop-types';
import IonicIcon from 'react-native-vector-icons/Ionicons';
import { colors, fontStyles } from '../../../styles/common';

const styles = StyleSheet.create({
header: {
width: '100%',
position: 'relative',
paddingBottom: 20
},
title: {
...fontStyles.bold,
color: colors.black,
fontSize: 14,
textAlign: 'center',
paddingVertical: 12
},
back: {
position: 'absolute',
zIndex: 1,
paddingVertical: 10,
paddingRight: 10
}
});

class ConnectHeader extends Component {
static propTypes = {
action: PropTypes.func.isRequired,
title: PropTypes.string.isRequired
};

render() {
const { title, action } = this.props;
return (
<View style={styles.header}>
<TouchableOpacity style={styles.back} onPress={action}>
<IonicIcon name={'ios-arrow-back'} size={24} color={colors.black} />
</TouchableOpacity>
<Text style={styles.title}>{title}</Text>
</View>
);
}
}

export default ConnectHeader;
13 changes: 7 additions & 6 deletions app/components/UI/TransactionHeader/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,13 @@ class TransactionHeader extends PureComponent {
*/
renderSecureIcon = () => {
const { url } = this.props.currentPageInformation;
const secureIcon =
getUrlObj(url).protocol === 'https:' ? (
<FontAwesome name={'lock'} size={15} style={styles.secureIcon} />
) : (
<FontAwesome name={'warning'} size={15} style={styles.secureIcon} />
);
const secureIcon = (
<FontAwesome
name={getUrlObj(url).protocol === 'https:' ? 'lock' : 'warning'}
size={15}
style={styles.secureIcon}
/>
);
return secureIcon;
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
import React, { Component } from 'react';

import { StyleSheet, Text, View, TouchableOpacity } from 'react-native';
import { colors, fontStyles } from '../../../../styles/common';
import PropTypes from 'prop-types';
import IonicIcon from 'react-native-vector-icons/Ionicons';
import { strings } from '../../../../../locales/i18n';
import Feather from 'react-native-vector-icons/Feather';
import ConnectHeader from '../../../UI/ConnectHeader';

const styles = StyleSheet.create({
uppercase: {
textTransform: 'capitalize'
},
viewData: {
borderWidth: 1,
borderColor: colors.grey200,
borderRadius: 10,
padding: 16,
marginTop: 20
},
viewDataRow: {
display: 'flex',
flexDirection: 'row',
flexWrap: 'wrap'
},
viewDataTitle: {
...fontStyles.bold,
color: colors.black,
fontSize: 14
},
viewDataText: {
marginTop: 20
},
viewDataArrow: {
marginLeft: 'auto'
},
transactionDetails: {
borderWidth: 1,
borderColor: colors.grey200,
borderRadius: 10,
padding: 16
},
transactionDetailsRow: {
display: 'flex',
flexDirection: 'row',
flexWrap: 'wrap',
paddingVertical: 4
},
transactionDetailsTextLeft: {
...fontStyles.thin,
color: colors.black,
fontSize: 14
},
transactionDetailsTextRight: {
...fontStyles.bold,
color: colors.black,
fontSize: 14,
textAlign: 'right',
flexDirection: 'row',
marginLeft: 'auto'
},
section: {
minWidth: '100%',
width: '100%'
},
copyIcon: {
marginLeft: 1,
marginTop: 2
},
address: {
...fontStyles.bold,
color: colors.blue
}
});

export default class TransactionReviewDetailsCard extends Component {
static propTypes = {
toggleViewDetails: PropTypes.func,
copyContractAddress: PropTypes.func,
toggleViewData: PropTypes.func,
address: PropTypes.string,
host: PropTypes.string,
allowance: PropTypes.string,
tokenSymbol: PropTypes.string,
data: PropTypes.string,
displayViewData: PropTypes.bool,
method: PropTypes.string
};

render() {
const {
toggleViewDetails,
toggleViewData,
copyContractAddress,
address,
host,
allowance,
tokenSymbol,
data,
method,
displayViewData
} = this.props;

return (
<>
<View style={styles.section}>
<ConnectHeader
action={toggleViewDetails}
title={strings('spend_limit_edition.transaction_details')}
/>
<View style={styles.transactionDetails}>
<View style={styles.transactionDetailsRow}>
<Text style={styles.transactionDetailsTextLeft}>
{strings('spend_limit_edition.site_url')}
</Text>
<Text style={styles.transactionDetailsTextRight}>{host}</Text>
</View>
<View style={styles.transactionDetailsRow}>
<Text style={styles.transactionDetailsTextLeft}>
{strings('spend_limit_edition.contract_address')}
</Text>
<View style={styles.transactionDetailsTextRight}>
<Text style={styles.address}>{address}</Text>
<Feather
name="copy"
size={16}
color={colors.blue}
style={styles.copyIcon}
onPress={copyContractAddress}
/>
</View>
</View>
<View style={styles.transactionDetailsRow}>
<Text style={styles.transactionDetailsTextLeft}>
{strings('spend_limit_edition.allowance')}
</Text>
<Text style={styles.transactionDetailsTextRight}>
{allowance} {tokenSymbol}
</Text>
</View>
</View>
<View style={styles.viewData}>
<TouchableOpacity style={styles.viewDataRow} onPress={toggleViewData}>
<Text style={styles.viewDataTitle}>{strings('spend_limit_edition.view_data')}</Text>
<View style={styles.viewDataArrow}>
<IonicIcon
name={`ios-arrow-${displayViewData ? 'up' : 'down'}`}
size={16}
color={colors.grey500}
/>
</View>
</TouchableOpacity>
{displayViewData ? (
<>
<Text style={[styles.viewDataText, styles.uppercase]}>
{strings('spend_limit_edition.function')}: {method}
</Text>
<Text style={styles.viewDataText}>{data}</Text>
</>
) : null}
</View>
</View>
</>
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@ exports[`Approve should render correctly 1`] = `
}
}
accountsLength={1}
contractBalances={
Object {
"0x2": "0",
}
}
activeTabUrl="https://metamask.github.io/test-dapp/"
conversionRate={100}
currentCurrency="USD"
identities={
Expand All @@ -24,6 +20,7 @@ exports[`Approve should render correctly 1`] = `
},
}
}
primaryCurrency="Fiat"
setTransactionObject={[Function]}
showAlert={[Function]}
ticker="ETH"
Expand Down
Loading