Skip to content

Commit

Permalink
Merge branch '0.3.0' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
slaweet committed Mar 16, 2018
2 parents 689a115 + e340212 commit 80afda8
Show file tree
Hide file tree
Showing 40 changed files with 539 additions and 114 deletions.
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lisk-hub",
"version": "0.2.0",
"version": "0.3.0-rc.1",
"description": "Lisk Hub",
"main": "./build/main.js",
"author": {
Expand Down
14 changes: 12 additions & 2 deletions i18n/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
"Coming soon.": "Coming soon.",
"Confirm": "Confirm",
"Confirm (Fee: 1 LSK)": "Confirm (Fee: 1 LSK)",
"Confirm (Fee: {{fee}} LSK)": "Confirm (Fee: {{fee}} LSK)",
"Confirm transfer": "Confirm transfer",
"Confirmation in the next step": "Confirmation in the next step",
"Confirmation in the next step.": "Confirmation in the next step.",
"Confirmations": "Confirmations",
"Connection re-established": "Connection re-established",
Expand All @@ -51,6 +53,7 @@
"Delegate name": "Delegate name",
"Delegate section will be displayed.": "Delegate section will be displayed.",
"Delegates": "Delegates",
"Discard": "Discard",
"Done": "Done",
"Dowload started": "Dowload started",
"Drag to reveal": "Drag to reveal",
Expand All @@ -75,10 +78,12 @@
"I understand": "I understand",
"In": "In",
"Incoming": "Incoming",
"Initialize Lisk ID": "Initialize Lisk ID",
"Insufficient funds": "Insufficient funds",
"Insufficient funds for {{amount}} LSK fee": "Insufficient funds for {{amount}} LSK fee",
"Invalid address": "Invalid address",
"Invalid amount": "Invalid amount",
"It is recommended that you initialize your Lisk ID.": "It is recommended that you initialize your Lisk ID.",
"Keep it": "Keep it",
"LSK received": "LSK received",
"LSK/BTC": "LSK/BTC",
Expand All @@ -87,13 +92,15 @@
"Later": "Later",
"Latest activity": "Latest activity",
"Learn how voting works": "Learn how voting works",
"Learn more about Lisk ID initialization": "Learn more about Lisk ID initialization",
"Learn more about Lisk sidechains": "Learn more about Lisk sidechains",
"Lisk Chat": "Lisk Chat",
"Lisk Explorer": "Lisk Explorer",
"Lisk Forum": "Lisk Forum",
"Lisk Hub": "Lisk Hub",
"Lisk ID": "Lisk ID",
"Lisk Website": "Lisk Website",
"Lock ID": "Lock ID",
"Lock ID’s automatically after 10 minutes.": "Lock ID’s automatically after 10 minutes.",
"Log in": "Log in",
"Losing access to this passphrase will mean no funds can be sent from this account.": "Losing access to this passphrase will mean no funds can be sent from this account.",
Expand Down Expand Up @@ -179,12 +186,13 @@
"Thank you": "Thank you",
"The Wallet will show your recent transactions.": "The Wallet will show your recent transactions.",
"The download was started. Depending on your internet speed it can take up to several minutes. You will be informed then it is finished and prompted to restart the app.": "The download was started. Depending on your internet speed it can take up to several minutes. You will be informed then it is finished and prompted to restart the app.",
"The easiest way to do this is to send LSK to yourself. It will cost you only the usual {{fee}} LSK transaction fee.": "The easiest way to do this is to send LSK to yourself. It will cost you only the usual {{fee}} LSK transaction fee.",
"There are no {{filterName}} transactions.": "There are no {{filterName}} transactions.",
"There is a new version ({{version}}) available, do you want to update now?": "There is a new version ({{version}}) available, do you want to update now?",
"This is your Lisk ID": "This is your Lisk ID",
"Toggle full screen": "Toggle full screen",
"Total": "Total",
"Total incl. 0.1 LSK Fee": "Total incl. 0.1 LSK Fee",
"Total incl. {{fee}} LSK Fee": "Total incl. {{fee}} LSK Fee",
"Transaction ID": "Transaction ID",
"Transaction is being processed and will be confirmed. It may take up to 15 minutes to be secured in the blockchain.": "Transaction is being processed and will be confirmed. It may take up to 15 minutes to be secured in the blockchain.",
"Transactions can’t be reversed": "Transactions can’t be reversed",
Expand All @@ -195,7 +203,6 @@
"Unable to connect to the node": "Unable to connect to the node",
"Undo": "Undo",
"Unlock account": "Unlock account",
"Unlocked": "Unlocked",
"Update download finished": "Update download finished",
"Update now": "Update now",
"Updates downloaded, application has to be restarted to apply the updates.": "Updates downloaded, application has to be restarted to apply the updates.",
Expand All @@ -221,7 +228,10 @@
"You can vote for up to {{count}} delegates in total.": "You can vote for up to {{count}} delegates in total.",
"You can vote for up to {{count}} delegates in total._plural": "You can vote for up to {{count}} delegates in total.",
"You have already registered as a delegate.": "You have already registered as a delegate.",
"You only need to do this once for each Lisk ID.": "You only need to do this once for each Lisk ID.",
"You will send a small amount of {{fee}} LSK to yourself and therefore initialize your ID.": "You will send a small amount of {{fee}} LSK to yourself and therefore initialize your ID.",
"You've received {{value}} LSK.": "You've received {{value}} LSK.",
"Your ID is now secured!": "Your ID is now secured!",
"Your Lisk IDs": "Your Lisk IDs",
"You’re votes are being processed and will be confirmed. It may take up to 10 minutes to be secured in the blockchain.": "You’re votes are being processed and will be confirmed. It may take up to 10 minutes to be secured in the blockchain.",
"Zero not allowed": "Zero not allowed",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lisk-hub",
"version": "0.2.0",
"version": "0.3.0-rc.1",
"description": "Lisk Hub",
"homepage": "https://github.com/LiskHQ/lisk-hub",
"bugs": "https://github.com/LiskHQ/lisk-hub/issues",
Expand Down
4 changes: 3 additions & 1 deletion src/actions/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import transactionTypes from '../constants/transactionTypes';
/**
* Trigger this action to remove passphrase from account object
*
* @param {Object} data - account data
* @returns {Object} - Action object
*/
export const removePassphrase = () => ({
export const removePassphrase = data => ({
data,
type: actionTypes.removePassphrase,
});

Expand Down
21 changes: 20 additions & 1 deletion src/actions/account.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@ import { expect } from 'chai';
import sinon from 'sinon';
import actionTypes from '../constants/actions';
import { accountUpdated, accountLoggedOut,
secondPassphraseRegistered, delegateRegistered, sent } from './account';
secondPassphraseRegistered, delegateRegistered, sent, removePassphrase } from './account';
import { transactionAdded, transactionFailed } from './transactions';
import { errorAlertDialogDisplayed } from './dialog';
import * as accountApi from '../utils/api/account';
import * as delegateApi from '../utils/api/delegate';
import Fees from '../constants/fees';
import { toRawLsk } from '../utils/lsk';
import transactionTypes from '../constants/transactionTypes';
import networks from '../constants/networks';
import accounts from '../../test/constants/accounts';

describe('actions: account', () => {
describe('accountUpdated', () => {
Expand Down Expand Up @@ -215,4 +217,21 @@ describe('actions: account', () => {
expect(dispatch).to.have.been.calledWith(expectedAction);
});
});

describe('removePassphrase', () => {
it('should create an action to remove passphrase', () => {
const data = {
publicKey: accounts.genesis.publicKey,
network: networks.testnet,
address: accounts.genesis.address,
};

const expectedAction = {
data,
type: actionTypes.removePassphrase,
};

expect(removePassphrase(data)).to.be.deep.equal(expectedAction);
});
});
});
10 changes: 10 additions & 0 deletions src/actions/savedAccounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,13 @@ export const accountsRetrieved = () => ({
export const activeAccountSaved = () => ({
type: actionTypes.activeAccountSaved,
});

/**
* An action to dispatch removeSavedAccountPassphrase
* @param {Object} data - account data
* @returns {Object} - Action object
*/
export const removeSavedAccountPassphrase = data => ({
data,
type: actionTypes.removeSavedAccountPassphrase,
});
12 changes: 12 additions & 0 deletions src/actions/savedAccounts.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
accountRemoved,
accountsRetrieved,
activeAccountSaved,
removeSavedAccountPassphrase,
} from './savedAccounts';


Expand Down Expand Up @@ -76,4 +77,15 @@ describe('actions: savedAccount', () => {
expect(activeAccountSaved()).to.be.deep.equal(expectedAction);
});
});

describe('removeSavedAccountPassphrase', () => {
it('should create an action to remove passphrase', () => {
const expectedAction = {
data,
type: actionTypes.removeSavedAccountPassphrase,
};

expect(removeSavedAccountPassphrase(data)).to.be.deep.equal(expectedAction);
});
});
});
60 changes: 60 additions & 0 deletions src/components/accountInitialization/accountInit.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
@import '../app/variables.css';

