From 3660ba28d73d70d08bf14c33ef680e5ef3ec7f3b Mon Sep 17 00:00:00 2001
From: Fabio Berger <me@fabioberger.com>
Date: Tue, 21 Nov 2017 14:03:08 -0600
Subject: Add website to mono repo, update packages to align with existing
 sub-packages, use new subscribeAsync 0x.js method

---
 packages/website/ts/components/visual_order.tsx | 77 +++++++++++++++++++++++++
 1 file changed, 77 insertions(+)
 create mode 100644 packages/website/ts/components/visual_order.tsx

(limited to 'packages/website/ts/components/visual_order.tsx')

diff --git a/packages/website/ts/components/visual_order.tsx b/packages/website/ts/components/visual_order.tsx
new file mode 100644
index 000000000..a7d6d1a9e
--- /dev/null
+++ b/packages/website/ts/components/visual_order.tsx
@@ -0,0 +1,77 @@
+import * as _ from 'lodash';
+import * as React from 'react';
+import {ZeroEx} from '0x.js';
+import {AssetToken, Token, TokenByAddress} from 'ts/types';
+import {utils} from 'ts/utils/utils';
+import {Party} from 'ts/components/ui/party';
+import {constants} from 'ts/utils/constants';
+
+const PRECISION = 5;
+
+interface VisualOrderProps {
+    orderTakerAddress: string;
+    orderMakerAddress: string;
+    makerAssetToken: AssetToken;
+    takerAssetToken: AssetToken;
+    makerToken: Token;
+    takerToken: Token;
+    networkId: number;
+    tokenByAddress: TokenByAddress;
+    isMakerTokenAddressInRegistry: boolean;
+    isTakerTokenAddressInRegistry: boolean;
+}
+
+interface VisualOrderState {}
+
+export class VisualOrder extends React.Component<VisualOrderProps, VisualOrderState> {
+    public render() {
+        const allTokens = _.values(this.props.tokenByAddress);
+        const makerImage = this.props.makerToken.iconUrl;
+        const takerImage = this.props.takerToken.iconUrl;
+        return (
+            <div>
+                <div className="clearfix">
+                    <div className="col col-5 center">
+                        <Party
+                            label="Send"
+                            address={this.props.takerToken.address}
+                            alternativeImage={takerImage}
+                            networkId={this.props.networkId}
+                            isInTokenRegistry={this.props.isTakerTokenAddressInRegistry}
+                            hasUniqueNameAndSymbol={utils.hasUniqueNameAndSymbol(allTokens, this.props.takerToken)}
+                        />
+                    </div>
+                    <div className="col col-2 center pt1">
+                        <div className="pb1">
+                            {this.renderAmount(this.props.takerAssetToken, this.props.takerToken)}
+                        </div>
+                        <div className="lg-p2 md-p2 sm-p1">
+                            <img src="/images/trade_arrows.png" style={{width: 47}} />
+                        </div>
+                        <div className="pt1">
+                            {this.renderAmount(this.props.makerAssetToken, this.props.makerToken)}
+                        </div>
+                    </div>
+                    <div className="col col-5 center">
+                        <Party
+                            label="Receive"
+                            address={this.props.makerToken.address}
+                            alternativeImage={makerImage}
+                            networkId={this.props.networkId}
+                            isInTokenRegistry={this.props.isMakerTokenAddressInRegistry}
+                            hasUniqueNameAndSymbol={utils.hasUniqueNameAndSymbol(allTokens, this.props.makerToken)}
+                        />
+                    </div>
+                </div>
+            </div>
+        );
+    }
+    private renderAmount(assetToken: AssetToken, token: Token) {
+        const unitAmount = ZeroEx.toUnitAmount(assetToken.amount, token.decimals);
+        return (
+            <div style={{fontSize: 13}}>
+                {unitAmount.toNumber().toFixed(PRECISION)} {token.symbol}
+            </div>
+        );
+    }
+}
-- 
cgit 

