diff --git a/__tests__/components/transaction-item.test.js b/__tests__/components/transaction-item.test.js index c4e2c89..44ff1ed 100644 --- a/__tests__/components/transaction-item.test.js +++ b/__tests__/components/transaction-item.test.js @@ -21,6 +21,7 @@ describe('', () => { amount={0.8652} date={new Date().toISOString()} zecPrice={2.94} + fees={0.0001} /> , ); diff --git a/__tests__/components/transactions-daily.test.js b/__tests__/components/transactions-daily.test.js index b33d973..44f768f 100644 --- a/__tests__/components/transactions-daily.test.js +++ b/__tests__/components/transactions-daily.test.js @@ -27,6 +27,7 @@ describe('', () => { zecPrice: 1.345, date: new Date().toISOString(), theme: appTheme, + fees: 0.001, }, { type: 'send', @@ -36,6 +37,7 @@ describe('', () => { zecPrice: 1.344, date: new Date().toISOString(), theme: appTheme, + fees: 0.001, }, ]} /> diff --git a/app/app.js b/app/app.js index 334b5b8..f7b161d 100644 --- a/app/app.js +++ b/app/app.js @@ -11,8 +11,6 @@ import { appTheme as theme, GlobalStyle } from './theme'; import electronStore from '../config/electron-store'; import { DARK, THEME_MODE } from './constants/themes'; -import 'rc-tooltip/assets/bootstrap.css'; - const store = configureStore({}); type Props = {}; diff --git a/app/components/transaction-daily.js b/app/components/transaction-daily.js index b2d13dd..b063351 100644 --- a/app/components/transaction-daily.js +++ b/app/components/transaction-daily.js @@ -39,16 +39,17 @@ export const TransactionDailyComponent = ({ transactionsDate, transactions, zecP {transactions.map(({ - date, type, address, amount, transactionId, + date, type, address, amount, transactionId, fees, }) => ( ))} diff --git a/app/components/transaction-details.js b/app/components/transaction-details.js index 777109c..f552313 100644 --- a/app/components/transaction-details.js +++ b/app/components/transaction-details.js @@ -21,7 +21,6 @@ import { ColumnComponent } from './column'; import { appTheme } from '../theme'; import { formatNumber } from '../utils/format-number'; -import { truncateAddress } from '../utils/truncate-address'; import { openExternal } from '../utils/open-external'; const Wrapper = styled.div` @@ -127,8 +126,8 @@ type Props = { zecPrice: number, date: string, transactionId: string, - from: string, - to: string, + address: string, + fees: number | string, handleClose: () => void, theme: AppTheme, }; @@ -139,35 +138,25 @@ const Component = ({ zecPrice, date, transactionId, - from, - to, + address, + fees, handleClose, theme, }: Props) => { const isReceived = type === 'receive'; - const receivedIcon = theme.mode === DARK - ? ReceivedIconDark - : ReceivedIconLight; - const sentIcon = theme.mode === DARK - ? SentIconDark - : SentIconLight; + const receivedIcon = theme.mode === DARK ? ReceivedIconDark : ReceivedIconLight; + const sentIcon = theme.mode === DARK ? SentIconDark : SentIconLight; return ( - + - + @@ -207,7 +200,7 @@ const Component = ({ diff --git a/app/components/transaction-item.js b/app/components/transaction-item.js index 2052120..9c51ed9 100644 --- a/app/components/transaction-item.js +++ b/app/components/transaction-item.js @@ -71,6 +71,7 @@ export type Transaction = { date: string, address: string, amount: number, + fees: number | string, zecPrice: number, transactionId: string, theme: AppTheme, @@ -81,6 +82,7 @@ const Component = ({ date, address, amount, + fees, zecPrice, transactionId, theme, @@ -97,12 +99,8 @@ const Component = ({ }); const transactionAddress = truncateAddress(address); - const receivedIcon = theme.mode === DARK - ? ReceivedIconDark - : ReceivedIconLight; - const sentIcon = theme.mode === DARK - ? SentIconDark - : SentIconLight; + const receivedIcon = theme.mode === DARK ? ReceivedIconDark : ReceivedIconLight; + const sentIcon = theme.mode === DARK ? SentIconDark : SentIconLight; return ( @@ -141,8 +136,8 @@ const Component = ({ { const { address, theme } = this.props; const { showQRCode, showCopiedTooltip } = this.state; - const qrCodeIcon = theme.mode === DARK - ? ScanIconDark - : ScanIconLight; + const qrCodeIcon = theme.mode === DARK ? ScanIconDark : ScanIconLight; - const copyIcon = theme.mode === DARK - ? CopyIconDark - : CopyIconLight; + const copyIcon = theme.mode === DARK ? CopyIconDark : CopyIconLight; return ( @@ -155,27 +151,18 @@ class Component extends PureComponent { onClick={this.toggleMoreInfo} onDoubleClick={this.showMoreInfo} /> - + {}}> {!showCopiedTooltip ? null : ( )} - + - + {!showQRCode ? null : ( diff --git a/app/containers/dashboard.js b/app/containers/dashboard.js index e2477a6..27c8c9f 100644 --- a/app/containers/dashboard.js +++ b/app/containers/dashboard.js @@ -50,11 +50,12 @@ const mapDispatchToProps = (dispatch: Dispatch) => ({ const formattedTransactions: Array = flow([ arr => arr.map(transaction => ({ - transactionId: transaction.txid, + transactionId: transaction.txid || 'N/A', type: transaction.category, date: new Date(transaction.time * 1000).toISOString(), address: transaction.address, amount: Math.abs(transaction.amount), + fees: transaction.fee ? new BigNumber(transaction.fee).abs().toFormat(4) : 'N/A', })), arr => groupBy(arr, obj => dateFns.format(obj.date, 'MMM DD, YYYY')), obj => Object.keys(obj).map(day => ({ diff --git a/app/containers/transactions.js b/app/containers/transactions.js index a6d3a78..5fefe14 100644 --- a/app/containers/transactions.js +++ b/app/containers/transactions.js @@ -70,6 +70,7 @@ const mapDispatchToProps = (dispatch: Dispatch): MapDispatchToProps => ({ date: new Date(transaction.time * 1000).toISOString(), address: transaction.address, amount: new BigNumber(transaction.amount).absoluteValue().toNumber(), + fees: transaction.fee ? new BigNumber(transaction.fee).abs().toFormat(4) : 'N/A', })), ); diff --git a/app/views/send.js b/app/views/send.js index dc6b326..1d2fb7d 100644 --- a/app/views/send.js +++ b/app/views/send.js @@ -5,7 +5,6 @@ import styled, { withTheme, keyframes } from 'styled-components'; import { BigNumber } from 'bignumber.js'; import { Transition, animated } from 'react-spring'; import { type Match } from 'react-router-dom'; -import Tooltip from 'rc-tooltip'; import { FEES } from '../constants/fees'; import { DARK } from '../constants/themes'; @@ -32,8 +31,7 @@ import LoadingIcon from '../assets/images/sync_icon_dark.png'; import ArrowUpIconDark from '../assets/images/arrow_up_dark.png'; import ArrowUpIconLight from '../assets/images/arrow_up_light.png'; -import type { SendTransactionInput, MapDispatchToProps, MapStateToProps } from '../containers/send'; -import type { State as SendState } from '../redux/modules/send'; +import type { MapDispatchToProps, MapStateToProps } from '../containers/send'; const rotate = keyframes` from { @@ -87,7 +85,7 @@ const AmountWrapper = styled.div` display: block; transition: all 0.05s ease-in-out; opacity: ${(props: AmountProps) => (props.isEmpty ? '0' : '1')}; - color: #fff; + color: ${props => props.theme.colors.text}; z-index: 10; } `; @@ -278,7 +276,7 @@ const HexadecimalWrapper = styled.div` cursor: pointer; &:hover { - opacity: 1; + opacity: 1;s } `; @@ -286,10 +284,33 @@ const HexadecimalText = styled(TextComponent)` white-space: nowrap; `; +const SimpleTooltip = styled.div` + background: ${props => props.theme.colors.walletAddressTooltipBg}; + position: absolute; + top: -30px; + right: 0px; + padding: 6px 10px; + border-radius: 3px; +`; + +const TooltipText = styled(TextComponent)` + color: ${props => props.theme.colors.walletAddressTooltip}; + font-size: 10px; + font-weight: 700; + text-align: center; +`; + +const SendButtonWrapper = styled.div` + position: relative; + width: 100%; + display: flex; +`; + type Props = { match: Match, theme: AppTheme, -} & MapStateToProps & MapDispatchToProps; +} & MapStateToProps & + MapDispatchToProps; type State = { showFee: boolean, @@ -453,18 +474,12 @@ class Component extends PureComponent { return isToAddressValid ? ( - + ) : ( - + ); }; @@ -564,12 +579,20 @@ class Component extends PureComponent { addresses, balance, zecPrice, isSending, error, operationId, theme, } = this.props; const { - showFee, from, amount, to, memo, fee, feeType, isHexMemo, showBalanceTooltip, + showFee, + from, + amount, + to, + memo, + fee, + feeType, + isHexMemo, + showBalanceTooltip, } = this.state; const isEmpty = amount === ''; - const fixedAmount = this.getAmountWithFee(); + const fixedAmount = isEmpty || new BigNumber(amount).eq(0) ? 0 : this.getAmountWithFee(); const zecBalance = formatNumber({ value: balance, append: 'ZEC ' }); const zecBalanceInUsd = formatNumber({ @@ -585,13 +608,9 @@ class Component extends PureComponent { append: 'USD $', }); - const seeMoreIcon = theme.mode === DARK - ? MenuIconDark - : MenuIconLight; + const seeMoreIcon = theme.mode === DARK ? MenuIconDark : MenuIconLight; - const arrowUpIcon = theme.mode === DARK - ? ArrowUpIconDark - : ArrowUpIconLight; + const arrowUpIcon = theme.mode === DARK ? ArrowUpIconDark : ArrowUpIconLight; return ( @@ -741,16 +760,13 @@ class Component extends PureComponent { showButtons={!isSending && !error && !operationId} onClose={this.reset} renderTrigger={toggle => ( - - - - - )} - > + + {showBalanceTooltip ? ( + + + + + ) : null} this.showModal(toggle)} id='send-submit-button' @@ -760,7 +776,7 @@ class Component extends PureComponent { isFluid disabled={this.shouldDisableSendButton()} /> - + )} > {toggle => ( diff --git a/app/views/transactions.js b/app/views/transactions.js index 0c61066..3034951 100644 --- a/app/views/transactions.js +++ b/app/views/transactions.js @@ -111,6 +111,7 @@ export class TransactionsView extends PureComponent { flow-coverageflow-coverage90%90% \ No newline at end of file +flow-coverageflow-coverage88%88% \ No newline at end of file