jam-cloud/web/app/assets/javascripts/react-components/StripeConnect.js.jsx.coffee

41 lines
1.2 KiB
CoffeeScript

context = window
rest = context.JK.Rest()
logger = context.JK.logger
UserStore = context.UserStore
@StripeConnect = React.createClass({
getInitialState: () ->
{
clicked:false
}
onStripeConnect: (e) ->
if this.state.clicked
return
e.preventDefault()
this.setState({clicked: true})
StripeActions.connect(this.props.purpose)
render: () ->
if this.props.user?.stripe_auth?
return `<div>You have successfully connected your Stripe account for payments. If you need to make any changes to your Stripe account, please go to the <a href="https://dashboard.stripe.com/" target="_blank">Stripe website</a> and sign in using your Stripe credentials there to make any changes needed.</div>`
if this.state.clicked
imageUrl = '/assets/content/stripe-connect-light-on-dark.png'
else
imageUrl = '/assets/content/stripe-connect-blue-on-dark.png'
`<div>
<label>To be paid, you must connect either a new or existing Stripe account to your JamKazam account. To do so, click the Stripe button.</label>
<button className="stripe-connect" onClick={this.onStripeConnect}><img src={imageUrl} /></button>
</div>`
})