Skip to content

Commit

Permalink
Merge pull request #30 from hunterjm/develop
Browse files Browse the repository at this point in the history
v0.1.1
  • Loading branch information
hunterjm authored Jan 20, 2017
2 parents 31dbc1e + 20c4294 commit 93225d2
Show file tree
Hide file tree
Showing 17 changed files with 320 additions and 143 deletions.
4 changes: 2 additions & 2 deletions app/actions/bid.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ export function logSold() {
sold: i.currentBid,
soldAt: Date.now()
}));
dispatch(addMessage('success', `Sold ${trackedPlayer.name} for ${i.itemData.currentBid}!`));
dispatch(addMessage('success', `Sold ${trackedPlayer.name} for ${i.currentBid}!`));
}
try {
await api.removeFromTradepile(i.tradeId);
Expand Down Expand Up @@ -462,7 +462,7 @@ export function continueTracking(settings) {
dispatch(addMessage('success', `BIDDING WAR: Increased bid to ${newBid} on ${trackedPlayer.name}`));
} else {
// TODO: do something about this
dispatch(addMessage('warn', `Something happened when trying to bid on ${tradeResult.tradeId}`));
dispatch(addMessage('warn', `Something happened when trying to increase bid on ${trackedPlayer.name}`));
}
} else {
dispatch(addMessage('warn', `We do not have enough credits to continue bidding! Min Credit Limit: ${settings.minCredits}`));
Expand Down
16 changes: 9 additions & 7 deletions app/actions/logic/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,15 @@ export function bidCycle() {

state = getState();
if (state.bid.bidding) {
// Update watched items and trades
await dispatch(bidActions.getWatchlist(state.account.email));
state = getState(); // need to refresh state to get latest watchlist
dispatch(bidActions.setTrades(_.keyBy(state.bid.watchlist, 'tradeId')));

// Perform watchlist tracking
await dispatch(bidActions.continueTracking(settings));
if (!settings.snipeOnly) {
// Update watched items and trades
await dispatch(bidActions.getWatchlist(state.account.email));
state = getState(); // need to refresh state to get latest watchlist
dispatch(bidActions.setTrades(_.keyBy(state.bid.watchlist, 'tradeId')));

// Perform watchlist tracking
await dispatch(bidActions.continueTracking(settings));
}

// buy now goes directly to unassigned now
await dispatch(bidActions.binNowToUnassigned());
Expand Down
238 changes: 124 additions & 114 deletions app/components/Settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,123 +79,133 @@ export class Settings extends Component {
<div className="preferences">
<div className="preferences-content">
<div className="title">Global Settings</div>
<div className="option">
<div className="option-name">
<label htmlFor="rpm">RPM</label>
<p><small>Requests Per Minute</small></p>
</div>
<div className="option-value">
<input
ref={rpmInput => (this.rpmInput = rpmInput)} maxLength="3" name="rpm" placeholder="RPM"
value={rpm || ''} type="text" onChange={this.handleChange.bind(this)} onBlur={this.handleBlur.bind(this)}
/>
<p className="error-message">{this.state.errors.rpm}</p>
</div>
</div>
<div className="option">
<div className="option-name">
<label htmlFor="minCredits">Min Credits</label>
<p><small>Will attempt to not go under this value</small></p>
</div>
<div className="option-value">
<input
ref={minCreditsInput => (this.minCreditsInput = minCreditsInput)} name="minCredits" placeholder="Min Credits"
value={minCredits || ''} type="text" onChange={this.handleChange.bind(this)} onBlur={this.handleBlur.bind(this)}
/>
<p className="error-message">{this.state.errors.minCredits}</p>
</div>
</div>
<div className="option">
<div className="option-name">
<label htmlFor="maxCard">Max Cards</label>
<p><small>Maximum number of individual player cards in transfer list</small></p>
</div>
<div className="option-value">
<input
ref={maxCardInput => (this.maxCardInput = maxCardInput)} maxLength="3" name="maxCard" placeholder="Max Cards"
value={maxCard || ''} type="text" onChange={this.handleChange.bind(this)} onBlur={this.handleBlur.bind(this)}
/>
<p className="error-message">{this.state.errors.maxCard}</p>
</div>
</div>
<div className="option">
<div className="option-name">
<label htmlFor="snipeOnly">BIN Snipe Only</label>
<p><small>Only purchase players for buy it now price, no bidding</small></p>
</div>
<div className="option-value">
<input
ref={snipeOnlyInput => (this.snipeOnlyInput = snipeOnlyInput)} name="snipeOnly"
checked={snipeOnly} type="checkbox" onChange={this.handleChange.bind(this)}
/>
<div className="global">
<div className="option">
<div className="option-name">
<label htmlFor="rpm">RPM</label>
<p><small>Requests Per Minute</small></p>
</div>
<div className="option-value">
<input
ref={rpmInput => (this.rpmInput = rpmInput)} maxLength="3" name="rpm" placeholder="RPM"
value={rpm || ''} type="text" onChange={this.handleChange.bind(this)} onBlur={this.handleBlur.bind(this)}
/>
<p className="error-message">{this.state.errors.rpm}</p>
</div>
</div>
<div className="option">
<div className="option-name">
<label htmlFor="minCredits">Min Credits</label>
<p><small>Will attempt to not go under this value</small></p>
</div>
<div className="option-value">
<input
ref={minCreditsInput => (this.minCreditsInput = minCreditsInput)} name="minCredits" placeholder="Min Credits"
value={minCredits || ''} type="text" onChange={this.handleChange.bind(this)} onBlur={this.handleBlur.bind(this)}
/>
<p className="error-message">{this.state.errors.minCredits}</p>
</div>
</div>
<div className="option">
<div className="option-name">
<label htmlFor="maxCard">Max Cards</label>
<p><small>Maximum number of individual player cards in transfer list</small></p>
</div>
<div className="option-value">
<input
ref={maxCardInput => (this.maxCardInput = maxCardInput)} maxLength="3" name="maxCard" placeholder="Max Cards"
value={maxCard || ''} type="text" onChange={this.handleChange.bind(this)} onBlur={this.handleBlur.bind(this)}
/>
<p className="error-message">{this.state.errors.maxCard}</p>
</div>
</div>
<div className="option">
<div className="option-name">
<label htmlFor="snipeOnly">BIN Snipe Only</label>
<p><small>Only purchase players for buy it now price, no bidding</small></p>
</div>
<div className="option-value">
<input
ref={snipeOnlyInput => (this.snipeOnlyInput = snipeOnlyInput)} name="snipeOnly"
checked={snipeOnly} type="checkbox" onChange={this.handleChange.bind(this)}
/>
</div>
</div>
</div>
<div className="title">Price Settings</div>
<div className="option">
<div className="option-name">
<label htmlFor="autoUpdate">Automatically Update Prices</label>
<p><small>Updates every hour based on lowest listed BIN price</small></p>
</div>
<div className="option-value">
<input
ref={autoUpdateInput => (this.autoUpdateInput = autoUpdateInput)} name="autoUpdate"
checked={autoUpdate} type="checkbox" onChange={this.handleChange.bind(this)}
/>
</div>
</div>
<div className="option">
<div className="option-name">
<label htmlFor="buy">Purchase Price</label>
<p><small>Percentage of lowest listed price you want to buy the player at</small></p>
</div>
<div className="option-value">
<input
ref={buyInput => (this.buyInput = buyInput)} maxLength="3" name="buy" placeholder="Buy"
value={buy} type="text" onChange={this.handleChange.bind(this)} onBlur={this.handleBlur.bind(this)}
/>%
<p className="error-message">{this.state.errors.buy}</p>
</div>
</div>
<div className="option">
<div className="option-name">
<label htmlFor="sell">List Price</label>
<p><small>Percentage of lowest listed price you want to list the player at</small></p>
</div>
<div className="option-value">
<input
ref={sellInput => (this.sellInput = sellInput)} maxLength="3" name="sell" placeholder="Sell"
value={sell} type="text" onChange={this.handleChange.bind(this)} onBlur={this.handleBlur.bind(this)}
/>%
<p className="error-message">{this.state.errors.sell}</p>
</div>
</div>
<div className="option">
<div className="option-name">
<label htmlFor="bin">Listed BIN Price</label>
<p><small>Percentage of lowest listed price you want to set listed BIN at</small></p>
</div>
<div className="option-value">
<input
ref={binInput => (this.binInput = binInput)} maxLength="3" name="bin" placeholder="BIN"
value={bin} type="text" onChange={this.handleChange.bind(this)} onBlur={this.handleBlur.bind(this)}
/>%
<p className="error-message">{this.state.errors.bin}</p>
</div>
</div>
<div className="option">
<div className="option-name">
<label htmlFor="relistAll">Same Relist Price</label>
<p><small>
Relist players at the prices they were bought for if market price changes
<br />
(risks tying up capital that could otherwise be used to make up the difference)
</small></p>
</div>
<div className="option-value">
<input
ref={relistAllInput => (this.relistAllInput = relistAllInput)} name="relistAll"
checked={relistAll} type="checkbox" onChange={this.handleChange.bind(this)}
/>
<div className="price">
<div className="option">
<div className="option-name">
<label htmlFor="autoUpdate">Automatically Update Prices</label>
<p><small>Updates every hour based on lowest listed BIN price</small></p>
</div>
<div className="option-value">
<input
ref={autoUpdateInput => (this.autoUpdateInput = autoUpdateInput)} name="autoUpdate"
checked={autoUpdate} type="checkbox" onChange={this.handleChange.bind(this)}
/>
</div>
</div>
<div className="option">
<div className="option-name">
<label htmlFor="buy">Purchase Price</label>
<p><small>
Percentage of lowest listed price you want to buy the player at
</small></p>
</div>
<div className="option-value">
<input
ref={buyInput => (this.buyInput = buyInput)} maxLength="3" name="buy" placeholder="Buy"
value={buy} type="text" onChange={this.handleChange.bind(this)} onBlur={this.handleBlur.bind(this)}
/>%
<p className="error-message">{this.state.errors.buy}</p>
</div>
</div>
<div className="option">
<div className="option-name">
<label htmlFor="sell">List Price</label>
<p><small>
Percentage of lowest listed price you want to list the player at
</small></p>
</div>
<div className="option-value">
<input
ref={sellInput => (this.sellInput = sellInput)} maxLength="3" name="sell" placeholder="Sell"
value={sell} type="text" onChange={this.handleChange.bind(this)} onBlur={this.handleBlur.bind(this)}
/>%
<p className="error-message">{this.state.errors.sell}</p>
</div>
</div>
<div className="option">
<div className="option-name">
<label htmlFor="bin">Listed BIN Price</label>
<p><small>
Percentage of lowest listed price you want to set listed BIN at
</small></p>
</div>
<div className="option-value">
<input
ref={binInput => (this.binInput = binInput)} maxLength="3" name="bin" placeholder="BIN"
value={bin} type="text" onChange={this.handleChange.bind(this)} onBlur={this.handleBlur.bind(this)}
/>%
<p className="error-message">{this.state.errors.bin}</p>
</div>
</div>
<div className="option">
<div className="option-name">
<label htmlFor="relistAll">Same Relist Price</label>
<p><small>
Relist players at the prices they were bought for if market price changes
<br />
(risks tying up capital that could otherwise be used to make up the difference)
</small></p>
</div>
<div className="option-value">
<input
ref={relistAllInput => (this.relistAllInput = relistAllInput)} name="relistAll"
checked={relistAll} type="checkbox" onChange={this.handleChange.bind(this)}
/>
</div>
</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions app/components/bid/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class Header extends Component {
active: !this.props.router.isActive('/players/logs'),
});
const logsClasses = classNames({
'logs-link': true,
'details-tab': true,
active: this.props.router.isActive('/players/logs'),
});
Expand Down
2 changes: 1 addition & 1 deletion app/components/bid/Overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export class Overview extends Component {
.reduce((p, c) => p + (c.sold - c.bought), 0);

return (
<div className="details">
<div className="details bidding-screen">
<Header
start={this.props.start}
stop={this.props.stop}
Expand Down
2 changes: 1 addition & 1 deletion app/components/player/PlayerDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class PlayerDetails extends Component {

render() {
return (
<div className="details">
<div className="details player-screen">
<Header
player={this.player}
updatePrice={this.updatePrice.bind(this)}
Expand Down
Loading

0 comments on commit 93225d2

Please sign in to comment.