aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/wallet-view.js
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2018-03-07 08:15:45 +0800
committerDan <danjm.com@gmail.com>2018-03-07 08:15:45 +0800
commit9d215bab0fe124f036d2ac41f375331c8d43b72b (patch)
tree6bbbdb2e6a2dcd5948ee8473cad152232c73643b /ui/app/components/wallet-view.js
parentf06bca1151b07d908cd90f6efd97064e288e5f27 (diff)
parent9762a730413129361062804aa8dfc7be7cf74868 (diff)
downloadtangerine-wallet-browser-9d215bab0fe124f036d2ac41f375331c8d43b72b.tar
tangerine-wallet-browser-9d215bab0fe124f036d2ac41f375331c8d43b72b.tar.gz
tangerine-wallet-browser-9d215bab0fe124f036d2ac41f375331c8d43b72b.tar.bz2
tangerine-wallet-browser-9d215bab0fe124f036d2ac41f375331c8d43b72b.tar.lz
tangerine-wallet-browser-9d215bab0fe124f036d2ac41f375331c8d43b72b.tar.xz
tangerine-wallet-browser-9d215bab0fe124f036d2ac41f375331c8d43b72b.tar.zst
tangerine-wallet-browser-9d215bab0fe124f036d2ac41f375331c8d43b72b.zip
Merge branch 'master' into i18n
Diffstat (limited to 'ui/app/components/wallet-view.js')
-rw-r--r--ui/app/components/wallet-view.js36
1 files changed, 26 insertions, 10 deletions
diff --git a/ui/app/components/wallet-view.js b/ui/app/components/wallet-view.js
index 6bd2d0963..18452205c 100644
--- a/ui/app/components/wallet-view.js
+++ b/ui/app/components/wallet-view.js
@@ -2,8 +2,10 @@ const Component = require('react').Component
const connect = require('react-redux').connect
const h = require('react-hyperscript')
const inherits = require('util').inherits
+const classnames = require('classnames')
const Identicon = require('./identicon')
// const AccountDropdowns = require('./dropdowns/index.js').AccountDropdowns
+const Tooltip = require('./tooltip-v2.js')
const copyToClipboard = require('copy-to-clipboard')
const actions = require('../actions')
const BalanceComponent = require('./balance-component')
@@ -46,6 +48,7 @@ function WalletView () {
Component.call(this)
this.state = {
hasCopied: false,
+ copyToClipboardPressed: false,
}
}
@@ -135,17 +138,30 @@ WalletView.prototype.render = function () {
]),
]),
-
- h('div.wallet-view__address', {
- onClick: () => {
- copyToClipboard(selectedAddress)
- this.setState({ hasCopied: true })
- setTimeout(() => this.setState({ hasCopied: false }), 3000)
- },
+ h(Tooltip, {
+ position: 'bottom',
+ title: this.state.hasCopied ? t('copiedExclamation') : t('copyToClipboard'),
+ wrapperClassName: 'wallet-view__tooltip',
}, [
- this.state.hasCopied && t('copiedClipboard'),
- !this.state.hasCopied && `${selectedAddress.slice(0, 4)}...${selectedAddress.slice(-4)}`,
- h('i.fa.fa-clipboard', { style: { marginLeft: '8px' } }),
+ h('button.wallet-view__address', {
+ className: classnames({
+ 'wallet-view__address__pressed': this.state.copyToClipboardPressed,
+ }),
+ onClick: () => {
+ copyToClipboard(selectedAddress)
+ this.setState({ hasCopied: true })
+ setTimeout(() => this.setState({ hasCopied: false }), 3000)
+ },
+ onMouseDown: () => {
+ this.setState({ copyToClipboardPressed: true })
+ },
+ onMouseUp: () => {
+ this.setState({ copyToClipboardPressed: false })
+ },
+ }, [
+ `${selectedAddress.slice(0, 4)}...${selectedAddress.slice(-4)}`,
+ h('i.fa.fa-clipboard', { style: { marginLeft: '8px' } }),
+ ]),
]),
this.renderWalletBalance(),