aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-05-11 18:32:57 +0800
committerFabio Berger <me@fabioberger.com>2018-05-11 18:32:57 +0800
commitd370296e82c11d67bbb16a1dc73432c3625682aa (patch)
treec8e5d440bc2b78feae89644c11ba3ed778da6015 /packages/website/ts
parentf78b5741c3ba3495c066dc800ce62d8a1f3fb75f (diff)
parentf42f608f3f97a5244f09f17ae5ee184c0f775de3 (diff)
downloaddexon-sol-tools-d370296e82c11d67bbb16a1dc73432c3625682aa.tar
dexon-sol-tools-d370296e82c11d67bbb16a1dc73432c3625682aa.tar.gz
dexon-sol-tools-d370296e82c11d67bbb16a1dc73432c3625682aa.tar.bz2
dexon-sol-tools-d370296e82c11d67bbb16a1dc73432c3625682aa.tar.lz
dexon-sol-tools-d370296e82c11d67bbb16a1dc73432c3625682aa.tar.xz
dexon-sol-tools-d370296e82c11d67bbb16a1dc73432c3625682aa.tar.zst
dexon-sol-tools-d370296e82c11d67bbb16a1dc73432c3625682aa.zip
Merge branch 'development' into breakUp0xjs
* development: Fix ganache subprovider config Fix a bug in compiler config precedence Fix linter errors Fix templates Remove unused deployer docs configs Add a legacy endpoint for the deployer Add a check for compiler output Add a comment Put ARTIFACTS_VERSION in a config Improve a comment Remove _applyDefaultsToDeployTxDataAsync Add a HACK comment Fix linter issues Rename deployer to sol-compiler Remove deployer Remove deployer from 0x.js and migrations Configure migrations with a compiler.json Remove deployer from metacoin and contract tests Update wallet footer and add remove token functionality # Conflicts: # .gitignore # packages/0x.js/package.json # packages/0x.js/src/0x.ts # packages/contracts/package.json # packages/contracts/test/multi_sig_with_time_lock.ts # packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts # packages/contracts/util/artifacts.ts # packages/deployer/test/deployer_test.ts # packages/migrations/package.json
Diffstat (limited to 'packages/website/ts')
-rw-r--r--packages/website/ts/components/portal/portal.tsx50
-rw-r--r--packages/website/ts/components/top_bar/top_bar.tsx18
-rw-r--r--packages/website/ts/components/wallet/wallet.tsx31
-rw-r--r--packages/website/ts/containers/sol_compiler_documentation.ts (renamed from packages/website/ts/containers/deployer_documentation.ts)38
-rw-r--r--packages/website/ts/containers/subproviders_documentation.ts2
-rw-r--r--packages/website/ts/index.tsx13
-rw-r--r--packages/website/ts/pages/documentation/doc_page.tsx2
-rw-r--r--packages/website/ts/types.ts7
8 files changed, 105 insertions, 56 deletions
diff --git a/packages/website/ts/components/portal/portal.tsx b/packages/website/ts/components/portal/portal.tsx
index b5e8150c4..4cbc65ce4 100644
--- a/packages/website/ts/components/portal/portal.tsx
+++ b/packages/website/ts/components/portal/portal.tsx
@@ -14,8 +14,10 @@ import { TopBar, TopBarDisplayType } from 'ts/components/top_bar/top_bar';
import { FlashMessage } from 'ts/components/ui/flash_message';
import { Wallet } from 'ts/components/wallet/wallet';
import { localStorage } from 'ts/local_storage/local_storage';
+import { trackedTokenStorage } from 'ts/local_storage/tracked_token_storage';
import { Dispatcher } from 'ts/redux/dispatcher';
import { BlockchainErrs, HashData, Order, ProviderType, ScreenWidths, TokenByAddress, TokenVisibility } from 'ts/types';
+import { configs } from 'ts/utils/configs';
import { constants } from 'ts/utils/constants';
import { Translate } from 'ts/utils/translate';
import { utils } from 'ts/utils/utils';
@@ -49,7 +51,13 @@ interface PortalState {
prevPathname: string;
isDisclaimerDialogOpen: boolean;
isLedgerDialogOpen: boolean;
- isAssetPickerDialogOpen: boolean;
+ tokenManagementState: TokenManagementState;
+}
+
+enum TokenManagementState {
+ Add = 'Add',
+ Remove = 'Remove',
+ None = 'None',
}
const THROTTLE_TIMEOUT = 100;
@@ -90,7 +98,7 @@ export class Portal extends React.Component<PortalProps, PortalState> {
prevUserAddress: this.props.userAddress,
prevPathname: this.props.location.pathname,
isDisclaimerDialogOpen: !hasAcceptedDisclaimer,
- isAssetPickerDialogOpen: false,
+ tokenManagementState: TokenManagementState.None,
isLedgerDialogOpen: false,
};
}
@@ -142,6 +150,11 @@ export class Portal extends React.Component<PortalProps, PortalState> {
);
const allTokens = _.values(this.props.tokenByAddress);
const trackedTokens = _.filter(allTokens, t => t.isTracked);
+ const isAssetPickerDialogOpen = this.state.tokenManagementState !== TokenManagementState.None;
+ const tokenVisibility =
+ this.state.tokenManagementState === TokenManagementState.Add
+ ? TokenVisibility.UNTRACKED
+ : TokenVisibility.TRACKED;
return (
<div style={styles.root}>
<DocumentTitle title="0x Portal DApp" />
@@ -180,6 +193,7 @@ export class Portal extends React.Component<PortalProps, PortalState> {
providerType={this.props.providerType}
onToggleLedgerDialog={this._onToggleLedgerDialog.bind(this)}
onAddToken={this._onAddToken.bind(this)}
+ onRemoveToken={this._onRemoveToken.bind(this)}
/>
</div>
<div className="flex-auto px3" style={styles.scrollContainer}>
@@ -217,11 +231,11 @@ export class Portal extends React.Component<PortalProps, PortalState> {
networkId={this.props.networkId}
blockchain={this._blockchain}
dispatcher={this.props.dispatcher}
- isOpen={this.state.isAssetPickerDialogOpen}
+ isOpen={isAssetPickerDialogOpen}
currentTokenAddress={''}
onTokenChosen={this._onTokenChosen.bind(this)}
tokenByAddress={this.props.tokenByAddress}
- tokenVisibility={TokenVisibility.UNTRACKED}
+ tokenVisibility={tokenVisibility}
/>
</div>
</div>
@@ -230,14 +244,29 @@ export class Portal extends React.Component<PortalProps, PortalState> {
private _onTokenChosen(tokenAddress: string) {
if (_.isEmpty(tokenAddress)) {
this.setState({
- isAssetPickerDialogOpen: false,
+ tokenManagementState: TokenManagementState.None,
});
return;
}
const token = this.props.tokenByAddress[tokenAddress];
- this.props.dispatcher.updateTokenByAddress([token]);
+ const isDefaultTrackedToken = _.includes(configs.DEFAULT_TRACKED_TOKEN_SYMBOLS, token.symbol);
+ if (this.state.tokenManagementState === TokenManagementState.Remove && !isDefaultTrackedToken) {
+ if (token.isRegistered) {
+ // Remove the token from tracked tokens
+ const newToken = {
+ ...token,
+ isTracked: false,
+ };
+ this.props.dispatcher.updateTokenByAddress([newToken]);
+ } else {
+ this.props.dispatcher.removeTokenToTokenByAddress(token);
+ }
+ trackedTokenStorage.removeTrackedToken(this.props.userAddress, this.props.networkId, tokenAddress);
+ } else if (isDefaultTrackedToken) {
+ this.props.dispatcher.showFlashMessage(`Cannot remove ${token.name} because it's a default token`);
+ }
this.setState({
- isAssetPickerDialogOpen: false,
+ tokenManagementState: TokenManagementState.None,
});
}
private _onToggleLedgerDialog() {
@@ -247,7 +276,12 @@ export class Portal extends React.Component<PortalProps, PortalState> {
}
private _onAddToken() {
this.setState({
- isAssetPickerDialogOpen: !this.state.isAssetPickerDialogOpen,
+ tokenManagementState: TokenManagementState.Add,
+ });
+ }
+ private _onRemoveToken() {
+ this.setState({
+ tokenManagementState: TokenManagementState.Remove,
});
}
private _onPortalDisclaimerAccepted() {
diff --git a/packages/website/ts/components/top_bar/top_bar.tsx b/packages/website/ts/components/top_bar/top_bar.tsx
index 2502bea6d..5a1b50310 100644
--- a/packages/website/ts/components/top_bar/top_bar.tsx
+++ b/packages/website/ts/components/top_bar/top_bar.tsx
@@ -149,10 +149,10 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
primaryText={this.props.translate.get(Key.OrderUtils, Deco.CapWords)}
/>
</Link>,
- <Link key="subMenuItem-deployer" to={WebsitePaths.Deployer} className="text-decoration-none">
+ <Link key="subMenuItem-sol-compiler" to={WebsitePaths.SolCompiler} className="text-decoration-none">
<MenuItem
style={{ fontSize: styles.menuItem.fontSize }}
- primaryText={this.props.translate.get(Key.Deployer, Deco.CapWords)}
+ primaryText={this.props.translate.get(Key.SolCompiler, Deco.CapWords)}
/>
</Link>,
<Link key="subMenuItem-sol-cov" to={WebsitePaths.SolCov} className="text-decoration-none">
@@ -328,10 +328,10 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
</MenuItem>
</Link>
)}
- {!this._isViewingDeployerDocs() && (
- <Link to={WebsitePaths.Deployer} className="text-decoration-none">
+ {!this._isViewingSolCompilerDocs() && (
+ <Link to={WebsitePaths.SolCompiler} className="text-decoration-none">
<MenuItem className="py2">
- {this.props.translate.get(Key.Deployer, Deco.Cap)}{' '}
+ {this.props.translate.get(Key.SolCompiler, Deco.Cap)}{' '}
{this.props.translate.get(Key.Docs, Deco.Cap)}
</MenuItem>
</Link>
@@ -390,7 +390,7 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
(!this._isViewing0xjsDocs() &&
!this._isViewingSmartContractsDocs() &&
!this._isViewingWeb3WrapperDocs() &&
- !this._isViewingDeployerDocs() &&
+ !this._isViewingSolCompilerDocs() &&
!this._isViewingJsonSchemasDocs() &&
!this._isViewingSolCovDocs() &&
!this._isViewingSubprovidersDocs() &&
@@ -476,8 +476,8 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
_.includes(this.props.location.pathname, WebsiteLegacyPaths.Web3Wrapper)
);
}
- private _isViewingDeployerDocs() {
- return _.includes(this.props.location.pathname, WebsitePaths.Deployer);
+ private _isViewingSolCompilerDocs() {
+ return _.includes(this.props.location.pathname, WebsitePaths.SolCompiler);
}
private _isViewingJsonSchemasDocs() {
return _.includes(this.props.location.pathname, WebsitePaths.JSONSchemas);
@@ -498,7 +498,7 @@ export class TopBar extends React.Component<TopBarProps, TopBarState> {
this._isViewingFAQ() ||
this._isViewingSmartContractsDocs() ||
this._isViewingWeb3WrapperDocs() ||
- this._isViewingDeployerDocs() ||
+ this._isViewingSolCompilerDocs() ||
this._isViewingJsonSchemasDocs() ||
this._isViewingSolCovDocs() ||
this._isViewingSubprovidersDocs() ||
diff --git a/packages/website/ts/components/wallet/wallet.tsx b/packages/website/ts/components/wallet/wallet.tsx
index a28012aaf..079c0e3b3 100644
--- a/packages/website/ts/components/wallet/wallet.tsx
+++ b/packages/website/ts/components/wallet/wallet.tsx
@@ -9,8 +9,11 @@ import {
import { BigNumber } from '@0xproject/utils';
import * as _ from 'lodash';
import FlatButton from 'material-ui/FlatButton';
+import FloatingActionButton from 'material-ui/FloatingActionButton';
import { List, ListItem } from 'material-ui/List';
import ActionAccountBalanceWallet from 'material-ui/svg-icons/action/account-balance-wallet';
+import ContentAdd from 'material-ui/svg-icons/content/add';
+import ContentRemove from 'material-ui/svg-icons/content/remove';
import NavigationArrowDownward from 'material-ui/svg-icons/navigation/arrow-downward';
import NavigationArrowUpward from 'material-ui/svg-icons/navigation/arrow-upward';
import Close from 'material-ui/svg-icons/navigation/close';
@@ -56,6 +59,7 @@ export interface WalletProps {
providerType: ProviderType;
onToggleLedgerDialog: () => void;
onAddToken: () => void;
+ onRemoveToken: () => void;
}
interface WalletState {
@@ -138,6 +142,7 @@ const ZRX_TOKEN_SYMBOL = 'ZRX';
const ETHER_SYMBOL = 'ETH';
const ICON_DIMENSION = 24;
const TOKEN_AMOUNT_DISPLAY_PRECISION = 3;
+const BODY_ITEM_KEY = 'BODY';
const HEADER_ITEM_KEY = 'HEADER';
const FOOTER_ITEM_KEY = 'FOOTER';
const DISCONNECTED_ITEM_KEY = 'DISCONNECTED';
@@ -248,7 +253,7 @@ export class Wallet extends React.Component<WalletProps, WalletState> {
};
return (
<ListItem
- key="body"
+ key={BODY_ITEM_KEY}
innerDivStyle={bodyStyle}
onMouseEnter={this._onSidebarHover.bind(this)}
onMouseLeave={this._onSidebarHoverOff.bind(this)}
@@ -269,13 +274,31 @@ export class Wallet extends React.Component<WalletProps, WalletState> {
});
}
private _renderFooterRows() {
- const primaryText = '+ other tokens';
return (
<ListItem
key={FOOTER_ITEM_KEY}
- primaryText={primaryText}
+ primaryText={
+ <div className="flex">
+ <FloatingActionButton mini={true} zDepth={0} onClick={this.props.onAddToken}>
+ <ContentAdd />
+ </FloatingActionButton>
+ <FloatingActionButton mini={true} zDepth={0} className="px1" onClick={this.props.onRemoveToken}>
+ <ContentRemove />
+ </FloatingActionButton>
+ <div
+ style={{
+ paddingLeft: 10,
+ position: 'relative',
+ top: '50%',
+ transform: 'translateY(33%)',
+ }}
+ >
+ add/remove tokens
+ </div>
+ </div>
+ }
+ disabled={true}
innerDivStyle={styles.footerItemInnerDiv}
- onClick={this.props.onAddToken}
/>
);
}
diff --git a/packages/website/ts/containers/deployer_documentation.ts b/packages/website/ts/containers/sol_compiler_documentation.ts
index e20cc195b..2f6486146 100644
--- a/packages/website/ts/containers/deployer_documentation.ts
+++ b/packages/website/ts/containers/sol_compiler_documentation.ts
@@ -12,9 +12,9 @@ import { constants } from 'ts/utils/constants';
import { Translate } from 'ts/utils/translate';
/* tslint:disable:no-var-requires */
-const IntroMarkdown = require('md/docs/deployer/introduction');
-const InstallationMarkdown = require('md/docs/deployer/installation');
-const UsageMarkdown = require('md/docs/deployer/usage');
+const IntroMarkdown = require('md/docs/sol-compiler/introduction');
+const InstallationMarkdown = require('md/docs/sol-compiler/installation');
+const UsageMarkdown = require('md/docs/sol-compiler/usage');
/* tslint:enable:no-var-requires */
const docSections = {
@@ -22,21 +22,19 @@ const docSections = {
installation: 'installation',
usage: 'usage',
compiler: 'compiler',
- deployer: 'deployer',
types: docConstants.TYPES_SECTION_NAME,
};
const docsInfoConfig: DocsInfoConfig = {
- id: DocPackages.Deployer,
+ id: DocPackages.SolCompiler,
type: SupportedDocJson.TypeDoc,
- displayName: 'Deployer',
+ displayName: 'Solidity Compiler',
packageUrl: 'https://github.com/0xProject/0x-monorepo',
menu: {
introduction: [docSections.introduction],
install: [docSections.installation],
usage: [docSections.usage],
compiler: [docSections.compiler],
- deployer: [docSections.deployer],
types: [docSections.types],
},
sectionNameToMarkdown: {
@@ -45,32 +43,18 @@ const docsInfoConfig: DocsInfoConfig = {
[docSections.usage]: UsageMarkdown,
},
sectionNameToModulePath: {
- [docSections.compiler]: ['"deployer/src/compiler"'],
- [docSections.deployer]: ['"deployer/src/deployer"'],
- [docSections.types]: ['"deployer/src/utils/types"', '"types/src/index"'],
+ [docSections.compiler]: ['"sol-compiler/src/compiler"'],
+ [docSections.types]: ['"sol-compiler/src/utils/types"', '"types/src/index"'],
},
menuSubsectionToVersionWhenIntroduced: {},
sections: docSections,
- visibleConstructors: [docSections.compiler, docSections.deployer],
+ visibleConstructors: [docSections.compiler],
typeConfigs: {
// Note: This needs to be kept in sync with the types exported in index.ts. Unfortunately there is
// currently no way to extract the re-exported types from index.ts via TypeDoc :(
- publicTypes: [
- 'CompilerOptions',
- 'DeployerOptions',
- 'BaseDeployerOptions',
- 'UrlDeployerOptions',
- 'ProviderDeployerOptions',
- 'TxData',
- ],
- typeNameToExternalLink: {
- Web3: constants.URL_WEB3_DOCS,
- BigNumber: constants.URL_BIGNUMBERJS_GITHUB,
- ContractInstance: 'https://github.com/0xProject/web3-typescript-typings/blob/f5bcb96/index.d.ts#L98',
- },
- typeNameToPrefix: {
- ContractInstance: 'Web3',
- },
+ publicTypes: ['CompilerOptions'],
+ typeNameToExternalLink: {},
+ typeNameToPrefix: {},
},
};
const docsInfo = new DocsInfo(docsInfoConfig);
diff --git a/packages/website/ts/containers/subproviders_documentation.ts b/packages/website/ts/containers/subproviders_documentation.ts
index a14d06a3f..2178baea8 100644
--- a/packages/website/ts/containers/subproviders_documentation.ts
+++ b/packages/website/ts/containers/subproviders_documentation.ts
@@ -74,7 +74,7 @@ const docsInfoConfig: DocsInfoConfig = {
[docSections.redundantRPCSubprovider]: ['"subproviders/src/subproviders/redundant_rpc"'],
[docSections.ganacheSubprovider]: ['"subproviders/src/subproviders/ganache"'],
[docSections.nonceTrackerSubprovider]: ['"subproviders/src/subproviders/nonce_tracker"'],
- [docSections.types]: ['"deployer/src/utils/types"', '"types/src/index"', '"subproviders/src/types"'],
+ [docSections.types]: ['"sol-compiler/src/utils/types"', '"types/src/index"', '"subproviders/src/types"'],
},
menuSubsectionToVersionWhenIntroduced: {},
sections: docSections,
diff --git a/packages/website/ts/index.tsx b/packages/website/ts/index.tsx
index 1b1255214..49bcdeaac 100644
--- a/packages/website/ts/index.tsx
+++ b/packages/website/ts/index.tsx
@@ -54,8 +54,8 @@ const LazyConnectDocumentation = createLazyComponent('Documentation', async () =
const LazyWeb3WrapperDocumentation = createLazyComponent('Documentation', async () =>
System.import<any>(/* webpackChunkName: "web3WrapperDocs" */ 'ts/containers/web3_wrapper_documentation'),
);
-const LazyDeployerDocumentation = createLazyComponent('Documentation', async () =>
- System.import<any>(/* webpackChunkName: "deployerDocs" */ 'ts/containers/deployer_documentation'),
+const LazySolCompilerDocumentation = createLazyComponent('Documentation', async () =>
+ System.import<any>(/* webpackChunkName: "solCompilerDocs" */ 'ts/containers/sol_compiler_documentation'),
);
const LazyJSONSchemasDocumentation = createLazyComponent('Documentation', async () =>
System.import<any>(/* webpackChunkName: "jsonSchemasDocs" */ 'ts/containers/json_schemas_documentation'),
@@ -91,7 +91,10 @@ render(
<Route path={WebsitePaths.Wiki} component={Wiki as any} />
<Route path={`${WebsitePaths.ZeroExJs}/:version?`} component={LazyZeroExJSDocumentation} />
<Route path={`${WebsitePaths.Connect}/:version?`} component={LazyConnectDocumentation} />
- <Route path={`${WebsitePaths.Deployer}/:version?`} component={LazyDeployerDocumentation} />
+ <Route
+ path={`${WebsitePaths.SolCompiler}/:version?`}
+ component={LazySolCompilerDocumentation}
+ />
<Route path={`${WebsitePaths.SolCov}/:version?`} component={LazySolCovDocumentation} />
<Route
path={`${WebsitePaths.JSONSchemas}/:version?`}
@@ -123,6 +126,10 @@ render(
path={`${WebsiteLegacyPaths.Web3Wrapper}/:version?`}
component={LazyWeb3WrapperDocumentation}
/>
+ <Route
+ path={`${WebsiteLegacyPaths.Deployer}/:version?`}
+ component={LazySolCompilerDocumentation}
+ />
<Route component={NotFound as any} />
</Switch>
diff --git a/packages/website/ts/pages/documentation/doc_page.tsx b/packages/website/ts/pages/documentation/doc_page.tsx
index 9feb27dac..be8ae02f4 100644
--- a/packages/website/ts/pages/documentation/doc_page.tsx
+++ b/packages/website/ts/pages/documentation/doc_page.tsx
@@ -30,7 +30,7 @@ const docIdToSubpackageName: { [id: string]: string } = {
[DocPackages.Connect]: 'connect',
[DocPackages.SmartContracts]: 'contracts',
[DocPackages.Web3Wrapper]: 'web3-wrapper',
- [DocPackages.Deployer]: 'deployer',
+ [DocPackages.SolCompiler]: 'sol-compiler',
[DocPackages.JSONSchemas]: 'json-schemas',
[DocPackages.SolCov]: 'sol-cov',
[DocPackages.Subproviders]: 'subproviders',
diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts
index 67e4a5d7d..58929a0c6 100644
--- a/packages/website/ts/types.ts
+++ b/packages/website/ts/types.ts
@@ -344,6 +344,7 @@ export enum Docs {
export enum WebsiteLegacyPaths {
ZeroExJs = '/docs/0xjs',
Web3Wrapper = '/docs/web3_wrapper',
+ Deployer = '/docs/deployer',
}
export enum WebsitePaths {
@@ -357,7 +358,7 @@ export enum WebsitePaths {
SmartContracts = '/docs/contracts',
Connect = '/docs/connect',
Web3Wrapper = '/docs/web3-wrapper',
- Deployer = '/docs/deployer',
+ SolCompiler = '/docs/sol-compiler',
JSONSchemas = '/docs/json-schemas',
SolCov = '/docs/sol-cov',
Subproviders = '/docs/subproviders',
@@ -370,7 +371,7 @@ export enum DocPackages {
ZeroExJs = 'ZERO_EX_JS',
SmartContracts = 'SMART_CONTRACTS',
Web3Wrapper = 'WEB3_WRAPPER',
- Deployer = 'DEPLOYER',
+ SolCompiler = 'SOL_COMPILER',
JSONSchemas = 'JSON_SCHEMAS',
SolCov = 'SOL_COV',
Subproviders = 'SUBPROVIDERS',
@@ -423,7 +424,7 @@ export enum Key {
About = 'ABOUT',
Careers = 'CAREERS',
Contact = 'CONTACT',
- Deployer = 'DEPLOYER',
+ SolCompiler = 'SOL_COMPILER',
JsonSchemas = 'JSON_SCHEMAS',
SolCov = 'SOL_COV',
Subproviders = 'SUBPROVIDERS',