:root {
--font-size-L: 16px;
--font-size-XS: 14px;
}

.wrapper {
padding: 45px;
line-height: 30px;
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;

& header {
& h2 {
margin-top: 0;
font-weight: var(--font-weight-semi-bold);
}
}

& p {
font-size: var(--font-size-L);
}

& a {
font-weight: var(--font-weight-bold);
color: var(--color-link);
text-decoration: none;
}

& footer {
padding: 0px;
}

& .button {
font-weight: var(--font-weight-bold);
font-size: var(--font-size-L);
letter-spacing: 0;
line-height: 18px;
text-transform: none;
min-width: 0;
width: 100%;
}
}

@media (--xSmall-viewport) {
.wrapper {
padding: 20px 19px;

& p {
font-size: var(--font-size-XS);
}

& .button {
font-size: var(--font-size-XS);
}
}
}
71 changes: 71 additions & 0 deletions src/components/accountInitialization/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import React from 'react';
import { connect } from 'react-redux';
import { translate } from 'react-i18next';
import grid from 'flexboxgrid/dist/flexboxgrid.css';
import { Button } from './../toolbox/buttons/button';
import { FontIcon } from '../fontIcon';
import Box from '../box';
import styles from './accountInit.css';
import fees from './../../constants/fees';
import { fromRawLsk } from '../../utils/lsk';

