Skip to content

Commit

Permalink
run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieudutour committed Jul 8, 2017
1 parent f9669b3 commit e3923bc
Show file tree
Hide file tree
Showing 13 changed files with 273 additions and 99 deletions.
9 changes: 5 additions & 4 deletions app/src/ui/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1303,17 +1303,18 @@ export class App extends React.Component<IAppProps, IAppState> {
}

if (sketchVersion === null) {
return (
<SketchVersionOutdated dispatcher={this.props.dispatcher} />
)
return <SketchVersionOutdated dispatcher={this.props.dispatcher} />
}

if (semver.satisfies(sketchVersion, '>=43.0.0')) {
return null
}

return (
<SketchVersionOutdated found={sketchVersion} dispatcher={this.props.dispatcher} />
<SketchVersionOutdated
found={sketchVersion}
dispatcher={this.props.dispatcher}
/>
)
}

Expand Down
12 changes: 5 additions & 7 deletions app/src/ui/changes/no-changes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,17 @@ export class NoChanges extends React.Component<INoChangesProps, {}> {
<div className="callout">
<Octicon symbol={OcticonSymbol.ruby} />
<div>Create a new Sketch File</div>
<Button
onClick={this.props.onCreateSketchFile}
>
<Button onClick={this.props.onCreateSketchFile}>
{__DARWIN__ ? 'Create File' : 'create file'}
</Button>
</div>

<div className="callout">
<Octicon symbol={OcticonSymbol.fileDirectory} />
<div>Open this repository in {opener}</div>
<Button
onClick={this.props.onOpenRepository}
>
<div>
Open this repository in {opener}
</div>
<Button onClick={this.props.onOpenRepository}>
Open {opener}
</Button>
</div>
Expand Down
1 change: 0 additions & 1 deletion app/src/ui/changes/sketch-file.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export class SketchFile extends React.Component<
ISketchFileProps,
Readonly<{}>
> {

public render() {
const listItemPadding = 10 * 2
const checkboxWidth = 20
Expand Down
27 changes: 18 additions & 9 deletions app/src/ui/premium-upsell/coupon-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,36 @@ export class CouponInput extends React.Component<
ICouponInputProps,
Readonly<{}>
> {

public render() {
const { couponState, coupon, onValueChanged } = this.props

const couponLabel = (
<span>
Coupon
{couponState && (
{couponState &&
<span>
{' - '}
{couponState === 'loading'
? <Loading />
: couponState.error
? <span><Octicon symbol={OcticonSymbol.circleSlash} /> {couponState.error}</span>
: <span><Octicon symbol={OcticonSymbol.check} /> {couponState.discount}</span>
}
</span>
)}
: couponState.error
? <span>
<Octicon symbol={OcticonSymbol.circleSlash} />{' '}
{couponState.error}
</span>
: <span>
<Octicon symbol={OcticonSymbol.check} />{' '}
{couponState.discount}
</span>}
</span>}
</span>
)

return <TextBox label={couponLabel} value={coupon} onValueChanged={onValueChanged} />
return (
<TextBox
label={couponLabel}
value={coupon}
onValueChanged={onValueChanged}
/>
)
}
}
91 changes: 65 additions & 26 deletions app/src/ui/premium-upsell/premium-upsell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export class PremiumUpsell extends React.Component<
IPremiumUpsellProps,
IPremiumUpsellState
> {

private scheduler = new ThrottledScheduler(200)

private requestId = 0
Expand All @@ -45,7 +44,7 @@ export class PremiumUpsell extends React.Component<
loadingCheckout: false,
coupon: '',
plan: 'kactus-1-month',
couponState: null
couponState: null,
}
}

Expand Down Expand Up @@ -79,7 +78,7 @@ export class PremiumUpsell extends React.Component<
this.props.dispatcher.unlockKactus(this.props.user, token.id, {
email: token.email,
enterprise: this.props.enterprise,
coupon: this.state.coupon !== '' ? this.state.coupon : undefined
coupon: this.state.coupon !== '' ? this.state.coupon : undefined,
})
}

Expand All @@ -88,21 +87,23 @@ export class PremiumUpsell extends React.Component<
this.scheduler.clear()
return this.setState({
coupon,
couponState: null
couponState: null,
})
}

this.setState({
coupon,
couponState: 'loading'
couponState: 'loading',
})

