aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-12-04 04:54:29 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-12-04 04:54:29 +0800
commitde1c296d280266d71aeebcfc7050de639536513c (patch)
tree0bddd3efa180e913c341caa71a9a8b27543597d7 /packages
parenta192b309f339f451d647f4b9f71eac2d6684f738 (diff)
downloaddexon-sol-tools-de1c296d280266d71aeebcfc7050de639536513c.tar
dexon-sol-tools-de1c296d280266d71aeebcfc7050de639536513c.tar.gz
dexon-sol-tools-de1c296d280266d71aeebcfc7050de639536513c.tar.bz2
dexon-sol-tools-de1c296d280266d71aeebcfc7050de639536513c.tar.lz
dexon-sol-tools-de1c296d280266d71aeebcfc7050de639536513c.tar.xz
dexon-sol-tools-de1c296d280266d71aeebcfc7050de639536513c.tar.zst
dexon-sol-tools-de1c296d280266d71aeebcfc7050de639536513c.zip
feat: add fee percentage slier
Diffstat (limited to 'packages')
-rw-r--r--packages/website/ts/pages/instant/config_generator.tsx28
-rw-r--r--packages/website/ts/pages/instant/config_generator_address_input.tsx2
-rw-r--r--packages/website/ts/pages/instant/configurator.tsx2
3 files changed, 30 insertions, 2 deletions
diff --git a/packages/website/ts/pages/instant/config_generator.tsx b/packages/website/ts/pages/instant/config_generator.tsx
index 9c3161dcc..8b56834ea 100644
--- a/packages/website/ts/pages/instant/config_generator.tsx
+++ b/packages/website/ts/pages/instant/config_generator.tsx
@@ -3,6 +3,7 @@ import { getContractAddressesForNetworkOrThrow } from '@0x/contract-addresses';
import { assetDataUtils } from '@0x/order-utils';
import { ObjectMap } from '@0x/types';
import * as _ from 'lodash';
+import Slider from 'material-ui/Slider';
import * as React from 'react';
import { CheckMark } from 'ts/components/ui/check_mark';
@@ -65,6 +66,19 @@ export class ConfigGenerator extends React.Component<ConfigGeneratorProps, Confi
onChange={this._handleAffiliateAddressChange}
/>
</ConfigGeneratorSection>
+ <ConfigGeneratorSection
+ title="Fee percentage"
+ actionText="Learn more"
+ onActionTextClick={this._handleAffiliatePercentageLearnMoreClick}
+ >
+ <Slider
+ min={0}
+ max={0.05}
+ step={0.0025}
+ value={value.affiliateInfo.feePercentage}
+ onChange={this._handleAffiliatePercentageChange}
+ />
+ </ConfigGeneratorSection>
</Container>
);
}
@@ -91,6 +105,9 @@ export class ConfigGenerator extends React.Component<ConfigGeneratorProps, Confi
private readonly _getAllKnownAssetDatas = (): string[] => {
return _.map(this.state.allKnownTokens, token => assetDataUtils.encodeERC20AssetData(token.address));
};
+ private readonly _handleAffiliatePercentageLearnMoreClick = (): void => {
+ window.open('/wiki#Learn-About-Affiliate-Fees', '_blank');
+ };
private readonly _handleSRASelection = (sraEndpoint: string) => {
const newConfig: ZeroExInstantBaseConfig = {
...this.props.value,
@@ -109,6 +126,17 @@ export class ConfigGenerator extends React.Component<ConfigGeneratorProps, Confi
};
this.props.onConfigChange(newConfig);
};
+ private readonly _handleAffiliatePercentageChange = (event: any, value: number) => {
+ const oldConfig: ZeroExInstantBaseConfig = this.props.value;
+ const newConfig: ZeroExInstantBaseConfig = {
+ ...oldConfig,
+ affiliateInfo: {
+ feeRecipient: oldConfig.affiliateInfo.feeRecipient,
+ feePercentage: value,
+ },
+ };
+ this.props.onConfigChange(newConfig);
+ };
private readonly _handleSelectAllClick = () => {
const newConfig: ZeroExInstantBaseConfig = {
...this.props.value,
diff --git a/packages/website/ts/pages/instant/config_generator_address_input.tsx b/packages/website/ts/pages/instant/config_generator_address_input.tsx
index dbda547cd..de2640f48 100644
--- a/packages/website/ts/pages/instant/config_generator_address_input.tsx
+++ b/packages/website/ts/pages/instant/config_generator_address_input.tsx
@@ -48,7 +48,7 @@ export class ConfigGeneratorAddressInput extends React.Component<
);
}
- private _handleChange = (event: React.ChangeEvent<HTMLInputElement>): void => {
+ private readonly _handleChange = (event: React.ChangeEvent<HTMLInputElement>): void => {
const address = event.target.value;
const isValidAddress = addressUtils.isAddress(address.toLowerCase()) || address === '';
const errMsg = isValidAddress ? '' : 'Please enter a valid Ethereum address';
diff --git a/packages/website/ts/pages/instant/configurator.tsx b/packages/website/ts/pages/instant/configurator.tsx
index e72f07a70..0ce1d9810 100644
--- a/packages/website/ts/pages/instant/configurator.tsx
+++ b/packages/website/ts/pages/instant/configurator.tsx
@@ -25,7 +25,7 @@ export class Configurator extends React.Component<ConfiguratorProps> {
availableAssetDatas: [],
affiliateInfo: {
feeRecipient: '',
- feePercentage: 0.1,
+ feePercentage: 0.01,
},
},
};