Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into infura
Browse files Browse the repository at this point in the history
  • Loading branch information
vbaranov committed Apr 26, 2018
2 parents 180c906 + a8a9e1e commit 3158465
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/components/Common/InputField.js
Expand Up @@ -29,7 +29,7 @@ export const InputField = props => {
onPaste={props.onPaste}
/>
<p className="description">{props.description}</p>
{ props.pristine ? <p style={errorStyle}/> : <p style={errorStyle}>{error}</p> }
{ props.pristine ? <p style={errorStyle} className="error"/> : <p style={errorStyle}>{error}</p> }
</div>
);
};
Expand Up @@ -26,6 +26,7 @@ exports[`AddressInput Should render the component 1`] = `
Where the money goes after investors transactions. Immediately after each transaction. We recommend to setup a multisig wallet with hardware based signers.
</p>
<p
className="error"
style={
Object {
"color": "red",
Expand Down
Expand Up @@ -26,6 +26,7 @@ exports[`BigNumberInput Should render the component 1`] = `
Exchange rate Ethereum to Tokens. If it's 100, then for 1 Ether you can buy 100 tokens
</p>
<p
className="error"
style={
Object {
"color": "red",
Expand Down
Expand Up @@ -26,6 +26,7 @@ exports[`NumericInput Should render the component 1`] = `
Refers to how divisible a token can be, from 0 (not at all divisible) to 18 (pretty much continuous).
</p>
<p
className="error"
style={
Object {
"color": "red",
Expand Down
Expand Up @@ -35,6 +35,7 @@ exports[`percentage 1`] = `
Address where to send reserved tokens.
</p>
<p
className="error"
style={
Object {
"color": "red",
Expand Down Expand Up @@ -119,6 +120,7 @@ exports[`percentage 1`] = `
Value in tokens. Don't forget to click + button for each reserved token.
</p>
<p
className="error"
style={
Object {
"color": "red",
Expand Down Expand Up @@ -332,6 +334,7 @@ exports[`tokens 1`] = `
Address where to send reserved tokens.
</p>
<p
className="error"
style={
Object {
"color": "red",
Expand Down Expand Up @@ -416,6 +419,7 @@ exports[`tokens 1`] = `
Value in tokens. Don't forget to click + button for each reserved token.
</p>
<p
className="error"
style={
Object {
"color": "red",
Expand Down
2 changes: 1 addition & 1 deletion src/components/manage/DistributeTokensStep.js
Expand Up @@ -21,7 +21,7 @@ export const DistributeTokensStep = ({ disabled, handleClick }) => (
'button_fill': !disabled
}
)}>
Distribute tokens
Distribute reserved tokens
</span>
</Link>
</div>
Expand Down
Expand Up @@ -29,7 +29,7 @@ exports[`DistributeTokensStep should render the component with active button 1`]
<span
className="button button_fill"
>
Distribute tokens
Distribute reserved tokens
</span>
</a>
</div>
Expand Down Expand Up @@ -65,7 +65,7 @@ exports[`DistributeTokensStep should render the component with disabled button 1
<span
className="button button_disabled"
>
Distribute tokens
Distribute reserved tokens
</span>
</a>
</div>
Expand Down
3 changes: 1 addition & 2 deletions src/components/stepThree/StepThreeForm.js
Expand Up @@ -104,8 +104,7 @@ export const StepThreeForm = ({ handleSubmit, values, invalid, pristine, mutator
component={InputField2}
validate={composeValidators(
isNonNegative(),
isDecimalPlacesNotGreaterThan()(props.decimals),
isLessOrEqualThan('Should be less or equal than the supply of some tier')(props.tierStore.maxSupply)
isDecimalPlacesNotGreaterThan()(props.decimals)
)}
disabled={values.whitelistEnabled === 'yes'}
errorStyle={inputErrorStyle}
Expand Down
Expand Up @@ -330,6 +330,7 @@ exports[`CrowdsaleBlock Should render the component for the first Tier 1`] = `
Exchange rate Ethereum to Tokens. If it's 100, then for 1 Ether you can buy 100 tokens
</p>
<p
className="error"
style={
Object {
"color": "red",
Expand Down Expand Up @@ -797,6 +798,7 @@ exports[`CrowdsaleBlock Should render the component for the second Tier 1`] = `
Exchange rate Ethereum to Tokens. If it's 100, then for 1 Ether you can buy 100 tokens
</p>
<p
className="error"
style={
Object {
"color": "red",
Expand Down Expand Up @@ -1338,6 +1340,7 @@ exports[`CrowdsaleBlock Should render the component for the second Tier with whi
Exchange rate Ethereum to Tokens. If it's 100, then for 1 Ether you can buy 100 tokens
</p>
<p
className="error"
style={
Object {
"color": "red",
Expand Down Expand Up @@ -1553,6 +1556,7 @@ exports[`CrowdsaleBlock Should render the component for the second Tier with whi
Address of a whitelisted account. Whitelists are inherited. E.g., if an account whitelisted on Tier 1 and didn't buy max cap on Tier 1, he can buy on Tier 2, and following tiers.
</p>
<p
className="error"
style={
Object {
"color": "red",
Expand Down Expand Up @@ -1596,6 +1600,7 @@ exports[`CrowdsaleBlock Should render the component for the second Tier with whi
Minimum amount tokens to buy. Not a minimal size of a transaction. If minCap is 1 and user bought 1 token in a previous transaction and buying 0.1 token it will allow him to buy.
</p>
<p
className="error"
style={
Object {
"color": "red",
Expand Down Expand Up @@ -1639,6 +1644,7 @@ exports[`CrowdsaleBlock Should render the component for the second Tier with whi
Maximum is the hard limit.
</p>
<p
className="error"
style={
Object {
"color": "red",
Expand Down
12 changes: 12 additions & 0 deletions src/components/stepThree/index.js
Expand Up @@ -9,6 +9,7 @@ import { inject, observer } from "mobx-react";
import { Loader } from '../Common/Loader'
import { noGasPriceAvailable, warningOnMainnetAlert } from '../../utils/alerts'
import { StepThreeForm } from './StepThreeForm'
import { isLessOrEqualThan } from '../../utils/validations'

const { CROWDSALE_SETUP } = NAVIGATION_STEPS;

Expand Down Expand Up @@ -113,6 +114,17 @@ export class stepThree extends React.Component {
decimals={tokenStore.decimals}
tierStore={tierStore}
generalStore={generalStore}
validate={(values) => {
const errors = {}
const maxSupply = tierStore.maxSupply
const minCap = maxSupply !== 0
? isLessOrEqualThan('Should be less or equal than the supply of some tier')(maxSupply)(values.minCap)
: undefined

if (minCap) errors.minCap = minCap

return errors
}}
/>
<Loader show={this.state.loading}/>
</section>
Expand Down

0 comments on commit 3158465

Please sign in to comment.