aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/components/trade_history
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2018-05-11 23:38:51 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2018-05-14 16:35:13 +0800
commitb74957acdfc8d67d154bcb4698acd7575db7cc47 (patch)
tree3f33c2faac3b55e52098ab0b5b9883a9b62f5aee /packages/website/ts/components/trade_history
parent6aed4fb1ae27dabed027c855f2cbdc0bfb4f3b6b (diff)
downloaddexon-sol-tools-b74957acdfc8d67d154bcb4698acd7575db7cc47.tar
dexon-sol-tools-b74957acdfc8d67d154bcb4698acd7575db7cc47.tar.gz
dexon-sol-tools-b74957acdfc8d67d154bcb4698acd7575db7cc47.tar.bz2
dexon-sol-tools-b74957acdfc8d67d154bcb4698acd7575db7cc47.tar.lz
dexon-sol-tools-b74957acdfc8d67d154bcb4698acd7575db7cc47.tar.xz
dexon-sol-tools-b74957acdfc8d67d154bcb4698acd7575db7cc47.tar.zst
dexon-sol-tools-b74957acdfc8d67d154bcb4698acd7575db7cc47.zip
Add missing type definitions
Diffstat (limited to 'packages/website/ts/components/trade_history')
-rw-r--r--packages/website/ts/components/trade_history/trade_history.tsx20
-rw-r--r--packages/website/ts/components/trade_history/trade_history_item.tsx8
2 files changed, 14 insertions, 14 deletions
diff --git a/packages/website/ts/components/trade_history/trade_history.tsx b/packages/website/ts/components/trade_history/trade_history.tsx
index 635358627..1ca9d866f 100644
--- a/packages/website/ts/components/trade_history/trade_history.tsx
+++ b/packages/website/ts/components/trade_history/trade_history.tsx
@@ -28,16 +28,16 @@ export class TradeHistory extends React.Component<TradeHistoryProps, TradeHistor
sortedFills,
};
}
- public componentWillMount() {
+ public componentWillMount(): void {
this._startPollingForFills();
}
- public componentWillUnmount() {
+ public componentWillUnmount(): void {
this._stopPollingForFills();
}
- public componentDidMount() {
+ public componentDidMount(): void {
window.scrollTo(0, 0);
}
- public render() {
+ public render(): React.ReactNode {
return (
<div className="lg-px4 md-px4 sm-px2">
<h3>Trade history</h3>
@@ -48,7 +48,7 @@ export class TradeHistory extends React.Component<TradeHistoryProps, TradeHistor
</div>
);
}
- private _renderTrades() {
+ private _renderTrades(): React.ReactNode {
const numNonCustomFills = this._numFillsWithoutCustomERC20Tokens();
if (numNonCustomFills === 0) {
return this._renderEmptyNotice();
@@ -66,14 +66,14 @@ export class TradeHistory extends React.Component<TradeHistoryProps, TradeHistor
);
});
}
- private _renderEmptyNotice() {
+ private _renderEmptyNotice(): React.ReactNode {
return (
<Paper className="mt1 p2 mx-auto center" style={{ width: '80%' }}>
No filled orders yet.
</Paper>
);
}
- private _numFillsWithoutCustomERC20Tokens() {
+ private _numFillsWithoutCustomERC20Tokens(): number {
let numNonCustomFills = 0;
const tokens = _.values(this.props.tokenByAddress);
_.each(this.state.sortedFills, fill => {
@@ -93,7 +93,7 @@ export class TradeHistory extends React.Component<TradeHistoryProps, TradeHistor
});
return numNonCustomFills;
}
- private _startPollingForFills() {
+ private _startPollingForFills(): void {
this._fillPollingIntervalId = window.setInterval(() => {
const sortedFills = this._getSortedFills();
if (!utils.deepEqual(sortedFills, this.state.sortedFills)) {
@@ -103,10 +103,10 @@ export class TradeHistory extends React.Component<TradeHistoryProps, TradeHistor
}
}, FILL_POLLING_INTERVAL);
}
- private _stopPollingForFills() {
+ private _stopPollingForFills(): void {
clearInterval(this._fillPollingIntervalId);
}
- private _getSortedFills() {
+ private _getSortedFills(): Fill[] {
const fillsByHash = tradeHistoryStorage.getUserFillsByHash(this.props.userAddress, this.props.networkId);
const fills = _.values(fillsByHash);
const sortedFills = _.sortBy(fills, [(fill: Fill) => fill.blockTimestamp * -1]);
diff --git a/packages/website/ts/components/trade_history/trade_history_item.tsx b/packages/website/ts/components/trade_history/trade_history_item.tsx
index dbe72259b..adca4d58c 100644
--- a/packages/website/ts/components/trade_history/trade_history_item.tsx
+++ b/packages/website/ts/components/trade_history/trade_history_item.tsx
@@ -23,7 +23,7 @@ interface TradeHistoryItemProps {
interface TradeHistoryItemState {}
export class TradeHistoryItem extends React.Component<TradeHistoryItemProps, TradeHistoryItemState> {
- public render() {
+ public render(): React.ReactNode {
const fill = this.props.fill;
const tokens = _.values(this.props.tokenByAddress);
const takerToken = _.find(tokens, token => {
@@ -88,7 +88,7 @@ export class TradeHistoryItem extends React.Component<TradeHistoryItemProps, Tra
</Paper>
);
}
- private _renderAmounts(makerToken: Token, takerToken: Token) {
+ private _renderAmounts(makerToken: Token, takerToken: Token): React.ReactNode {
const fill = this.props.fill;
const filledTakerTokenAmountInUnits = ZeroEx.toUnitAmount(fill.filledTakerTokenAmount, takerToken.decimals);
const filledMakerTokenAmountInUnits = ZeroEx.toUnitAmount(fill.filledMakerTokenAmount, takerToken.decimals);
@@ -136,7 +136,7 @@ export class TradeHistoryItem extends React.Component<TradeHistoryItemProps, Tra
</div>
);
}
- private _renderDate() {
+ private _renderDate(): React.ReactNode {
const blockMoment = moment.unix(this.props.fill.blockTimestamp);
if (!blockMoment.isValid()) {
return null;
@@ -159,7 +159,7 @@ export class TradeHistoryItem extends React.Component<TradeHistoryItemProps, Tra
</div>
);
}
- private _renderAmount(amount: BigNumber, symbol: string, decimals: number) {
+ private _renderAmount(amount: BigNumber, symbol: string, decimals: number): React.ReactNode {
const unitAmount = ZeroEx.toUnitAmount(amount, decimals);
return (
<span>