Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove a truckload of wasteful CSS #266

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/assets/javascripts/components/add_domain.js.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ var NewDomainTransfer = React.createClass({
<input name="domain[transfer_auth_code]" type="text" className="form-control" />
</FormGroup>
</div>
<div className="modal-footer">
<div className="modal-footer py2 px3">
<button type="button" className={'btn btn-default'} onClick={this.props.onCancel}>
Cancel
</button>
Expand Down Expand Up @@ -122,7 +122,7 @@ var DomainPurchaseApplication = React.createClass({
<input name="domain[name]" type="text" className="form-control" placeholder="example.com" autofocus />
</FormGroup>
</div>
<div className="modal-footer">
<div className="modal-footer py2 px3">
<button type="button" className={'btn btn-default'} onClick={this.props.onCancel}>
Cancel
</button>
Expand Down
31 changes: 31 additions & 0 deletions app/assets/javascripts/components/admin/admin_withholding.js.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
var AdminWithholding = React.createClass({
render() {
return (
<a className="btn btn-warning" onClick={this.handleClick}>
Adjust withholding
</a>
)
},

handleClick() {
var amount = prompt('New withholding amount', this.props.amount_withheld / 100)
if (amount) {
$.ajax({
type: "PATCH",
url: `/admin/withdrawals/${this.props.id}`,
dataType: 'json',
data: {
amount_withheld: amount
},
success: this.amountUpdated
})
}
},

amountUpdated() {
window.location.reload()
return true
}
})

module.exports = window.AdminWithholding = AdminWithholding
3 changes: 3 additions & 0 deletions app/assets/javascripts/components/bounty.js.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ let Bounty = React.createClass({
},

getBounty() {
if (!this.isMounted()) {
return
}
let bounty = BountyStore.getBounty();

this.setState({
Expand Down
184 changes: 89 additions & 95 deletions app/assets/javascripts/components/bounty_breakdown.js.jsx
Original file line number Diff line number Diff line change
@@ -1,106 +1,100 @@
(function() {
var Lightbox = require('./lightbox.js.jsx')
var SimpleBountyOffer = require('./simple_bounty_offer.js.jsx')
var UserStore = require('../stores/user_store')

var BountyBreakdown = React.createClass({
mixins: [React.addons.LinkedStateMixin],

getInitialState: function() {
return {
offers: this.props.offers,
offer: this.props.steps[2],
currentUser: UserStore.getUser()
};
},

render: function() {
return (
<Lightbox>
<div className="p3 border-bottom">
<a className="close" data-dismiss="modal">
<span className="h3" aria-hidden="true">&times;</span>
<span className="sr-only">Close</span>
</a>

<div className="h3 mt0 mb0">
How many coins is this bounty worth?
</div>
'use strict';

var Lightbox = require('./lightbox.js.jsx')
var SimpleBountyOffer = require('./simple_bounty_offer.js.jsx')
var UserStore = require('../stores/user_store')

var BountyBreakdown = React.createClass({
mixins: [React.addons.LinkedStateMixin],

getInitialState: function() {
return {
offers: this.props.offers,
offer: this.props.steps[2],
currentUser: UserStore.getUser()
};
},

render: function() {
return (
<Lightbox>
<div className="p3 border-bottom">
<a className="close" data-dismiss="modal">
<span className="h3" aria-hidden="true">&times;</span>
<span className="sr-only">Close</span>
</a>

<div className="h3 mt0 mb0">
How many coins is this bounty worth?
</div>
</div>

<div style={{ minWidth: '300px' }}>
{this.state.currentUser ? this.renderNewOffer() : null}
</div>
<div style={{ minWidth: '300px' }}>
{this.state.currentUser ? this.renderNewOffer() : null}
</div>

{this.state.currentUser ? this.renderActions() : null}
</Lightbox>
)
},
{this.state.currentUser ? this.renderActions() : null}
</Lightbox>
)
},

componentDidMount: function() {
var modal = $(this.getDOMNode()).modal({ show: true })
modal.on('hidden.bs.modal', this.props.onHidden)
componentDidMount: function() {
var modal = $(this.getDOMNode()).modal({ show: true })
modal.on('hidden.bs.modal', this.props.onHidden)

var product = app.currentAnalyticsProduct();
var product = app.currentAnalyticsProduct();

if (product) {
analytics.track('bounty.valuation.view', { product: app.currentAnalyticsProduct().get('product_slug') });
} else {
analytics.track('bounty.valuation.view');
}
},

renderNewOffer: function() {
return <VoteBountyOffer {...this.props}
onChange={this.handleOfferChanged}
user={this.state.currentUser}
coinsMinted={this.props.product.coins_minted} />;
},

renderActions: function() {
return <div className="p3 border-top clearfix">
<div className="left yellow bold mt0 mb0 h1" style={{ lineHeight: '38px' }}>
<span className="icon icon-app-coin"></span>
{' '}
{numeral(this.state.offer).format('0,0')}
</div>

if (product) {
analytics.track('bounty.valuation.view', { product: app.currentAnalyticsProduct().get('product_slug') });
} else {
analytics.track('bounty.valuation.view');
<button className="btn btn-primary right px4" name="button" type="submit" onClick={this.handleOfferClicked}>Save</button>
</div>
},

handleOfferChanged: function(event) {
this.setState({
offer: event.target.value
})
},

handleOfferClicked: function() {
window.xhr.post(
this.props.offers_url,
{ earnable: this.state.offer },
function(data) {
window.location.reload()
}
},

renderNewOffer: function() {
return VoteBountyOffer(
_.extend({}, this.props, {
onChange: this.handleOfferChanged,
user: this.state.currentUser
})
);
},

renderActions: function() {
return <div className="p3 border-top clearfix">
<div className="left yellow bold mt0 mb0 h1" style={{ lineHeight: '38px' }}>
<span className="icon icon-app-coin"></span>
{' '}
{numeral(this.state.offer).format('0,0')}
</div>
)

<button className="btn btn-primary right px4" name="button" type="submit" onClick={this.handleOfferClicked}>Save</button>
</div>
},

handleOfferChanged: function(event) {
this.setState({
offer: event.target.value
})
},

handleOfferClicked: function() {
window.xhr.post(
this.props.offers_url,
{ earnable: this.state.offer },
function(data) {
window.location.reload()
}
)

return false
},

handleShowDetailsClicked: function() {
this.setState({
showingDetails: !this.state.showingDetails
})

return false
}
});
return false
},

handleShowDetailsClicked: function() {
this.setState({
showingDetails: !this.state.showingDetails
})

if (typeof module !== 'undefined') {
module.exports = BountyBreakdown;
return false
}
});

window.BountyBreakdown = BountyBreakdown;
})();
module.exports = window.BountyBreakdown = BountyBreakdown;
8 changes: 4 additions & 4 deletions app/assets/javascripts/components/bounty_list_item.js.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ var BountyListItem = React.createClass({
<div className="bg-white rounded shadow mb2 js-bounty-list-item visible-hover-wrapper" style={style} data-bounty-id={bounty.id}>
<div className="table mb0">
<div className="table-cell">
<div className="px3 pt3 pb3">
<div className="mt0 mb1 mtn1 h4 fw-500 clickable">
<div className="p3">
<div className="mt0 mb1 mtn1 h4 bold clickable">
{this.renderTitle()}
</div>
<div className="clearfix h6 mt0 mb0 gray-3 mxn1">
Expand Down Expand Up @@ -206,9 +206,9 @@ var BountyListItem = React.createClass({
return (
<a className={classes} href={bounty.url}>
{bounty.title} {' '}
<span className="gray-2 fs4">
<span className="gray-2 h3">
#{bounty.number}
<span className="gray-2 visible-hover fw-200"> posted {moment(bounty.created_at).fromNow()}</span>
<span className="gray-2 visible-hover light"> posted {moment(bounty.created_at).fromNow()}</span>
</span>
</a>
)
Expand Down
4 changes: 3 additions & 1 deletion app/assets/javascripts/components/bounty_valuation.js.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ var BountyValuation = React.createClass({

renderLightbox: function() {
if (this.state.shown) {
return <BountyBreakdown {...this.props} onHidden={this.handleHide} />
return <BountyBreakdown {...this.props}
steps={this.props.product.bounty_valuation_steps}
onHidden={this.handleHide} />
}
},

Expand Down
6 changes: 3 additions & 3 deletions app/assets/javascripts/components/chat_entry.js.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</div>
<div className="activity-body">
<div className="activity-actions">
<ul className="list-inline pull-right omega hidden-xs">
<ul className="list-inline pull-right mb0 hidden-xs">
<li>
<div className="dropdown">
<a href="#" className="dropdown-toggle" data-toggle="dropdown">
Expand All @@ -30,13 +30,13 @@
<ul className="dropdown-menu pull-right text-small" role="menu">
<li role="presentation">
<a href={"#comment-" + this.props.entry.number} role="menuitem">
<i className="icon icon-link dropdown-glyph" />
<i className="icon icon-link mr1" />
Permalink
</a>
</li>
<li role="presentation">
<a className="clickable js-chat-create-wip" role="menuitem">
<i className="icon icon-plus-circled dropdown-glyph" />
<i className="icon icon-plus-circled mr1" />
Create bounty
</a>
</li>
Expand Down
Loading