Skip to content

Commit

Permalink
Merge pull request #349 from oraclesorg/remove-commented-code
Browse files Browse the repository at this point in the history
(Refactor) Remove all commented code
  • Loading branch information
vbaranov authored Nov 9, 2017
2 parents 93cd631 + b6b8571 commit ad02363
Show file tree
Hide file tree
Showing 18 changed files with 284 additions and 569 deletions.
85 changes: 37 additions & 48 deletions src/components/Common/CrowdsaleBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,6 @@ export class CrowdsaleBlock extends React.Component {

constructor(props) {
super(props);
//props.onChange.bind(this);
//let oldState = getOldState(props, defaultState)
//this.state = Object.assign({}, oldState)
//let state = props.state
//state.crowdsale[props.num].tier = "Tier " + (this.props.num + 1)
//state.crowdsale[props.num].updatable = "off"
//state.crowdsale[props.num].startTime = state.crowdsale[props.num - 1].endTime;
//state.crowdsale[props.num].endTime = defaultCompanyEndDate(state.crowdsale[props.num].startTime);
//this.setState(newState);
//this.setState(state);
//console.log('333 validations', state.validations)
}

componentDidMount() {
Expand Down Expand Up @@ -50,69 +39,69 @@ export class CrowdsaleBlock extends React.Component {
return (<div key={num.toString()} style={{"marginTop": "40px"}} className="steps-content container">
<div className="hidden">
<div className='input-block-container'>
<InputField
side='left'
type='text'
title={CROWDSALE_SETUP_NAME}
<InputField
side='left'
type='text'
title={CROWDSALE_SETUP_NAME}
value={crowdsale[num].tier}
valid={validations[num].tier}
errorMessage={VALIDATION_MESSAGES.TIER}
valid={validations[num].tier}
errorMessage={VALIDATION_MESSAGES.TIER}
onBlur={() => handleInputBlur('crowdsale', 'tier', num)}
onChange={(e) => onChange(e, 'crowdsale', num, 'tier')}
description={`Name of a tier, e.g. PrePreIco, PreICO, ICO with bonus A, ICO with bonus B, etc. We simplified that and will increment a number after each tier.`}
/>
<InputField
side='right'
type='number'
title={RATE}
value={pricingStrategy[num].rate}
valid={validations[num].rate}
errorMessage={VALIDATION_MESSAGES.RATE}
<InputField
side='right'
type='number'
title={RATE}
value={pricingStrategy[num].rate}
valid={validations[num].rate}
errorMessage={VALIDATION_MESSAGES.RATE}
onBlur={() => handleInputBlur('pricingStrategy', 'rate', num)}
onChange={(e) => onChange(e, 'pricingStrategy', num, 'rate')}
description={`Exchange rate Ethereum to Tokens. If it's 100, then for 1 Ether you can buy 100 tokens`}
/>
</div>
<div className='input-block-container'>
<InputField
side='left'
type='datetime-local'
title={START_TIME}
value={crowdsale[num].startTimeTemp}
valid={validations[num].startTime}
errorMessage={VALIDATION_MESSAGES.START_TIME}
<InputField
side='left'
type='datetime-local'
title={START_TIME}
value={crowdsale[num].startTimeTemp}
valid={validations[num].startTime}
errorMessage={VALIDATION_MESSAGES.START_TIME}
onBlur={() => handleInputBlur('crowdsale', 'startTime', num)}
defaultValue={this.props.state.crowdsale[this.props.num - 1].endTime}
onChange={(e) => onChange(e, 'crowdsale', num, 'startTime')}
description={`Date and time when the tier starts. Can't be in the past from the current moment.`}
/>
<InputField
side='right'
type='datetime-local'
title={END_TIME}
value={crowdsale[num].endTimeTemp}
valid={validations[num].endTime}
errorMessage={VALIDATION_MESSAGES.END_TIME}
<InputField
side='right'
type='datetime-local'
title={END_TIME}
value={crowdsale[num].endTimeTemp}
valid={validations[num].endTime}
errorMessage={VALIDATION_MESSAGES.END_TIME}
onBlur={() => handleInputBlur('crowdsale', 'endTime', num)}
defaultValue={defaultCompanyEndDate(this.props.state.crowdsale[this.props.num - 1].endTime)}
onChange={(e) => onChange(e, 'crowdsale', num, 'endTime')}
description={`Date and time when the tier ends. Can be only in the future.`}
/>
</div>
<div className='input-block-container'>
<InputField
side='left'
type='number'
title={SUPPLY}
value={crowdsale[num].supply}
valid={validations[num].supply}
<InputField
side='left'
type='number'
title={SUPPLY}
value={crowdsale[num].supply}
valid={validations[num].supply}
errorMessage={VALIDATION_MESSAGES.SUPPLY}
onBlur={() => handleInputBlur('crowdsale', 'supply', num)}
onBlur={() => handleInputBlur('crowdsale', 'supply', num)}
onChange={(e) => onChange(e, 'crowdsale', num, 'supply')}
description={`How many tokens will be sold on this tier. Cap of crowdsale equals to sum of supply of all tiers`}
/>
<RadioInputField
side='right'
<RadioInputField
side='right'
title={ALLOWMODIFYING}
items={["on", "off"]}
vals={["on", "off"]}
Expand All @@ -128,4 +117,4 @@ export class CrowdsaleBlock extends React.Component {
{this.props.state.crowdsale[0].whitelistdisabled === "yes"?"":whitelistInputBlock}
</div>)
}
}
}
27 changes: 9 additions & 18 deletions src/components/Common/RadioInputField.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ export class RadioInputField extends React.Component {
constructor(props) {
super(props);
this.state = {
"checked1": props.defaultValue===this.props.vals[0]?true:false,
"checked1": props.defaultValue===this.props.vals[0]?true:false,
"checked2": props.defaultValue===this.props.vals[0]?false:true
}
}

onChange(e) {
console.log(e.target);
this.setState({
"checked1": e.target.value===this.props.vals[0]?true:false,
"checked1": e.target.value===this.props.vals[0]?true:false,
"checked2": e.target.value===this.props.vals[0]?false:true});
this.props.onChange(e);
}
Expand All @@ -23,38 +23,29 @@ export class RadioInputField extends React.Component {
<label className="label">{this.props.title}</label>
<div className="radios-inline">
<label className="radio-inline">
<input
type="radio"
checked={this.state.checked1}
<input
type="radio"
checked={this.state.checked1}
name={this.props.name}
onChange={this.onChange.bind(this)}
value={this.props.vals[0]}
/>
<span className="title">{this.props.items[0]}</span>
</label>
<label className="radio-inline">
<input
type="radio"
checked={this.state.checked2}
<input
type="radio"
checked={this.state.checked2}
name={this.props.name}
onChange={this.onChange.bind(this)}
value={this.props.vals[1]}
/>
<span className="title">{this.props.items[1]}</span>
</label>
</div>
{/*<div className="reserved-tokens-radio-container">
<div className="reserved-tokens-radio-container-item">
<input disabled={this.props.disabled} type='radio' name={this.props.name} className="input-radio" checked={this.state.checked1} value={this.props.vals[0]} onChange={this.onChange.bind(this)}/> {this.props.items[0]}
<span class="radio"></span>
</div>
<div className="reserved-tokens-radio-container-item">
<input disabled={this.props.disabled} type='radio' name={this.props.name} className="input-radio" checked={this.state.checked2} value={this.props.vals[1]} onChange={this.onChange.bind(this)}/> {this.props.items[1]}
</div>
</div>*/}
<p className="description">
{this.props.description}
</p>
</div>)
}
}
}
29 changes: 13 additions & 16 deletions src/components/Common/ReservedTokensInputBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ export class ReservedTokensInputBlock extends React.Component {

constructor(props) {
super(props);
//let oldState = getOldState(props, defaultState)
//console.log('oldState', oldState)
//this.state = Object.assign({}, defaultState, oldState, initialStepTwoValues, intitialStepTwoValidations )


let oldState = getOldState(props, defaultState)
this.state = Object.assign({}, oldState)
}
Expand Down Expand Up @@ -45,7 +42,7 @@ export class ReservedTokensInputBlock extends React.Component {
});
this.setState(state, function() {
state.token.reservedTokensElements.push(
<ReservedTokensItem
<ReservedTokensItem
key={num.toString()}
num={num}
addr={addr}
Expand Down Expand Up @@ -73,30 +70,30 @@ export class ReservedTokensInputBlock extends React.Component {
<div className="reserved-tokens-container">
<div className="reserved-tokens-input-container">
<div className="reserved-tokens-input-container-inner">
<InputField
<InputField
ref={reservedTokensInputAddr => this.reservedTokensInputAddr = reservedTokensInputAddr}
side='reserved-tokens-input-property reserved-tokens-input-property-left'
type='text'
title={ADDRESS}
side='reserved-tokens-input-property reserved-tokens-input-property-left'
type='text'
title={ADDRESS}
value={token.reservedTokensInput.addr}
onChange={(e) => onChange(e, 'token', 0, 'reservedtokens_addr')}
description={`Address where to send reserved tokens.`}
/>
<RadioInputField
side='reserved-tokens-input-property reserved-tokens-input-property-middle'
title={DIMENSION}
<RadioInputField
side='reserved-tokens-input-property reserved-tokens-input-property-middle'
title={DIMENSION}
items={["tokens", "percentage"]}
vals={["tokens", "percentage"]}
defaultValue={token.reservedTokensInput.dim}
name={'reserved-tokens-dim'}
onChange={(e) => onChange(e, 'token', 0, 'reservedtokens_dim')}
description={`Fixed amount or % of crowdsaled tokens. Will be deposited to the account after fintalization of the crowdsale. `}
/>
<InputField
<InputField
ref={reservedTokensInputVal => this.reservedTokensInputVal = reservedTokensInputVal}
side='reserved-tokens-input-property reserved-tokens-input-property-right'
type='number'
title={VALUE}
type='number'
title={VALUE}
value={token.reservedTokensInput.val}
onChange={(e) => onChange(e, 'token', 0, 'reservedtokens_val')}
description={`Value in tokens or percents. Don't forget to press + button for each reserved token.`}
Expand All @@ -110,4 +107,4 @@ export class ReservedTokensInputBlock extends React.Component {
{token.reservedTokensElements}
</div>)
}
}
}
12 changes: 1 addition & 11 deletions src/components/Common/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,4 @@ const networks = {
oraclesTest: 12648430
}

/*
DEMO CONFIG:
export const ICOConfig = {
crowdsaleContractURL: '0xc5a21a3e32d9d614ed46e4b2352670fcb21009ee',
networkID: networks.kovan
};
*/

export const ICOConfig = {

};
export const ICOConfig = {};
7 changes: 1 addition & 6 deletions src/components/Footer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,7 @@ export const Footer = () => (
<a href="https://www.oracles.org" className="social social_oracles"></a>
<a href="https://t.me/oraclesnetwork" className="social social_telegram"></a>
<a href="https://github.com/oraclesorg/" className="social social_github"></a>
{/* <button className="social social_reddit"></button>
<button className="social social_twitter"></button>
<button className="social social_oracles"></button>
<button className="social social_telegram"></button>
<button className="social social_github"></button> */}
</div>
</div>
</footer>
)
)
16 changes: 1 addition & 15 deletions src/components/Home/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,6 @@ export class Home extends Component {
this.state = defaultState
}

componentDidMount() {
//emergency alert
/*setTimeout(() => {
getWeb3((web3) => {
getNetworkVersion(web3, (_networkID) => {
console.log(_networkID);
if (_networkID == 1) {
return noDeploymentOnMainnetAlert();
}
})
})
}, 500);*/
}

render() {
return (
<div>
Expand Down Expand Up @@ -84,4 +70,4 @@ export class Home extends Component {
</div>
);
}
}
}
Loading

0 comments on commit ad02363

Please sign in to comment.