class AccountInitialization extends React.Component {
closeInfo() {
this.props.nextStep();
}

componentDidMount() {
const { account, transactions } = this.props;
const needsNoAccountInit = account.serverPublicKey
|| account.balance === 0
|| transactions.pending.length > 0;
if (needsNoAccountInit) {
this.props.nextStep();
}
}

render() {
const { account, t, nextStep } = this.props;

return (<Box className={`${styles.wrapper} ${grid.row} account-initialization`}>
<header>
<h2>{t('Initialize Lisk ID')}</h2>
</header>
<div>
<p>{t('It is recommended that you initialize your Lisk ID.')}</p>
<p>{t('The easiest way to do this is to send LSK to yourself. It will cost you only the usual {{fee}} LSK transaction fee.', { fee: fromRawLsk(fees.send) })}</p>
<p>
<a target='_blank' href='https://help.lisk.io/account-security/should-i-initialize-my-lisk-account' rel='noopener noreferrer'>
{t('Learn more about Lisk ID initialization')} <FontIcon>arrow-right</FontIcon>
</a>
</p>
</div>
<footer>
<div className={grid.row} >
<div className={grid['col-xs-4']}>
<Button
label={t('Discard')}
onClick={this.closeInfo.bind(this)}
className={`account-init-discard-button ${styles.button}`}
/>
</div>
<div className={grid['col-xs-8']}>
<Button
label={t('Next')}
onClick={() => nextStep({ account, accountInit: true }, 2)}
className={`account-init-button ${styles.button}`}/>
</div>
</div>
<div className='subTitle'>{t('Confirmation in the next step')}</div>
</footer>
</Box>
);
}
}

const mapStateToProps = state => ({
account: state.account,
transactions: state.transactions,
});

export default connect(mapStateToProps)(translate()(AccountInitialization));
9 changes: 5 additions & 4 deletions src/components/dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import styles from './dashboard.css';

class Dashboard extends React.Component {
render() {
const { transactions, t, history, accountAddress, loading } = this.props;
const { transactions, t, account, loading } = this.props;
return <div className={`${grid.row} ${styles.wrapper}`}>
<div className={`${grid['col-md-8']} ${grid['col-xs-12']} ${styles.main}`}>
<Box className={`${styles.graph}`}>
Expand All @@ -32,22 +32,23 @@ class Dashboard extends React.Component {
<TransactionList {...{
transactions,
t,
address: accountAddress,
address: account.address,
dashboard: true,
loading,
}} />
</Box>
</div>
<div className={`${grid['col-md-4']} ${styles.sendWrapper}`}>
<Send history={history} />
<Send {...this.props} />
</div>
</div>;
}
}

const mapStateToProps = state => ({
transactions: [...state.transactions.pending, ...state.transactions.confirmed].slice(0, 3),
accountAddress: state.account.address,
pendingTransactions: state.transactions.pending,
account: state.account,
loading: state.loading.length > 0,
});

Expand Down
2 changes: 1 addition & 1 deletion src/components/dashboard/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('Dashboard', () => {
options: {},
},
loading: [],
account: { address: 'some address' },
account: { address: 'some address', serverPublicKey: 'public_key' },
},
};
wrapper = mountWithContext(<Dashboard history={ { location: {} } }/>, context);
Expand Down
14 changes: 9 additions & 5 deletions src/components/header/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,20 @@ class Header extends React.Component {
</div>
<CopyToClipboard value={this.props.account.address} className={`${styles.address} account-information-address`}/>
{this.props.autoLog ? <div className={styles.timer}>
{((!this.props.account.expireTime || this.props.account.expireTime === 0)) ?
<span>{this.props.t('Account locked!')} <FontIcon value='locked' className={styles.lock}/></span> :
{((this.props.account.expireTime &&
this.props.account.expireTime !== 0) &&
this.props.account.passphrase) ?
<div>
{this.props.t('Address timeout in')} <i> </i>
<Countdown
date={this.props.account.expireTime}
renderer={CountDownTemplate}
onComplete={() => this.props.removePassphrase()}
/> <FontIcon value='unlocked' className={styles.lock}/>
</div>}
onComplete={() => {
this.props.removeSavedAccountPassphrase();
}
}
/>
</div> : <div></div>}
</div>
: <div className={styles.timer}>
{this.props.account.passphrase ? '' : <span>
Expand Down
Loading

0 comments on commit 80afda8

Please sign in to comment.