this.scheduler.queue(async () => {
this.requestId += 1
const couponState = await fetchCoupon(coupon, this.requestId)
if (couponState.requestId !== this.requestId) { return }
if (couponState.requestId !== this.requestId) {
return
}
this.setState({
couponState
couponState,
})
})
}
Expand Down Expand Up @@ -141,31 +142,59 @@ export class PremiumUpsell extends React.Component<
}

const copy = this.props.enterprise
? (
<div>
<p>Hey! This feature is only available in the enterprise version of Kactus.</p>
? <div>
<p>
Hey! This feature is only available in the enterprise version of
Kactus.
</p>
<ul>
<li>Unlimited public repositories</li>
<li>No locked-in commitment: you can always generate the sketch files to switch back</li>
<li><strong>Unlimited private repositories</strong></li>
<li><strong>Support single sign-on and on-premises deployment</strong></li>
<li>
No locked-in commitment: you can always generate the sketch files
to switch back
</li>
<li>
<strong>Unlimited private repositories</strong>
</li>
<li>
<strong>Support single sign-on and on-premises deployment</strong>
</li>
</ul>
<p>More information available <LinkButton onClick={this.onExternalLink}>here</LinkButton>.</p>
<CouponInput couponState={couponState} coupon={coupon} onValueChanged={this.onCouponChange} />
<p>
More information available{' '}
<LinkButton onClick={this.onExternalLink}>here</LinkButton>.
</p>
<CouponInput
couponState={couponState}
coupon={coupon}
onValueChanged={this.onCouponChange}
/>
</div>
)
: (
<div>
<p>Hey! This feature is only available in the full access version of Kactus.</p>
: <div>
<p>
Hey! This feature is only available in the full access version of
Kactus.
</p>
<ul>
<li>Unlimited public repositories</li>
<li>No locked-in commitment: you can always generate the sketch files to switch back</li>
<li><strong>Unlimited private repositories</strong></li>
<li>
No locked-in commitment: you can always generate the sketch files
to switch back
</li>
<li>
<strong>Unlimited private repositories</strong>
</li>
</ul>
<p>More information available <LinkButton onClick={this.onExternalLink}>here</LinkButton>.</p>
<CouponInput couponState={couponState} coupon={coupon} onValueChanged={this.onCouponChange} />
<p>
More information available{' '}
<LinkButton onClick={this.onExternalLink}>here</LinkButton>.
</p>
<CouponInput
couponState={couponState}
coupon={coupon}
onValueChanged={this.onCouponChange}
/>
</div>
)

return (
<div>
Expand All @@ -185,11 +214,21 @@ export class PremiumUpsell extends React.Component<
onDismissed={this.props.onDismissed}
loading={loadingCheckout}
>
<DialogContent>{copy}</DialogContent>
<DialogContent>
{copy}
</DialogContent>

<DialogFooter>
<ButtonGroup>
<Button type="submit" disabled={couponState === 'loading' || (couponState !== null && !!couponState.error)}>Unlock (${this.props.enterprise ? '11.99' : '4.99'}/month)</Button>
<Button
type="submit"
disabled={
couponState === 'loading' ||
(couponState !== null && !!couponState.error)
}
>
Unlock (${this.props.enterprise ? '11.99' : '4.99'}/month)
</Button>
<Button onClick={this.props.onDismissed}>Not now</Button>
</ButtonGroup>
</DialogFooter>
Expand Down
4 changes: 3 additions & 1 deletion app/src/ui/repository-settings/repository-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,9 @@ export class RepositorySettings extends React.Component<
}

private onShowKactusDoc = () => {
this.props.dispatcher.openInBrowser('http://kactus.io/help/#kactus-dot-json')
this.props.dispatcher.openInBrowser(
'http://kactus.io/help/#kactus-dot-json'
)
}

