Skip to content

Commit

Permalink
Address book (#562)
Browse files Browse the repository at this point in the history
* problem: User should be able to store contacts in addressbook

* solution: Tx sending refactoring

* problem: action types for Addressbook store should be refactored

* problem: Sign tx form shows wrong currency symbol in case tokens send
solution: Pass tx and nativeTx to Sign form

* problem: addressbook UI impovements
  • Loading branch information
gagarin55 committed May 4, 2018
1 parent ee42973 commit ca03558
Show file tree
Hide file tree
Showing 61 changed files with 839 additions and 559 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[*.js]
indent_style = space
indent_size = 2
2 changes: 2 additions & 0 deletions electron/vault/launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class LocalConnector {
reject(err);
} else {
const options = [
'account',
'import',
`--chain=${this.chain.name}`,
'--all',
Expand All @@ -108,6 +109,7 @@ class LocalConnector {
reject(err);
} else {
const options = [
'-v',
'server',
];
log.debug(`Emerald bin: ${bin}, args: ${options}`);
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"Isaac Ardis",
"Shane Jonas <jonas.shane@gmail.com>"
],
"version": "0.9.0",
"version": "0.10.0",
"description": "Emerald - Ethereum Classic Wallet",
"main": "./electron/main.js",
"moduleRoots": [
Expand Down Expand Up @@ -64,8 +64,8 @@
"devtron": "^1.4.0",
"electron-log": "^2.2.6",
"electron-store": "^1.1.0",
"emerald-js": "git+https://github.com/ETCDEVTeam/emerald-js.git#v0.1.0",
"emerald-js-ui": "git+https://github.com/ETCDEVTeam/emerald-js-ui.git#v0.0.22",
"emerald-js": "git+https://github.com/ETCDEVTeam/emerald-js.git#v0.1.2",
"emerald-js-ui": "git+https://github.com/ETCDEVTeam/emerald-js-ui.git#v0.0.23",
"es6-promise": "4.1.1",
"eslint": "4.2.0",
"eslint-nibble": "4.2.1",
Expand All @@ -84,7 +84,6 @@
"lib": "^2.2.5",
"material-ui": "^0.20.0",
"node-pre-gyp": "0.6.36",
"object-assign": "^4.1.1",
"prop-types": "^15.4.2",
"qrcode.react": "0.6.1",
"react": "^15.6.1",
Expand Down Expand Up @@ -185,15 +184,16 @@
"iconSize": 128,
"contents": [
{
"x": 180,
"x": 180,
"y": 190
},
{
"x": 380,
"y": 190,
"type": "link",
"path": "/Applications"
}]
}
]
}
},
"jest": {
Expand Down
14 changes: 7 additions & 7 deletions scripts/download-emerald.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const config = {
format: 'v1',
channel: 'stable',
app: {
version: '0.19.0',
version: '0.22.0',
},
download: [
{
Expand All @@ -15,13 +15,13 @@ const config = {
{
type: 'https',
pack: 'zip',
url: 'https://github.com/ethereumproject/emerald-cli/releases/download/v0.19.0/emerald-cli-osx-v0.19.3-113a3e3.zip',
url: 'https://github.com/ETCDEVTeam/emerald-cli/releases/download/v0.22.0/emerald-cli-osx-v0.22.0-5dbb148.zip',
},
],
signatures: [
{
type: 'pgp',
url: 'https://github.com/ethereumproject/emerald-cli/releases/download/v0.19.0/emerald-cli-osx-v0.19.3-113a3e3.zip.asc',
url: 'https://github.com/ETCDEVTeam/emerald-cli/releases/download/v0.22.0/emerald-cli-osx-v0.22.0-5dbb148.zip.asc',
},
],
},
Expand All @@ -31,13 +31,13 @@ const config = {
{
type: 'https',
pack: 'zip',
url: 'https://github.com/ethereumproject/emerald-cli/releases/download/v0.19.0/emerald-stable-x86_64-pc-windows-msvc-v0.19.3-113a3e3.zip',
url: 'https://github.com/ETCDEVTeam/emerald-cli/releases/download/v0.22.0/emerald-stable-x86_64-pc-windows-msvc-v0.22.0-5dbb148.zip',
},
],
signatures: [
{
type: 'pgp',
url: 'https://github.com/ethereumproject/emerald-cli/releases/download/v0.19.0/emerald-stable-x86_64-pc-windows-msvc-v0.19.3-113a3e3.zip.asc',
url: 'https://github.com/ETCDEVTeam/emerald-cli/releases/download/v0.22.0/emerald-stable-x86_64-pc-windows-msvc-v0.22.0-5dbb148.zip.asc',
},
],
},
Expand All @@ -47,13 +47,13 @@ const config = {
{
type: 'https',
pack: 'zip',
url: 'https://github.com/ethereumproject/emerald-cli/releases/download/v0.19.0/emerald-cli-linux-v0.19.3-113a3e3.zip',
url: 'https://github.com/ETCDEVTeam/emerald-cli/releases/download/v0.22.0/emerald-cli-linux-v0.22.0-5dbb148.zip',
},
],
signatures: [
{
type: 'pgp',
url: 'https://github.com/ethereumproject/emerald-cli/releases/download/v0.19.0/emerald-cli-linux-v0.19.3-113a3e3.zip.asc',
url: 'https://github.com/ETCDEVTeam/emerald-cli/releases/download/v0.22.0/emerald-cli-linux-v0.22.0-5dbb148.zip.asc',
},
],
},
Expand Down
2 changes: 0 additions & 2 deletions src/components/accounts/AccountList/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,10 @@ export class Account extends React.Component {
<SecondaryMenu account={account} />
<Button
label="Add ETC"
labelStyle={{ color: muiTheme.palette.alternateTextColor }}
onClick={ this.onAddEtcClick }
/>
<Button
label="Send"
labelStyle={{ color: muiTheme.palette.alternateTextColor }}
disabled={ !account.get('balance') }
onClick={ this.onSendClick }
/>
Expand Down
1 change: 1 addition & 0 deletions src/components/accounts/AccountList/list.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
.listItem {
margin-bottom: 6px;
}

.hiddenListItem {
opacity: 0.4;
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { connect } from 'react-redux';
import { addAddress } from 'store/addressActions';
import { gotoScreen } from '../../store/wallet/screen/screenActions';
import { AddressForm } from './form';
import Addressbook from '../../../store/vault/addressbook';
import { gotoScreen } from '../../../store/wallet/screen/screenActions';
import { AddressForm } from '../form';

const AddressAdd = connect(
(state, ownProps) => ({
blockAddress: false,
title: 'Add Contact',
}),
(dispatch, ownProps) => ({
onSubmit: (data) => new Promise((resolve, reject) => {
dispatch(addAddress(data.address, data.name, data.description))
dispatch(Addressbook.actions.addAddress(data.address, data.name, data.description))
.then((response) => {
resolve(response);
dispatch(gotoScreen('address', data.address));
dispatch(gotoScreen('address-book'));
});
}),
cancel: () => {
Expand Down
1 change: 1 addition & 0 deletions src/components/addressbook/AddContact/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {default} from './add';
48 changes: 48 additions & 0 deletions src/components/addressbook/ContactList/Contact.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import React from 'react';
import { connect } from 'react-redux';
import muiThemeable from 'material-ui/styles/muiThemeable';
import { Account } from 'emerald-js-ui';
import { Trash as DeleteIcon } from 'emerald-js-ui/lib/icons3';
import { IconButton } from 'material-ui';
import { gotoScreen } from '../../../store/wallet/screen/screenActions';
import Addressbook from '../../../store/vault/addressbook';

import styles from './Contact.scss';

const Render = ({ address, onDeleteAddress, muiTheme }) => (
<div className={styles.container}>
<div>
<Account
identity
addr={address.get('address')}
name={address.get('name')}
/>
</div>
<div>
<IconButton onClick={onDeleteAddress}>
<DeleteIcon style={{color: muiTheme.palette.secondaryTextColor}}/>
</IconButton>
</div>
</div>
);

const Address = connect(
(state, ownProps) => ({
}),
(dispatch, ownProps) => ({
openAddress: () => {
// const address = ownProps.address;
// dispatch(gotoScreen('address', address.get('address')));
},
onDeleteAddress: () => new Promise((resolve, reject) => {
const address = ownProps.address;
dispatch(Addressbook.actions.deleteAddress(address.get('address')))
.then((response) => {
dispatch(gotoScreen('address-book'));
resolve(response);
});
}),
})
)(Render);

export default muiThemeable()(Address);
7 changes: 7 additions & 0 deletions src/components/addressbook/ContactList/Contact.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.container {
display: flex;
align-items: center;
justify-content: space-between;
background-color: white;
padding: 10px
}
47 changes: 47 additions & 0 deletions src/components/addressbook/ContactList/ContactList.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import React from 'react';
import { connect } from 'react-redux';
import muiThemeable from 'material-ui/styles/muiThemeable';
import FlatButton from 'material-ui/FlatButton';
import { Add as AddIcon, Book as BookIcon } from 'emerald-js-ui/lib/icons3';
import Avatar from 'material-ui/Avatar';
import { cardSpace, tables } from 'lib/styles';
import Immutable from 'immutable';
import { gotoScreen } from '../../../store/wallet/screen/screenActions';
import Address from './Contact';
import TopBar from '../../layout/TopBar';

import styles from './ContactList.scss';

const ContactList = ({ addressBook, muiTheme }) => {
let list;
if (addressBook.size > 0) {
list = addressBook.map((addr) => (
<div key={addr.get('address')} style={{ border: `1px solid ${muiTheme.palette.borderColor}` }} className={styles.listItem}>
<Address address={addr} />
</div>));
} else {
list = (
<div style={{ border: `1px solid ${muiTheme.palette.borderColor}` }} className={styles.noItems}>
There are no contacts. Add one.
</div>);
}

return (
<div>
<TopBar />
<div className={styles.container}>
{list}
</div>
</div>
);
};

const AddressBook = connect(
(state, ownProps) => ({
addressBook: state.addressBook.get('addressBook', Immutable.List()),
}),
(dispatch, ownProps) => ({
})
)(muiThemeable()(ContactList));

export default AddressBook;
15 changes: 15 additions & 0 deletions src/components/addressbook/ContactList/ContactList.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.container {
margin-bottom: 10px;
margin-top: 5px;
}

.listItem {
margin-top: 10px;
}

.noItems {
background-color: white;
padding: 10px;
margin-top: 10px;
text-align: center;
}
1 change: 1 addition & 0 deletions src/components/addressbook/ContactList/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {default} from './ContactList';
38 changes: 0 additions & 38 deletions src/components/addressbook/address.js

This file was deleted.

Loading

0 comments on commit ca03558

Please sign in to comment.