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
f2c6ba0
commit 08a8d44
Showing
10 changed files
with
650 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// @flow | ||
|
||
import type {Dispatch} from 'redux' | ||
|
||
import type {State} from '../state' |
119 changes: 119 additions & 0 deletions
119
src/components/WalletInit/RestoreWallet/UpgradeCheckModal.js
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 |
---|---|---|
@@ -0,0 +1,119 @@ | ||
// @flow | ||
|
||
import React from 'react' | ||
import {compose} from 'redux' | ||
import {withHandlers} from 'recompose' | ||
import {View, ScrollView, Image} from 'react-native' | ||
import {injectIntl, defineMessages, intlShape} from 'react-intl' | ||
import {withNavigation} from 'react-navigation' | ||
|
||
import type {Navigation} from '../../../types/navigation' | ||
import {Text, Button, Modal} from '../../UiKit' | ||
|
||
import styles from './styles/UpgradeCheckModal.style' | ||
import image from '../../../assets/img/mnemonic_explanation.png' | ||
|
||
import type {ComponentType} from 'react' | ||
|
||
const messages = defineMessages({ | ||
title: { | ||
id: 'components.walletinit.restorewallet.upgradecheckmodal.title', | ||
defaultMessage: '!!!Wallet upgrade', | ||
}, | ||
explanation: { | ||
id: 'components.walletinit.restorewallet.upgradecheckmodal.explanation', | ||
defaultMessage: | ||
'!!!If you had any ADA in your wallet on November 29th, 2019, you will' + | ||
'have to upgrade your wallet to a Shelley "reward wallet"', | ||
}, | ||
checkText: { | ||
id: 'components.walletinit.restorewallet.upgradecheckmodal.checkText', | ||
defaultMessage: '!!!Do you want to check if your wallet needs to be upgraded?', | ||
}, | ||
checkButton: { | ||
id: 'components.walletinit.restorewallet.upgradecheckmodal.checkButton', | ||
defaultMessage: '!!!Confirm', | ||
}, | ||
skipButton: { | ||
id: 'components.walletinit.restorewallet.upgradecheckmodal.skipButton', | ||
defaultMessage: '!!!Skip', | ||
}, | ||
}) | ||
|
||
type Props = { | ||
intl: any, | ||
visible: boolean, | ||
onCheck: () => any, | ||
onSkip: () => any, | ||
onRequestClose: () => any, | ||
} | ||
|
||
class UpgradeCheckModal extends React.Component<Props> { | ||
render() { | ||
const { | ||
intl, | ||
visible, | ||
onCheck, | ||
onSkip, | ||
onRequestClose, | ||
} = this.props | ||
|
||
return ( | ||
<Modal visible={visible} onRequestClose={onRequestClose} showCloseIcon> | ||
<ScrollView style={styles.scrollView}> | ||
<View style={styles.imageContainer}> | ||
<Image source={image} /> | ||
</View> | ||
<View style={styles.content}> | ||
<View style={styles.heading}> | ||
{ /* <Image source={imageSucess} /> */} | ||
<Text style={styles.title} small> | ||
{/* intl.formatMessage(messages.title) */} | ||
{messages.title.defaultMessage} | ||
</Text> | ||
</View> | ||
<View> | ||
<Text> | ||
{/* intl.formatMessage(messages.explanation) */} | ||
{messages.explanation.defaultMessage} | ||
</Text> | ||
<Text> | ||
{/* intl.formatMessage(messages.checkText) */} | ||
{messages.checkText.defaultMessage} | ||
</Text> | ||
</View> | ||
</View> | ||
<View style={styles.buttons}> | ||
<Button | ||
block | ||
outlineOnLight | ||
onPress={onSkip} | ||
// title={intl.formatMessage(messages.skipButton)} | ||
title={messages.skipButton.defaultMessage} | ||
style={styles.skipButton} | ||
/> | ||
|
||
<Button | ||
block | ||
onPress={onCheck} | ||
// title={intl.formatMessage(messages.checkButton)} | ||
title={messages.checkButton.defaultMessage} | ||
style={styles.checkButton} | ||
/> | ||
</View> | ||
</ScrollView> | ||
</Modal> | ||
) | ||
} | ||
} | ||
|
||
type ExternalProps = { | ||
intl: intlShape, | ||
navigation: Navigation, | ||
} | ||
|
||
export default injectIntl( | ||
(compose( | ||
withNavigation, | ||
)(UpgradeCheckModal): ComponentType<ExternalProps>), | ||
) |
203 changes: 203 additions & 0 deletions
203
src/components/WalletInit/RestoreWallet/UpgradeConfirmModal.js
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 |
---|---|---|
@@ -0,0 +1,203 @@ | ||
// @flow | ||
|
||
import React from 'react' | ||
import {compose} from 'redux' | ||
import {withHandlers} from 'recompose' | ||
import {View, TouchableOpacity, ScrollView, Image, Linking} from 'react-native' | ||
import {injectIntl, defineMessages, intlShape} from 'react-intl' | ||
import {withNavigation} from 'react-navigation' | ||
import {BigNumber} from 'bignumber.js' | ||
|
||
import type {Navigation} from '../../../types/navigation' | ||
import {Text, Button, Modal} from '../../UiKit' | ||
import {formatAdaWithText} from '../../../utils/format' | ||
import {confirmationMessages} from '../../../i18n/global-messages' | ||
import {CARDANO_CONFIG} from '../../../config' | ||
|
||
import styles from './styles/UpgradeCheckModal.style' | ||
import imageEmpty from '../../../assets/img/no_transactions_yet.inline.png' | ||
import imageSucess from '../../../assets/img/transfer-success.inline.png' | ||
|
||
import type {ComponentType} from 'react' | ||
|
||
const messages = defineMessages({ | ||
title: { | ||
id: 'components.walletinit.restorewallet.upgradeconfirmmodal.title', | ||
defaultMessage: '!!!Wallet upgrade', | ||
}, | ||
noUpgradeLabel: { | ||
id: 'components.walletinit.restorewallet.upgradeconfirmmodal.noUpgradeLabel', | ||
defaultMessage: '!!!All done!', | ||
}, | ||
noUpgradeMessage: { | ||
id: 'components.walletinit.restorewallet.upgradeconfirmmodal.noUpgradeMessage', | ||
defaultMessage: '!!!Your wallet did not need to be upgraded', | ||
}, | ||
fromLabel: { | ||
id: 'components.walletinit.restorewallet.upgradeconfirmmodal.fromLabel', | ||
defaultMessage: '!!!From:', | ||
}, | ||
toLabel: { | ||
id: 'components.walletinit.restorewallet.upgradeconfirmmodal.toLabel', | ||
defaultMessage: '!!!To:', | ||
}, | ||
balanceLabel: { | ||
id: 'components.walletinit.restorewallet.upgradeconfirmmodal.balanceLabel', | ||
defaultMessage: '!!!Recovered balance', | ||
}, | ||
finalBalanceLabel: { | ||
id: 'components.walletinit.restorewallet.upgradeconfirmmodal.finalBalanceLabel', | ||
defaultMessage: '!!!Final balance', | ||
}, | ||
feesLabel: { | ||
id: 'components.walletinit.restorewallet.upgradeconfirmmodal.feesLabel', | ||
defaultMessage: '!!!Fees', | ||
}, | ||
}) | ||
|
||
const AddressEntry = withHandlers({ | ||
onPress: ({address}) => () => { | ||
Linking.openURL(CARDANO_CONFIG.SHELLEY.EXPLORER_URL_FOR_ADDRESS(address)) | ||
}, | ||
})(({address, onPress}) => { | ||
return ( | ||
<TouchableOpacity activeOpacity={0.5} onPress={onPress}> | ||
<Text secondary>{address}</Text> | ||
</TouchableOpacity> | ||
) | ||
}) | ||
|
||
type Props = { | ||
intl: any, | ||
visible: boolean, | ||
byronAddresses: Array<string>, | ||
shelleyAddress: string, | ||
balance: BigNumber, | ||
finalBalance: BigNumber, | ||
fees: BigNumber, | ||
onCancel: () => any, | ||
onConfirm: () => any, | ||
onContinue: () => any, | ||
onRequestClose: () => any, | ||
} | ||
|
||
class UpgradeConfirmModal extends React.Component<Props> { | ||
render() { | ||
const { | ||
intl, | ||
visible, | ||
byronAddresses, | ||
shelleyAddress, | ||
balance, | ||
finalBalance, | ||
fees, | ||
onCancel, | ||
onConfirm, | ||
onContinue, | ||
onRequestClose, | ||
} = this.props | ||
|
||
if (byronAddresses.length > 0) { | ||
return ( | ||
<Modal visible={visible} onRequestClose={onRequestClose} showCloseIcon> | ||
<ScrollView style={styles.scrollView}> | ||
<View style={styles.content}> | ||
<View style={styles.heading}> | ||
<Image source={imageSucess} /> | ||
<Text style={styles.title} small> | ||
{intl.formatMessage(messages.title)} | ||
</Text> | ||
</View> | ||
<View style={styles.item}> | ||
<Text style={styles.label} small> | ||
{intl.formatMessage(messages.balanceLabel)} | ||
</Text> | ||
<Text style={styles.balanceAmount}> | ||
{balance && formatAdaWithText(balance)} | ||
</Text> | ||
</View> | ||
<View style={styles.item}> | ||
<Text style={styles.label} small> | ||
{intl.formatMessage(messages.feesLabel)} | ||
</Text> | ||
<Text style={styles.balanceAmount}> | ||
{balance && formatAdaWithText(fees)} | ||
</Text> | ||
</View> | ||
<View style={styles.item}> | ||
<Text style={styles.label} small> | ||
{intl.formatMessage(messages.finalBalanceLabel)} | ||
</Text> | ||
<Text style={styles.balanceAmount}> | ||
{balance && formatAdaWithText(finalBalance)} | ||
</Text> | ||
</View> | ||
<View style={styles.item}> | ||
<Text style={styles.label} small> | ||
{intl.formatMessage(messages.fromLabel)} | ||
</Text> | ||
{byronAddresses.map((address, i) => ( | ||
<AddressEntry key={i} address={address} /> | ||
))} | ||
</View> | ||
<View style={styles.item}> | ||
<Text style={styles.label} small> | ||
{intl.formatMessage(messages.toLabel)} | ||
</Text> | ||
<AddressEntry address={shelleyAddress} /> | ||
</View> | ||
</View> | ||
<View style={styles.buttons}> | ||
<Button | ||
block | ||
outlineOnLight | ||
onPress={onCancel} | ||
// title={intl.formatMessage(confirmationMessages.commonButtons.cancelButton.defaultMessage)} | ||
title={confirmationMessages.commonButtons.cancelButton.defaultMessage} | ||
style={styles.skipButton} | ||
/> | ||
|
||
<Button | ||
block | ||
onPress={onConfirm} | ||
// title={intl.formatMessage(confirmationMessages.commonButtons.confirmButton)} | ||
title={confirmationMessages.commonButtons.confirmButton.defaultMessage} | ||
style={styles.checkButton} | ||
/> | ||
</View> | ||
</ScrollView> | ||
</Modal> | ||
) | ||
} else { | ||
return ( | ||
<Modal visible={visible} onRequestClose={onRequestClose} showCloseIcon> | ||
<ScrollView style={styles.scrollView}> | ||
<View style={[styles.content, styles.empty]}> | ||
<Image source={imageEmpty} /> | ||
<Text>{intl.formatMessage(messages.recoveryEmptyMessage)}</Text> | ||
</View> | ||
<Button | ||
onPress={onContinue} | ||
title={intl.formatMessage(messages.recoveryEmptyButtonText)} | ||
shelleyTheme | ||
/> | ||
</ScrollView> | ||
</Modal> | ||
) | ||
} | ||
} | ||
} | ||
|
||
type ExternalProps = { | ||
intl: intlShape, | ||
navigation: Navigation, | ||
} | ||
|
||
export default injectIntl( | ||
(compose( | ||
withNavigation, | ||
withHandlers({ | ||
buttonHandler: ({navigation}) => (event) => navigation.popToTop(), | ||
}), | ||
)(UpgradeConfirmModal): ComponentType<ExternalProps>), | ||
) |
Oops, something went wrong.