private onSubmit = async () => {
Expand Down
9 changes: 7 additions & 2 deletions app/src/ui/repository.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { TabBar } from './tab-bar'
import {
IRepositoryState as IRepositoryModelState,
RepositorySection,
PopupType
PopupType,
} from '../lib/app-state'
import { Dispatcher, IssuesStore, GitHubUserStore } from '../lib/dispatcher'
import { assertNever } from '../lib/fatal-error'
Expand Down Expand Up @@ -168,7 +168,12 @@ export class RepositoryView extends React.Component<IRepositoryProps, {}> {
!selectedSketchFile &&
(!changesState.workingDirectory.files.length || !selectedFile || !diff)
) {
return <NoChanges onOpenRepository={this.openRepository} onCreateSketchFile={this.handleCreateSketchFile} />
return (
<NoChanges
onOpenRepository={this.openRepository}
onCreateSketchFile={this.handleCreateSketchFile}
/>
)
} else {
return (
<Changes
Expand Down
41 changes: 22 additions & 19 deletions app/src/ui/terms-and-conditions/terms-and-conditions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ interface ITermsAndConditionsProps {

const contact = 'http://kactus.io/contact'
const logos = 'http://kactus.io/logos'
const privacyStatement =
'http://kactus.io/privacy-statement/'
const privacyStatement = 'http://kactus.io/privacy-statement/'
const license = 'https://creativecommons.org/licenses/by/4.0/'

export class TermsAndConditions extends React.Component<
Expand Down Expand Up @@ -48,20 +47,19 @@ export class TermsAndConditions extends React.Component<
public render() {
return (
<Dialog
id='terms-and-conditions'
title='Kactus Terms and Conditions'
id="terms-and-conditions"
title="Kactus Terms and Conditions"
onSubmit={this.props.onDismissed}
onDismissed={this.props.onDismissed}
>
<DialogContent onRef={this.onDialogContainerRef}>
<p>
These Kactus Terms and Conditions ("Application Terms") are a
legal agreement between you (either as an individual or on behalf
of an entity) and GitHub, Inc. regarding your use of
Kactus and associated documentation ("Software").
These Application Terms apply to the executable code
version of the Software. Source code for the Software is
available separately and free of charge under open
These Kactus Terms and Conditions ("Application Terms") are a legal
agreement between you (either as an individual or on behalf of an
entity) and GitHub, Inc. regarding your use of Kactus and associated
documentation ("Software"). These Application Terms apply to the
executable code version of the Software. Source code for the
Software is available separately and free of charge under open
source software license agreements. If you do not agree to all of
the terms in these Application Terms, do not download, install, use,
or copy the Software.
Expand Down Expand Up @@ -95,8 +93,8 @@ export class TermsAndConditions extends React.Component<
To the extent the terms of the licenses applicable to open source
components require Kactus to make an offer to provide source code in
connection with the Software, such offer is hereby made, and you may
exercise it by contacting Kactus: <LinkButton uri={contact}>
http://kactus.io/contact</LinkButton>.
exercise it by contacting Kactus:{' '}
<LinkButton uri={contact}>{contact}</LinkButton>.
</p>

<p>
Expand All @@ -121,9 +119,9 @@ export class TermsAndConditions extends React.Component<
</p>

<p>
The names Kactus, Kactus.io, and related Kactus logos and/or stylized
names are trademarks of Kactus. You agree not to display or use
these trademarks in any manner without Kactus's prior, written
The names Kactus, Kactus.io, and related Kactus logos and/or
stylized names are trademarks of Kactus. You agree not to display or
use these trademarks in any manner without Kactus's prior, written
permission, except as allowed by Kactus's Logos and Usage Policy:
<LinkButton uri={logos}>logos</LinkButton>.
</p>
Expand All @@ -135,7 +133,9 @@ export class TermsAndConditions extends React.Component<
information the Software collects in the settings panel. If the
Software does collect personal information on Kactus's behalf,
Kactus will process that information in accordance with the
<LinkButton uri={privacyStatement}>Kactus Privacy Statement</LinkButton>.
<LinkButton uri={privacyStatement}>
Kactus Privacy Statement
</LinkButton>.
</p>

<h2>Additional Services</h2>
Expand Down Expand Up @@ -237,8 +237,11 @@ export class TermsAndConditions extends React.Component<

<li>
License to Kactus Policies. These Application Terms are licensed
under the <LinkButton uri={license}>Creative Commons Attribution license</LinkButton>.
You may use it freely under the terms of the Creative Commons license.
under the{' '}
<LinkButton uri={license}>
Creative Commons Attribution license
</LinkButton>. You may use it freely under the terms of the
Creative Commons license.
</li>

<li>
Expand Down
Loading

0 comments on commit e3923bc

Please sign in to comment.