Skip to content

Commit bc891ce

Browse files
committed
Merge branch 'release/2.0.0'
2 parents e97c3c8 + 8279391 commit bc891ce

61 files changed

Lines changed: 624 additions & 243 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "apla-front",
3-
"version": "1.1.0",
3+
"version": "2.0.0",
44
"author": {
55
"name": "apla-front"
66
},

public/locales/en-US.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"auth.wallet.remove": "Remove",
2929
"auth.wallet.share": "Share",
3030
"auth.wallet.share.long": "Share account data",
31+
"auth.wallet.unregistered": "Unregistered account",
3132
"auth.authentication": "Authentication",
3233
"auth.create.success": "Account has been successfully created",
3334
"auth.error.E_INVALID_KEY": "Provided key is corrupted or contains invalid data",
@@ -147,8 +148,10 @@
147148
"general.password.repeat": "Repeat password",
148149
"general.password.old": "Old password",
149150
"general.password.new": "New password",
151+
"general.print": "Print",
150152
"general.title": "Apla",
151153
"general.title.format": "{title} | Apla",
154+
"general.save": "Save",
152155
"general.security.warning": "Please use desktop version or mobile application for better security",
153156
"history.newer": "Newer",
154157
"history.older": "Older",
@@ -199,7 +202,9 @@
199202
"process.confirm": "Confirm",
200203
"process.continue": "Continue",
201204
"undo": "Undo",
205+
"tx.data.missing": "Data is missing",
202206
"tx.param.value": "Value",
207+
"tx.report": "Transaction report",
203208
"tx.error.error": "Error",
204209
"tx.error.error.desc": "{error}",
205210
"tx.error.exception": "Runtime exception",

public/locales/ru-RU.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"auth.wallet.remove": "Удалить",
2929
"auth.wallet.share": "Копировать",
3030
"auth.wallet.share.long": "Копировать данные аккаунта",
31+
"auth.wallet.unregistered": "Незарегистрированный аккаунт",
3132
"auth.authentication": "Аутентификация",
3233
"auth.create.success": "Аккаунт успешно создан",
3334
"auth.error.E_INVALID_KEY": "Указанный ключ содержит некорректные данные или повреждён",
@@ -147,8 +148,10 @@
147148
"general.password.repeat": "Повторите пароль",
148149
"general.password.old": "Старый пароль",
149150
"general.password.new": "Новый пароль",
151+
"general.print": "Печать",
150152
"general.title": "Apla",
151153
"general.title.format": "{title} | Apla",
154+
"general.save": "Сохранить",
152155
"general.security.warning": "Для большей безопасности используйте desktop или мобильное приложение",
153156
"history.newer": "Новее",
154157
"history.older": "Старше",
@@ -199,7 +202,9 @@
199202
"process.confirm": "Подтвердить",
200203
"process.continue": "Далее",
201204
"undo": "Отмена",
205+
"tx.data.missing": "Данные отсутствуют",
202206
"tx.param.value": "Значение",
207+
"tx.report": "Отчёт транзакции",
203208
"tx.error.error": "Ошибка",
204209
"tx.error.error.desc": "{error}",
205210
"tx.error.exception": "Программное исключение",

src/app/components/Auth/Login/PasswordPrompt.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const PasswordPrompt: React.SFC<IPasswordPromptProps & InjectedIntlProps> = prop
3535
<div className="avatar-holder">
3636
<Avatar
3737
size={100}
38-
keyID={props.wallet.wallet.id}
38+
account={props.wallet.wallet.address}
3939
ecosystem={props.wallet.access.ecosystem}
4040
/>
4141
</div>

src/app/components/Auth/Login/WalletList/WalletButton.tsx

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import React from 'react';
77
import styled from 'styled-components';
88
import { FormattedMessage } from 'react-intl';
99
import { Button, Clearfix } from 'react-bootstrap';
10-
import { IAccount, IKeyInfo, IRoleInfo } from 'apla/api';
10+
import { IAccount, IRoleInfo, IEcosystemInfo } from 'apla/api';
1111
import { INotificationsMessage } from 'apla/socket';
1212

