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

add and format from address with link #404

Merged
merged 1 commit into from
Dec 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 5 additions & 2 deletions app/components/Modals/ReceiveModal/ReceiveModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,20 @@ import BaseModal from '../BaseModal'
import styles from './ReceiveModal.scss'
import QRCode from 'qrcode/lib/browser'
import CopyToClipboard from '../../CopyToClipboard'
import { openExplorerAddress } from '../../../core/explorer'

type Props = {
address: string,
hideModal: Function,
net: NetworkType,
explorer: ExplorerType,
}

class ReceiveModal extends Component<Props> {
canvas: ?HTMLCanvasElement

render () {
const { hideModal, address } = this.props
const { hideModal, address, net, explorer } = this.props
return (
<BaseModal
onAfterOpen={() => {
Expand All @@ -34,7 +37,7 @@ class ReceiveModal extends Component<Props> {
<div className={styles.textContainer}>
<div>Your Public NEO Address:</div>
<div className={styles.address}>
<strong>{address}</strong>
<strong><div className={styles.externalLink} onClick={() => openExplorerAddress(net, explorer, address)}>{address}</div></strong>
<CopyToClipboard text={address} tooltip='Copy Public Address' />
</div>
<div className={styles.canvas}><canvas ref={(node) => { this.canvas = node }} /></div>
Expand Down
10 changes: 10 additions & 0 deletions app/components/Modals/ReceiveModal/ReceiveModal.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import '../../../styles/variables';

.textContainer {
padding: 20px 0;
}
Expand All @@ -6,3 +8,11 @@
margin: 10px 0;
text-align: center;
}

.externalLink {
color: $link-color;
margin-top: 20px;
margin-bottom: 20px;
cursor: pointer;
display: inline-block;
}
10 changes: 7 additions & 3 deletions app/components/Modals/SendModal/ConfirmDisplay.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type Props = {
cancelTransaction: Function,
explorer: ExplorerType,
net: NetworkType,
address: string,
}

type State = {
Expand All @@ -38,7 +39,7 @@ class ConfirmDisplay extends React.Component<Props, State> {
if (err) {
message = 'Warning: there was an error verifying the recipient address has activity in its transaction history.'
} else if (!transactions || !transactions.length) {
message = 'Warning: recipient address has no activity in its transaction history. Please be sure the address is correct before sending.'
message = 'Warning: recipient address has no activity in its transaction history. Please be sure the address is correct before sending. Note that empty addresses will not appear in blockchain explorers. If it is a new address, please double check that you input the correct address.'
}

this.setState({
Expand All @@ -53,7 +54,7 @@ class ConfirmDisplay extends React.Component<Props, State> {
}

render () {
const { sendAddress, sendAmount, symbol, confirmTransaction, cancelTransaction, explorer, net } = this.props
const { sendAddress, sendAmount, symbol, confirmTransaction, cancelTransaction, explorer, net, address } = this.props
const { addressChecked, addressCheckedMessage } = this.state

if (!addressChecked) {
Expand All @@ -62,7 +63,10 @@ class ConfirmDisplay extends React.Component<Props, State> {
return (
<div>
<p>Please confirm the following transaction:</p>
<p>You are sending <strong>{formatBalance(symbol, sendAmount)} {symbol}</strong> to:</p>
<p>You are sending <strong>{formatBalance(symbol, sendAmount)} {symbol}</strong></p>
<p>from:</p>
<div className={styles.externalLink} onClick={() => openExplorerAddress(net, explorer, address)}>{address}</div>
<p>to:</p>
<div className={styles.externalLink} onClick={() => openExplorerAddress(net, explorer, sendAddress)}>{sendAddress}</div>
<div>
<Button onClick={confirmTransaction}>Confirm</Button>
Expand Down
4 changes: 3 additions & 1 deletion app/components/Modals/SendModal/SendModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ type Props = {
sendTransaction: Function,
explorer: ExplorerType,
net: NetworkType,
address: string,
}

type State = {
Expand Down Expand Up @@ -95,7 +96,7 @@ class SendModal extends Component<Props, State> {
}

render () {
const { hideModal, tokens, explorer, net } = this.props
const { hideModal, tokens, explorer, net, address } = this.props
const { display } = this.state

return (
Expand All @@ -122,6 +123,7 @@ class SendModal extends Component<Props, State> {
cancelTransaction={this.cancelTransaction}
explorer={explorer}
net={net}
address={address}
{...this.state}
/>}
</BaseModal>
Expand Down
4 changes: 2 additions & 2 deletions app/containers/Dashboard/Dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ export default class Dashboard extends Component<Props> {
<div className={styles.walletButtons}>
<div
className={classNames(styles.walletButton, styles.sendButton)}
onClick={() => showModal(MODAL_TYPES.SEND, { NEO, GAS, tokens, showErrorNotification, sendTransaction, explorer, net })}>
onClick={() => showModal(MODAL_TYPES.SEND, { NEO, GAS, tokens, showErrorNotification, sendTransaction, explorer, net, address })}>
<FaArrowUpward className={styles.walletButtonIcon} /><span className={styles.walletButtonText}>Send</span>
</div>
<div
className={styles.walletButton}
onClick={() => showModal(MODAL_TYPES.RECEIVE, { address })}>
onClick={() => showModal(MODAL_TYPES.RECEIVE, { address, net, explorer })}>
<FaArrowDownward className={styles.walletButtonIcon} /><span className={styles.walletButtonText}>Receive</span>
</div>
</div>
Expand Down