Skip to content

Commit

Permalink
Merge pull request #164 from sonm-io/dev
Browse files Browse the repository at this point in the history
update master
  • Loading branch information
dmitrypisanko authored Jul 25, 2018
2 parents 1d4543b + 6713af5 commit 014bcf2
Show file tree
Hide file tree
Showing 116 changed files with 33,498 additions and 1,382 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# Created by .ignore support plugin (hsz.mobi)
.idea
.vscode
/node_modules/
/package-lock.json
/node_modules
/yarn.lock
/dist
/docs
Expand Down
6 changes: 3 additions & 3 deletions front/src/app/api/runtime-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@ export const TypeAccountInfoList = t.list(TypeAccountInfo);
export const TypeOrder = createStruct<IOrder>(
{
id: t.String,
orderType: t.Number,
orderSide: t.Number,
creator: TypeAccountBrief,
price: t.String,
duration: t.Number,
usdWeiPerSeconds: t.String,
durationSeconds: t.Number,
orderStatus: t.Number,
benchmarkMap: TypeBenchmarkMap,
},
Expand Down
18 changes: 13 additions & 5 deletions front/src/app/api/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { TUsdWeiPerSeconds, TSeconds } from 'app/entities/types';

export interface IRawAccount {
json: string;
name: string;
Expand Down Expand Up @@ -157,7 +159,7 @@ export interface IBenchmarkMap {
networkIncoming: boolean;
}

export enum EnumOrderType {
export enum EnumOrderSide {
any = 0,
bid = 1,
ask = 2,
Expand All @@ -176,14 +178,20 @@ export enum EnumOrderStatus {

export interface IOrder {
id: string;
orderType: EnumOrderType;
orderSide: EnumOrderSide;
creator: IAccountBrief;
price: string;
duration: number;
usdWeiPerSeconds: TUsdWeiPerSeconds;
durationSeconds: TSeconds;
orderStatus: EnumOrderStatus;
benchmarkMap: Partial<IBenchmarkMap>;
}

export enum EnumDealStatus {
Unknown = 0,
Accepted,
Closed,
}

export interface IDeal {
id: string;
supplier: IAccountBrief;
Expand All @@ -193,7 +201,7 @@ export interface IDeal {
bidID: string;
duration: number;
price: string;
status: number;
status: EnumDealStatus;
blockedBalance: string;
totalPayout: string;
startTime: number;
Expand Down
1 change: 0 additions & 1 deletion front/src/app/components/common/account-item/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@
& &__action {
font-size: 20px;
margin: 0 10px 0 0;
min-width: 26px;
}

&__buttons {
Expand Down
18 changes: 18 additions & 0 deletions front/src/app/components/common/account-item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface IAccountItemProps {
onRename?: (newName: string, address: string) => void;
onClickIcon?: (address: string) => void;
onClickShowPrivateKey?: (address: string) => void;
onClickProfileIcon?: (address: string) => void;
hasButtons?: boolean;
primaryTokenInfo?: ICurrencyInfo;
}
Expand Down Expand Up @@ -46,6 +47,14 @@ export class AccountItem extends React.Component<IAccountItemProps, any> {
}
};

protected handleClickProfileIcon = (event: any) => {
event.preventDefault();

if (this.props.onClickProfileIcon) {
this.props.onClickProfileIcon(this.props.address);
}
};

public render() {
const {
className,
Expand Down Expand Up @@ -118,6 +127,15 @@ export class AccountItem extends React.Component<IAccountItemProps, any> {
/>
</a>
) : null}
<a
href="#show-private-key"
onClick={this.handleClickProfileIcon}
>
<Icon
i="Profile"
className="sonm-account-item__action"
/>
</a>
</div>
) : null}
</div>
Expand Down
7 changes: 6 additions & 1 deletion front/src/app/components/common/alert/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@
&__message {
display: flex;
justify-content: center;
align-items: baseline;
white-space: pre-wrap;
}

&__bold {
font-weight: bold;
}

& &__cross {
Expand All @@ -57,7 +63,6 @@
}

&__hash {
margin: 0 10px;
width: 150px;
}
}
16 changes: 14 additions & 2 deletions front/src/app/components/common/alert/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class Alert extends React.PureComponent<IAlertProps, any> {
}
};

protected static processHashes(msg: string): any[] {
protected static processMessage(msg: string): any[] {
let idx = 0;
const result: any[] = [];

Expand All @@ -46,6 +46,18 @@ export class Alert extends React.PureComponent<IAlertProps, any> {

return '';
});

msg.replace(/\[b\].+?\[\/b\]/gi, function(value, position) {
result.push(msg.slice(idx, position));
result.push(
<span className="sonm-alert__bold">
{value.replace('[b]', '').replace('[/b]', '')}
</span>,
);
idx = position + value.length;

return '';
});
result.push(msg.slice(idx, msg.length));

return result;
Expand All @@ -69,7 +81,7 @@ export class Alert extends React.PureComponent<IAlertProps, any> {
>
<span className="sonm-alert__message">
{typeof children === 'string'
? Alert.processHashes(children)
? Alert.processMessage(children)
: children}
</span>
{onClosed ? (
Expand Down
4 changes: 4 additions & 0 deletions front/src/app/components/common/alert/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ alert:
alert with hash:

<Alert type="success" id="1">lololo 0x1234567890123456789012345678901234567890 ololo </Alert>

alert with bold:

<Alert type="success" id="1">lololo [b]bold text[/b] 12345</Alert>
Loading

0 comments on commit 014bcf2

Please sign in to comment.