1313
import Avatar from 'containers/Avatar';
@@ -19,11 +19,11 @@ export interface IWalletButtonProps {
1919
notifications: INotificationsMessage[];
2020
onCopy: () => void;
2121
onRemove: () => void;
22-
onSelect: (params: { access: IKeyInfo, role: IRoleInfo }) => void;
22+
onSelect: (params: { access: IEcosystemInfo, role: IRoleInfo }) => void;
2323
onRegister?: () => void;
2424
}
2525

26-
const getNotificationsCount = (notifications: INotificationsMessage[], role: number, ecosystem: string) => {
26+
const getNotificationsCount = (notifications: INotificationsMessage[], role: string, ecosystem: string) => {
2727
const value = notifications.find(l => l.role === role && l.ecosystem === ecosystem);
2828
return value ? value.count : 0;
2929
};
@@ -35,7 +35,14 @@ const WalletButton: React.SFC<IWalletButtonProps> = (props) => (
3535
</div>
3636
<div className="wallet-head">
3737
<h4 className="wallet-name">
38-
{props.wallet.address}
38+
{props.wallet.address ?
39+
(
40+
<span>{props.wallet.address}</span>
41+
) :
42+
(
43+
<FormattedMessage id="auth.wallet.unregistered" defaultMessage="Unregistered account" />
44+
)
45+
}
3946
</h4>
4047
{0 === props.wallet.access.length && props.onRegister && (
4148
<div className="text-danger">
@@ -63,7 +70,7 @@ const WalletButton: React.SFC<IWalletButtonProps> = (props) => (
6370
<div className="pull-left">
6471
<Avatar
6572
size={44}
66-
keyID={props.wallet.id}
73+
account={props.wallet.address}
6774
ecosystem={access.ecosystem}
6875
/>
6976
</div>
@@ -74,11 +81,11 @@ const WalletButton: React.SFC<IWalletButtonProps> = (props) => (
7481
<span>
7582
<FormattedMessage id="auth.login.as" defaultMessage="Login with role" />:
7683
</span>
77-
<RoleButton className="wallet-btn" badge={getNotificationsCount(props.notifications, 0, access.ecosystem)} onClick={() => props.onSelect({ access, role: null })}>
84+
<RoleButton className="wallet-btn" badge={getNotificationsCount(props.notifications, '0', access.ecosystem)} onClick={() => props.onSelect({ access, role: null })}>
7885
<FormattedMessage id="auth.role.guest" defaultMessage="Guest" />
7986
</RoleButton>
8087
{access.roles.map(role => (
81-
<RoleButton key={role.id} className="wallet-btn" badge={getNotificationsCount(props.notifications, Number(role.id), access.ecosystem)} onClick={() => props.onSelect({ access, role })}>
88+
<RoleButton key={role.id} className="wallet-btn" badge={getNotificationsCount(props.notifications, role.id, access.ecosystem)} onClick={() => props.onSelect({ access, role })}>
8289
{role.name}
8390
</RoleButton>
8491
))}

src/app/components/Main/Backup.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ import { Button, Panel } from 'react-bootstrap';
88
import { FormattedMessage } from 'react-intl';
99
import keyring from 'lib/keyring';
1010
import { sendAttachment } from 'lib/fs';
11-
import { IAccountContext } from 'apla/auth';
11+
import { IAccount } from 'apla/api';
1212
import CopyToClipboard from 'react-copy-to-clipboard';
1313
import QRCode from 'qrcode.react';
1414

1515
import Wrapper from 'components/Wrapper';
1616
import Validation from 'components/Validation';
1717

1818
export interface IBackupProps {
19-
wallet: IAccountContext;
19+
account: IAccount;
2020
privateKey: string;
2121
onError?: () => any;
2222
onCopy?: () => any;
@@ -37,7 +37,7 @@ class Backup extends React.Component<IBackupProps, IBackupState> {
3737
}
3838

3939
onSubmit = (values: { [key: string]: string }) => {
40-
const privateKey = keyring.decryptAES(this.props.wallet.wallet.encKey, values.password);
40+
const privateKey = keyring.decryptAES(this.props.account.encKey, values.password);
4141

4242
if (keyring.validatePrivateKey(privateKey)) {
4343
const publicKey = keyring.generatePublicKey(privateKey);
@@ -125,7 +125,7 @@ class Backup extends React.Component<IBackupProps, IBackupState> {
125125
<td>
126126
<FormattedMessage id="general.address" defaultMessage="Address" />
127127
</td>
128-
<td>{this.props.wallet.wallet.address}</td>
128+
<td>{this.props.account && this.props.account.address}</td>
129129
</tr>
130130
<tr>
131131
<td>
@@ -163,7 +163,7 @@ class Backup extends React.Component<IBackupProps, IBackupState> {
163163
<FormattedMessage id="general.wallet.backup" defaultMessage="This section is used to backup your account data. You will not be able to restore access to your account if you forget your password or lose the private key" />
164164
}
165165
>
166-
{this.props.wallet && (
166+
{this.props.account && (
167167
<Validation.components.ValidatedForm onSubmitSuccess={this.onSubmit}>
168168
{this.state.privateKey ? this.renderSecond() : this.renderFirst()}
169169
</Validation.components.ValidatedForm>

src/app/components/Main/UserMenu.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import React from 'react';
77
import styled from 'styled-components';
88
import { FormattedMessage } from 'react-intl';
99
import { IAccountContext } from 'apla/auth';
10+
import { IEcosystemInfo } from 'apla/api';
1011

1112
import { CloseDropdownButton } from 'components/DropdownButton';
1213
import PageLink from 'containers/Routing/PageLink';
1314
import SystemButton from './SystemButton';
1415
import Avatar from 'containers/Avatar';
15-
import { IKeyInfo } from 'apla/api';
1616

1717
const StyledUserMenu = styled.div`
1818
-webkit-app-region: no-drag;
@@ -64,7 +64,7 @@ const StyledUserMenu = styled.div`
6464
export interface IUserMenuProps {
6565
isDefaultWallet: boolean;
6666
wallet: IAccountContext;
67-
walletEcosystems: IKeyInfo[];
67+
walletEcosystems: IEcosystemInfo[];
6868
onSwitchEcosystem: (ecosystem: string, defaultRole?: boolean) => void;
6969
onLogout: () => void;
7070
onChangePassword: () => void;
@@ -156,7 +156,7 @@ class UserMenu extends React.Component<IUserMenuProps> {
156156
<Avatar
157157
className="user-avatar"
158158
size={32}
159-
keyID={this.props.wallet.wallet.id}
159+
account={this.props.wallet.wallet.address}
160160
ecosystem={this.props.wallet.access.ecosystem}
161161
/>
162162
</StyledUserMenu>

src/app/components/Modal/Auth/CopyWalletModal.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class CopyWalletModal extends Modal<ICopyWalletModalParams, void> {
2222
}
2323

2424
getCopyPayload = () => {
25-
return `${this.props.params.wallet.address}\n${this.props.params.wallet.publicKey}`;
25+
return this.props.params.wallet.publicKey;
2626
}
2727

2828
render() {
@@ -34,12 +34,6 @@ class CopyWalletModal extends Modal<ICopyWalletModalParams, void> {
3434
<Modal.Body>
3535
<table className="table table-striped table-bordered table-hover preline mb0" style={{ maxWidth: 500 }}>
3636
<tbody>
37-
<tr>
38-
<td>
39-
<FormattedMessage id="general.address" defaultMessage="Address" />
40-
</td>
41-
<td>{this.props.params.wallet.address}</td>
42-
</tr>
4337
<tr>
4438
<td style={{ minWidth: 100 }}>
4539
<FormattedMessage id="general.key.public" defaultMessage="Public key" />

src/app/components/Modal/RolePickerModal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import Modal, { ModalContainer, IModalProps } from './';
1212
import Avatar from 'containers/Avatar';
1313

1414
export interface IRolePickerModalParams {
15-
walletID: string;
15+
account: string;
1616
ecosystem: string;
1717
ecosystemName: string;
1818
roles: IRoleInfo[];
@@ -33,7 +33,7 @@ class RolePickerModal extends ModalContainer<IRolePickerModalProps> {
3333
<div className="pull-left">
3434
<Avatar
3535
size={44}
36-
keyID={this.props.params.walletID}
36+
account={this.props.params.account}
3737
ecosystem={this.props.params.ecosystem}
3838
/>
3939
</div>
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/*---------------------------------------------------------------------------------------------
2+
* Copyright (c) EGAAS S.A. All rights reserved.
3+
* See LICENSE in the project root for license information.
4+
*--------------------------------------------------------------------------------------------*/
5+
6+
import React from 'react';
7+
import Button from 'components/Button';
8+
import { sendAttachment } from 'lib/fs';
9+
import { FormattedMessage } from 'react-intl';
10+
11+
export interface IPrintZoneProps {
12+
stylesheet: string;
13+
}
14+
15+
class PrintZone extends React.Component<IPrintZoneProps> {
16+
private _container: HTMLDivElement;
17+
private _output: HTMLIFrameElement;
18+
19+
componentDidUpdate() {
20+
this.onRepaint();
21+
}
22+
23+
componentDidMount() {
24+
this.onRepaint();
25+
}
26+
27+
onRepaint = () => {
28+
setTimeout(() => {
29+
if (!this._output || !this._output.contentDocument.body) {
30+
return;
31+
}
32+
33+
this._output.style.height = '0px';
34+
this._output.contentDocument.body.innerHTML = this._container.innerHTML;
35+
const style = this._output.contentDocument.createElement('style');
36+
style.innerText = this.props.stylesheet;
37+
this._output.contentDocument.body.appendChild(style);
38+
this._output.style.height = this._output.contentDocument.body.scrollHeight + 'px';
39+
});
40+
}
41+
42+
onSave = () => {
43+
sendAttachment('Tx.html', this._output.contentDocument.body.innerHTML, 'text/html');
44+
}
45+
46+
onPrint = () => {
47+
this._output.contentWindow.focus();
48+
this._output.contentWindow.print();
49+
}
50+
51+
render() {
52+
return (
53+
<div>
54+
<div ref={l => this._container = l} style={{ position: 'absolute', top: -50000, left: -50000 }}>
55+
{this.props.children}
56+
</div>
57+
<iframe
58+
ref={l => this._output = l}
59+
scrolling="no"
60+
style={{
61+
background: '#fff',
62+
width: '100%',
63+
boxSizing: 'border-box',
64+
border: 'dashed 1px #999',
65+
outline: 0,
66+
padding: 0,
67+
margin: 0
68+
}}
69+
/>
70+
<hr />
71+
<span>
72+
<Button className="btn btn-primary" onClick={this.onSave}>
73+
<FormattedMessage id="general.save" defaultMessage="Save" />
74+
</Button>
75+
</span>
76+
<span style={{ marginLeft: 15 }}>
77+
<Button className="btn btn-primary" onClick={this.onPrint}>
78+
<FormattedMessage id="general.print" defaultMessage="Print" />
79+
</Button>
80+
</span>
81+
82+
</div>
83+
);
84+
}
85+
}
86+
87+
export default PrintZone;

0 commit comments

Comments
 (0)