refactor(ui): irefactoring of UI for wallet summary

refactor(ui): add assets for shielded address support
This commit is contained in:
Andre Neves 2019-04-27 18:36:18 -04:00
parent 0202104514
commit f2194ddc93
14 changed files with 138 additions and 82 deletions

View File

@ -6,6 +6,8 @@ Zepio is a Sapling-enabled shielded-address first Zcash wallet, featuring cross-
### [Latest Documentation at https://zepiowallet.com](https://zepiowallet.com)
> CURRENTLY ONLY A PRE-RELEASE AVAILABLE
## Stack Information

View File

@ -44,7 +44,6 @@ describe('<TransactionItem />', () => {
amount={0.8652}
date={new Date().toString()}
zecPrice={2.94}
fees={0.0001}
/>
</ThemeProvider>,
);

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -17,7 +17,6 @@ const TransactionsWrapper = styled.div`
padding: 0;
margin: 0;
box-sizing: border-box;
margin-bottom: 20px;
`;
const Day = styled(TextComponent)`
@ -40,7 +39,7 @@ export const TransactionDailyComponent = ({ transactionsDate, transactions, zecP
<TransactionsWrapper>
{transactions.map(
({
date, type, address, amount, transactionId, fees, confirmed, confirmations,
date, type, address, amount, transactionId, confirmed, confirmations,
}) => (
<Fragment key={`${address}-${type}-${amount}-${date}`}>
<TransactionItemComponent
@ -52,7 +51,6 @@ export const TransactionDailyComponent = ({ transactionsDate, transactions, zecP
address={address || 'N/A'}
amount={amount}
zecPrice={zecPrice}
fees={fees}
/>
</Fragment>
),

View File

@ -58,6 +58,10 @@ const CloseIconImg = styled.img`
margin-top: 12px;
margin-right: 12px;
cursor: pointer;
&:hover {
filter: brightness(150%);
}
`;
const InfoRow = styled(RowComponent)`
@ -126,9 +130,10 @@ type Props = {
date: string,
transactionId: string,
address: string,
fees: number | string,
handleClose: () => void,
theme: AppTheme,
confirmed: boolean,
confirmations: number,
};
const Component = ({
@ -138,15 +143,21 @@ const Component = ({
date,
transactionId,
address,
fees,
handleClose,
theme,
confirmed,
confirmations,
}: Props) => {
const isReceived = type === 'receive';
const receivedIcon = theme.mode === DARK ? ReceivedIconDark : ReceivedIconLight;
const sentIcon = theme.mode === DARK ? SentIconDark : SentIconLight;
const coinName = getCoinName();
let confirmationValue = 'Unconfirmed';
if (confirmations >= 3) confirmationValue = confirmations;
if (confirmed) confirmationValue = confirmations;
return (
<Wrapper>
<CloseIconWrapper>
@ -186,20 +197,11 @@ const Component = ({
</ColumnComponent>
<ColumnComponent>
<TextComponent
value='FEES'
value='Confirmations'
isBold
color={theme.colors.transactionDetailsLabel({ theme })}
/>
<TextComponent
value={
fees === 'N/A'
? 'N/A'
: formatNumber({
value: new BigNumber(fees).toFormat(4),
append: `${coinName} `,
})
}
/>
<TextComponent value={String(confirmationValue)} />
</ColumnComponent>
</InfoRow>
<Divider />

View File

@ -71,26 +71,24 @@ const TransactionColumn = styled(ColumnComponent)`
`;
export type Transaction = {
confirmed: boolean, // eslint-disable-line
confirmations: number, // eslint-disable-line
confirmed: boolean,
confirmations: number,
type: 'send' | 'receive',
date: string,
address: string,
amount: number,
fees: number | string,
zecPrice: number,
transactionId: string,
theme: AppTheme,
};
const Component = ({
// confirmed,
// confirmations,
confirmed,
confirmations,
type,
date,
address,
amount,
fees,
zecPrice,
transactionId,
theme,
@ -146,7 +144,8 @@ const Component = ({
amount={amount}
date={date}
address={address}
fees={fees}
confirmed={confirmed}
confirmations={confirmations}
transactionId={transactionId}
handleClose={toggleVisibility}
type={type}

View File

@ -87,7 +87,7 @@ const QRCodeContainer = styled.div`
background-color: ${props => props.theme.colors.qrCodeWrapperBg}
border: 1px solid ${props => props.theme.colors.qrCodeWrapperBorder}
border-radius: ${props => props.theme.boxBorderRadius};
padding: 20px;
padding: 20px 20px 20px 10px;
margin-bottom: 10px;
width: 100%;
`;
@ -164,8 +164,9 @@ const AddressDetailsLabel = styled.div`
const AddressDetailsWrapper = styled.div`
display: flex;
flex: 1;
flex-direction: column;
padding: 10px 20px 0 20px;
padding: 15px 20px 0 20px;
`;
const FormButton = styled(Button)`
@ -179,7 +180,7 @@ const FormButton = styled(Button)`
const Column = styled.div`
display: flex;
padding-bottom: 10px;
padding-bottom: 15px;
flex-direction: column;
justify-content: flex-start;
align-items: flex-start;

View File

@ -4,46 +4,82 @@ import React from 'react';
import styled, { withTheme } from 'styled-components';
import { TextComponent } from './text';
import { RowComponent } from './row';
import { formatNumber } from '../utils/format-number';
import { getCoinName } from '../utils/get-coin-name';
import { DARK } from '../constants/themes';
const Wrapper = styled.div`
display: flex;
flex-direction: column;
background-color: ${props => props.theme.colors.walletSummaryBg};
border: 1px solid ${props => props.theme.colors.walletSummaryBorder};
border-radius: ${props => props.theme.boxBorderRadius};
padding: 37px 45px;
min-height: 250px;
position: relative;
import shieldDarkImage from '../assets/images/shield-dark.png';
import shieldLightImage from '../assets/images/shield-light.png';
const OutsideWrapper = styled.div`
margin-top: ${props => props.theme.layoutContentPaddingTop};
`;
const AllAddresses = styled(TextComponent)`
margin-bottom: 2.5px;
font-size: ${props => `${props.theme.fontSize.small}em`};
const Wrapper = styled.div`
display: flex;
flex-direction: row;
background-color: ${props => props.theme.colors.walletSummaryBg};
border: 1px solid ${props => props.theme.colors.walletSummaryBorder};
border-radius: ${props => props.theme.boxBorderRadius};
padding: 30px 30px;
position: relative;
`;
const ValueBox = styled.div`
margin-bottom: 15px;
margin-right: 25px;
`;
const Label = styled(TextComponent)`
margin-top: 10px;
const OutsideLabel = styled(TextComponent)`
text-transform: uppercase;
color: ${props => props.theme.colors.transactionsDate};
font-size: ${props => `${props.theme.fontSize.regular * 0.9}em`};
font-weight: ${props => String(props.theme.fontWeight.bold)};
margin-bottom: 5px;
margin-left: -7.5px;
`;
const TotalContainer = styled.div`
min-width: 270px;
`;
const DetailContainer = styled.div`
min-width: 130px;
padding-right: 20px;
`;
const USDValue = styled(TextComponent)`
opacity: 0.5;
font-weight: ${props => String(props.theme.fontWeight.light)};
font-size: 16px;
`;
const ShieldedValue = styled(Label)`
const DefaultLabel = styled(TextComponent)`
margin-top: 5px;
margin-bottom: 0px;
color: ${props => props.theme.colors.walletSummaryTransparent};
`;
const MiddleLabel = styled(TextComponent)`
margin-top: 7px;
margin-bottom: 5px;
font-size: 18px;
`;
const ShieldedValue = styled(DefaultLabel)`
color: ${props => props.theme.colors.activeItem};
padding-left: 13px;
position: relative;
&:before {
position: absolute;
left: -1px;
top: -1px;
content: '';
background: url(${props => (props.theme.mode === DARK ? shieldDarkImage : shieldLightImage)});
background-size: cover;
height: 12px;
width: 11px;
}
`;
const UnconfirmedValue = styled(DefaultLabel)`
color: ${props => props.theme.colors.walletSummaryUnconfirmed};
`;
type Props = {
@ -64,50 +100,51 @@ export const Component = ({
theme,
}: Props) => {
const coinName = getCoinName();
return (
<Wrapper>
<AllAddresses value='ALL ADDRESSES' isBold />
<ValueBox>
<TextComponent
size={theme.fontSize.medium * 2.5}
value={`${coinName} ${formatNumber({ value: total })}`}
isBold
/>
<USDValue
value={`USD $${formatNumber({ value: total * zecPrice })}`}
size={theme.fontSize.medium * 2}
/>
</ValueBox>
<RowComponent>
<ValueBox>
<ShieldedValue value='&#9679; SHIELDED' isBold size={theme.fontSize.small} />
<OutsideWrapper>
<OutsideLabel value='Wallet Summary' />
<Wrapper>
<TotalContainer>
<TextComponent
size={theme.fontSize.medium * 2.4}
value={`${coinName} ${formatNumber({ value: total })}`}
isBold
/>
<USDValue
value={`USD $${formatNumber({ value: total * zecPrice })}`}
size={theme.fontSize.medium * 2}
/>
</TotalContainer>
<DetailContainer>
<ShieldedValue value='SHIELDED' isBold size={theme.fontSize.small} />
<MiddleLabel
value={`${coinName} ${formatNumber({ value: shielded })}`}
isBold
size={theme.fontSize.medium}
size='16px'
/>
<USDValue value={`USD $${formatNumber({ value: shielded * zecPrice })}`} />
</ValueBox>
<ValueBox>
<Label value='&#9679; TRANSPARENT' isBold size={theme.fontSize.small} />
<TextComponent
</DetailContainer>
<DetailContainer>
<DefaultLabel value='TRANSPARENT' isBold size={theme.fontSize.small} />
<MiddleLabel
value={`${coinName} ${formatNumber({ value: transparent })}`}
isBold
size={theme.fontSize.medium}
size='16px'
/>
<USDValue value={`USD $${formatNumber({ value: transparent * zecPrice })}`} />
</ValueBox>
<ValueBox>
<Label value='&#9679; UNCONFIRMED' isBold size={theme.fontSize.small} />
<TextComponent
value={`${coinName} ${formatNumber({ value: unconfirmed })}`}
</DetailContainer>
<DetailContainer>
<UnconfirmedValue value='UNCONFIRMED' isBold size={theme.fontSize.small} />
<MiddleLabel
value={`${coinName} ${formatNumber({ value: transparent })}`}
isBold
size={theme.fontSize.medium}
size='16px'
/>
<USDValue value={`USD $${formatNumber({ value: unconfirmed * zecPrice })}`} />
</ValueBox>
</RowComponent>
</Wrapper>
</DetailContainer>
</Wrapper>
</OutsideWrapper>
);
};

View File

@ -124,6 +124,9 @@ export const DARK_COLORS = {
// Wallet Summary
walletSummaryBg: black,
walletSummaryBorder: black,
walletSummaryUnconfirmed: silver,
walletSummaryShielded: white,
walletSummaryTransparent: white,
// Wallet Address
walletAddressBg: black,

View File

@ -123,6 +123,9 @@ export const LIGHT_COLORS = {
// Wallet Summary
walletSummaryBg: white,
walletSummaryBorder: alto,
walletSummaryUnconfirmed: shipGray,
walletSummaryShielded: black,
walletSummaryTransparent: black,
// Wallet Address
walletAddressBg: white,

View File

@ -21,7 +21,7 @@ type Props = {
transactions: TransactionsList,
};
const UPDATE_INTERVAL = 10000;
const UPDATE_INTERVAL = 5000;
export class DashboardView extends PureComponent<Props> {
interval = null;

View File

@ -19,6 +19,8 @@ import PlusIconLight from '../assets/images/plus_icon_light.svg';
import type { addressType } from '../redux/modules/receive';
import type { MapStateToProps, MapDispatchToProps } from '../containers/receive';
const TRANSPARENT_ADDRESS_SUBLABEL = 'By using transaparent addresses you are forgiving any privacy properties to your transactions.';
const Row = styled(RowComponent)`
margin-bottom: 10px;
`;
@ -31,6 +33,16 @@ const Label = styled(InputLabelComponent)`
margin-bottom: 5px;
`;
const SubLabel = styled(InputLabelComponent)`
color: ${props => props.theme.colors.transactionsDate};
font-size: ${props => `${props.theme.fontSize.regular * 0.9}em`};
font-weight: ${props => String(props.theme.fontWeight.light)};
letter-spacing: 0.5px;
margin-bottom: 10px;
margin-top: 0;
padding-top: 8px;
`;
const ActionButton = styled.button`
background: none;
border: none;
@ -164,6 +176,7 @@ class Component extends PureComponent<Props, State> {
}}
>
<Label value='Transparent Address (not private)' />
<SubLabel value={TRANSPARENT_ADDRESS_SUBLABEL} />
{transparentAddresses.map(({ address, balance }) => (
<WalletAddress key={address} address={address} balance={balance} />
))}

View File

@ -112,7 +112,6 @@ export class TransactionsView extends PureComponent<Props> {
confirmations={transaction.confirmations}
address={transaction.address}
amount={transaction.amount}
fees={transaction.fees}
date={transaction.date}
transactionId={transaction.transactionId}
type={transaction.type}