Cleanup unused parts

This commit is contained in:
Fred Carlsen
2019-02-13 21:14:08 +01:00
committed by Jacob Evans
parent 9caa5feff5
commit e5ea65da82
7 changed files with 14 additions and 150 deletions

View File

@@ -1,17 +1,14 @@
import * as _ from 'lodash'; import * as _ from 'lodash';
import * as React from 'react'; import * as React from 'react';
import DocumentTitle from 'react-document-title';
import styled from 'styled-components'; import styled from 'styled-components';
import { constants as sharedConstants } from '@0x/react-shared'; import { constants as sharedConstants } from '@0x/react-shared';
import { BigNumber } from '@0x/utils'; import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper'; import { Web3Wrapper } from '@0x/web3-wrapper';
import { colors } from 'ts/style/colors';
import { constants } from 'ts/utils/constants'; import { constants } from 'ts/utils/constants';
import { AddressTableRow } from 'ts/pages/governance/address_table_row';
import { ChangeEvent } from 'react'; import { ChangeEvent } from 'react';
import { AddressTableRow } from 'ts/pages/governance/address_table_row';
interface AddressTableProps { interface AddressTableProps {
networkId: number; networkId: number;

View File

@@ -244,7 +244,7 @@ export class ConnectForm extends React.Component<Props, State> {
return amount; return amount;
} catch (error) { } catch (error) {
console.log(error); // console.log(error);
return new BigNumber(0); return new BigNumber(0);
} }
} }
@@ -337,7 +337,7 @@ export class ConnectForm extends React.Component<Props, State> {
addressBalances.push(balanceInZrx); addressBalances.push(balanceInZrx);
} }
} catch (err) { } catch (err) {
console.log(err); // console.log(err);
// logUtils.log(`Ledger error: ${JSON.stringify(err)}`); // logUtils.log(`Ledger error: ${JSON.stringify(err)}`);
this.setState({ this.setState({
errors: { errors: {
@@ -467,7 +467,7 @@ export class ConnectForm extends React.Component<Props, State> {
try { try {
await injectedProviderIfExists.enable(); await injectedProviderIfExists.enable();
} catch (err) { } catch (err) {
console.log(err); // console.log(err);
// errorReporter.report(err); // errorReporter.report(err);
} }
} }

View File

@@ -1,6 +1,5 @@
import * as _ from 'lodash'; import * as _ from 'lodash';
import * as React from 'react'; import * as React from 'react';
import DocumentTitle from 'react-document-title';
import styled from 'styled-components'; import styled from 'styled-components';
import { colors } from 'ts/style/colors'; import { colors } from 'ts/style/colors';

View File

@@ -8,8 +8,6 @@ import { Button } from 'ts/components/button';
import { Input } from 'ts/components/modals/input'; import { Input } from 'ts/components/modals/input';
import { Paragraph } from 'ts/components/text'; import { Paragraph } from 'ts/components/text';
import { ChangeEvent } from 'react';
interface InputProps { interface InputProps {
path: string; path: string;
onChangePath?: (selectedPath: string) => void; onChangePath?: (selectedPath: string) => void;

View File

@@ -5,11 +5,10 @@ import styled from 'styled-components';
import { Banner } from 'ts/components/banner'; import { Banner } from 'ts/components/banner';
import { Button } from 'ts/components/button'; import { Button } from 'ts/components/button';
import { Column, FlexWrap, Section, WrapSticky } from 'ts/components/newLayout'; import { Column, FlexWrap, Section } from 'ts/components/newLayout';
import { SiteWrap } from 'ts/components/siteWrap'; import { SiteWrap } from 'ts/components/siteWrap';
import { Heading, Paragraph } from 'ts/components/text'; import { Heading, Paragraph } from 'ts/components/text';
import { ConnectedWalletMark } from 'ts/pages/governance/connected_wallet_mark'; import { Countdown } from 'ts/pages/governance/countdown';
import { Countdown, VoteDeadline } from 'ts/pages/governance/countdown';
import { RatingBar } from 'ts/pages/governance/rating_bar'; import { RatingBar } from 'ts/pages/governance/rating_bar';
import { VoteStats } from 'ts/pages/governance/vote_stats'; import { VoteStats } from 'ts/pages/governance/vote_stats';
@@ -18,7 +17,6 @@ import { ModalVote } from 'ts/pages/governance/modal_vote';
import { colors } from 'ts/style/colors'; import { colors } from 'ts/style/colors';
import { BigNumber } from '@0x/utils'; import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
interface LabelInterface { interface LabelInterface {
[key: number]: string; [key: number]: string;
@@ -143,7 +141,7 @@ export class Governance extends React.Component {
); );
return ( return (
<SiteWrap theme="dark"> <SiteWrap theme="dark">
<DocumentTitle title="Features & Benefits - 0x" /> <DocumentTitle title="Governance Vote - 0x" />
<Section maxWidth="1170px" isFlex={true}> <Section maxWidth="1170px" isFlex={true}>
<Column width="55%" maxWidth="560px"> <Column width="55%" maxWidth="560px">
<Countdown deadline={proposalData.votingDeadline} /> <Countdown deadline={proposalData.votingDeadline} />
@@ -300,10 +298,6 @@ export class Governance extends React.Component {
} }
} }
interface SectionProps {
isNotRelative?: boolean;
}
const SectionWrap = styled.div` const SectionWrap = styled.div`
& + & { & + & {
padding-top: 50px; padding-top: 50px;

View File

@@ -1,5 +1,4 @@
import * as _ from 'lodash'; import * as _ from 'lodash';
import * as moment from 'moment';
import * as React from 'react'; import * as React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
@@ -9,64 +8,27 @@ import { DialogContent, DialogOverlay } from '@reach/dialog';
import '@reach/dialog/styles.css'; import '@reach/dialog/styles.css';
// import { LedgerSubprovider, Web3ProviderEngine } from '@0x/subproviders'; // import { LedgerSubprovider, Web3ProviderEngine } from '@0x/subproviders';
import { getContractAddressesForNetworkOrThrow } from '@0x/contract-addresses';
import { ContractWrappers } from '@0x/contract-wrappers'; import { ContractWrappers } from '@0x/contract-wrappers';
import { BigNumber, signTypedDataUtils } from '@0x/utils'; import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper'; import { Web3Wrapper } from '@0x/web3-wrapper';
import { Button } from 'ts/components/button'; import { Button } from 'ts/components/button';
import { Icon } from 'ts/components/icon'; import { Icon } from 'ts/components/icon';
import { Input, InputWidth } from 'ts/components/modals/input';
import { Heading, Paragraph } from 'ts/components/text'; import { Heading, Paragraph } from 'ts/components/text';
import { GlobalStyle } from 'ts/constants/globalStyle'; import { GlobalStyle } from 'ts/constants/globalStyle';
import { utils } from 'ts/utils/utils';
import { FormEvent } from 'react';
import { ConnectForm, WalletConnectedProps } from 'ts/pages/governance/connect_form'; import { ConnectForm, WalletConnectedProps } from 'ts/pages/governance/connect_form';
import { VoteForm } from 'ts/pages/governance/vote_form'; import { VoteForm } from 'ts/pages/governance/vote_form';
import { signatureUtils } from '0x.js';
import * as ethUtil from 'ethereumjs-util';
import { ECSignature } from '@0x/types';
import { import {
ledgerEthereumBrowserClientFactoryAsync,
LedgerSubprovider, LedgerSubprovider,
MetamaskSubprovider,
RedundantSubprovider,
RPCSubprovider,
SignerSubprovider,
Web3ProviderEngine,
} from '@0x/subproviders'; } from '@0x/subproviders';
import { BlockParam, LogWithDecodedArgs, Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types'; import { Provider } from 'ethereum-types';
import { import {
BlockchainCallErrs,
BlockchainErrs,
ContractInstance,
Fill,
InjectedProvider, InjectedProvider,
InjectedProviderObservable,
InjectedProviderUpdate,
JSONRPCPayload,
Providers,
ProviderType,
Side,
SideToAssetToken,
Token,
TokenByAddress,
} from 'ts/types'; } from 'ts/types';
import { configs } from 'ts/utils/configs'; import { configs } from 'ts/utils/configs';
import { constants } from 'ts/utils/constants'; import { constants } from 'ts/utils/constants';
import FilterSubprovider from 'web3-provider-engine/subproviders/filters';
const providerToName: { [provider: string]: string } = {
[Providers.Metamask]: constants.PROVIDER_NAME_METAMASK,
[Providers.Parity]: constants.PROVIDER_NAME_PARITY_SIGNER,
[Providers.Mist]: constants.PROVIDER_NAME_MIST,
[Providers.CoinbaseWallet]: constants.PROVIDER_NAME_COINBASE_WALLET,
[Providers.Cipher]: constants.PROVIDER_NAME_CIPHER,
};
interface Props { interface Props {
theme?: GlobalStyle; theme?: GlobalStyle;
@@ -165,7 +127,7 @@ export class ModalVote extends React.Component<Props> {
} }
public render(): React.ReactNode { public render(): React.ReactNode {
const { isOpen, onDismiss } = this.props; const { isOpen, onDismiss } = this.props;
const { isSuccessful, errors, votePreference, selectedAddress, currentBalance } = this.state; const { isSuccessful, errors, selectedAddress, currentBalance } = this.state;
const formattedBalance = Web3Wrapper.toUnitAmount(currentBalance, constants.DECIMAL_PLACES_ETH).toFixed(configs.AMOUNT_DISPLAY_PRECSION); const formattedBalance = Web3Wrapper.toUnitAmount(currentBalance, constants.DECIMAL_PLACES_ETH).toFixed(configs.AMOUNT_DISPLAY_PRECSION);
return ( return (
<> <>
@@ -295,37 +257,8 @@ export class ModalVote extends React.Component<Props> {
} }
} }
// Handle errors: {"errors":[{"location":"body","param":"name","msg":"Invalid value"},{"location":"body","param":"email","msg":"Invalid value"}]}
const InputRow = styled.div`
width: 100%;
flex: 0 0 auto;
@media (min-width: 768px) {
display: flex;
justify-content: space-between;
margin-bottom: 30px;
}
`;
const ButtonRow = styled(InputRow)`
@media (max-width: 768px) {
display: flex;
flex-direction: column;
button:nth-child(1) {
order: 2;
}
button:nth-child(2) {
order: 1;
margin-bottom: 10px;
}
}
`;
const ButtonClose = styled.button.attrs({})` const ButtonClose = styled.button.attrs({})`
cursor: pointer; cursor: pointer;
position: absolute; position: absolute;
right: 0; right: 0;
top: 0; top: 0;

View File

@@ -3,7 +3,7 @@ import * as moment from 'moment';
import * as React from 'react'; import * as React from 'react';
import styled from 'styled-components'; import styled from 'styled-components';
import { ChangeEvent } from 'react'; import { ChangeEvent, FormEvent } from 'react';
import { colors } from 'ts/style/colors'; import { colors } from 'ts/style/colors';
@@ -17,13 +17,8 @@ import { BigNumber, signTypedDataUtils } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper'; import { Web3Wrapper } from '@0x/web3-wrapper';
import { Button } from 'ts/components/button'; import { Button } from 'ts/components/button';
import { Icon } from 'ts/components/icon'; import { Input } from 'ts/components/modals/input';
import { Input, InputWidth } from 'ts/components/modals/input';
import { Heading, Paragraph } from 'ts/components/text'; import { Heading, Paragraph } from 'ts/components/text';
import { GlobalStyle } from 'ts/constants/globalStyle';
import { utils } from 'ts/utils/utils';
import { FormEvent } from 'react';
import { PreferenceSelecter } from 'ts/pages/governance/preference_selecter'; import { PreferenceSelecter } from 'ts/pages/governance/preference_selecter';
import { signatureUtils } from '0x.js'; import { signatureUtils } from '0x.js';
@@ -32,34 +27,15 @@ import * as ethUtil from 'ethereumjs-util';
import { ECSignature } from '@0x/types'; import { ECSignature } from '@0x/types';
import { import {
ledgerEthereumBrowserClientFactoryAsync,
LedgerSubprovider, LedgerSubprovider,
MetamaskSubprovider,
RedundantSubprovider,
RPCSubprovider,
SignerSubprovider,
Web3ProviderEngine,
} from '@0x/subproviders'; } from '@0x/subproviders';
import { BlockParam, LogWithDecodedArgs, Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types'; import { Provider } from 'ethereum-types';
import { import {
BlockchainCallErrs,
BlockchainErrs,
ContractInstance,
Fill,
InjectedProvider, InjectedProvider,
InjectedProviderObservable,
InjectedProviderUpdate,
JSONRPCPayload,
Providers, Providers,
ProviderType,
Side,
SideToAssetToken,
Token,
TokenByAddress,
} from 'ts/types'; } from 'ts/types';
import { configs } from 'ts/utils/configs'; import { configs } from 'ts/utils/configs';
import { constants } from 'ts/utils/constants'; import { constants } from 'ts/utils/constants';
import FilterSubprovider from 'web3-provider-engine/subproviders/filters';
const providerToName: { [provider: string]: string } = { const providerToName: { [provider: string]: string } = {
[Providers.Metamask]: constants.PROVIDER_NAME_METAMASK, [Providers.Metamask]: constants.PROVIDER_NAME_METAMASK,
@@ -69,11 +45,6 @@ const providerToName: { [provider: string]: string } = {
[Providers.Cipher]: constants.PROVIDER_NAME_CIPHER, [Providers.Cipher]: constants.PROVIDER_NAME_CIPHER,
}; };
export enum ModalContactType {
General = 'GENERAL',
MarketMaker = 'MARKET_MAKER',
}
export enum VoteValue { export enum VoteValue {
Yes = 'Yes', Yes = 'Yes',
No = 'No', No = 'No',
@@ -365,14 +336,6 @@ const ButtonRow = styled(InputRow)`
} }
`; `;
const ButtonFull = styled(Button)`
width: 100%;
`;
const ButtonHalf = styled(Button)`
width: calc(50% - 15px);
`;
const ButtonDisabled = styled(Button)<{ isDisabled?: boolean; disabled?: boolean }>` const ButtonDisabled = styled(Button)<{ isDisabled?: boolean; disabled?: boolean }>`
background-color: ${props => props.disabled && '#898990'}; background-color: ${props => props.disabled && '#898990'};
opacity: ${props => props.disabled && '0.4'}; opacity: ${props => props.disabled && '0.4'};
@@ -387,23 +350,3 @@ const Form = styled.form<FormProps>`
const PreferenceWrapper = styled.div` const PreferenceWrapper = styled.div`
margin-bottom: 30px; margin-bottom: 30px;
`; `;
const Confirmation = styled.div<FormProps>`
position: absolute;
top: 50%;
text-align: center;
width: 100%;
left: 0;
transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
transition-delay: 0.4s;
padding: 60px 60px;
transform: translateY(-50%);
opacity: ${props => (props.isSuccessful ? `1` : `0`)};
visibility: ${props => (props.isSuccessful ? 'visible' : `hidden`)};
p {
max-width: 492px;
margin-left: auto;
margin-right: auto;
}
`;