insomnia/app/ui/components/settings/SettingsSync.js

104 lines
3.1 KiB
JavaScript
Raw Normal View History

import React, {PropTypes} from 'react';
import Link from '../base/Link';
import PromptButton from '../base/PromptButton';
import {trackEvent} from '../../../analytics/index';
2016-12-01 23:05:25 +00:00
import {showModal} from '../modals/index';
import PaymentModal from '../modals/PaymentModal';
const SettingsSync = ({
loggedIn,
firstName,
handleExit,
handleUpdateSetting,
handleShowSignup,
handleCancelAccount,
handleLogout,
2016-11-11 01:36:23 +00:00
handleReset,
}) => (
<div>
<h1 className="no-margin-top">Cloud Sync and Backup</h1>
{loggedIn ? [
<p key="1">
Hi {firstName}! Thanks for signing up for Insomnia
Plus.
</p>,
2016-11-11 01:36:23 +00:00
<p key="2" className="pad-top">
<PromptButton
2016-11-26 00:49:38 +00:00
className="btn btn--clicky danger"
onClick={() => {
handleExit();
handleCancelAccount();
}}>
Cancel Subscription
</PromptButton>
{" "}
2016-11-26 00:49:38 +00:00
<PromptButton className="btn btn--clicky warning"
2016-11-11 01:36:23 +00:00
onClick={handleReset}
confirmMessage="Delete all sync-related data?">
Reset Remote Data
</PromptButton>
{" "}
2016-12-01 23:05:25 +00:00
<button className="btn btn--clicky"
onClick={async () => {
handleExit();
showModal(PaymentModal);
}}>
Update Billing
</button>
{" "}
2016-11-26 00:49:38 +00:00
<PromptButton className="btn btn--clicky"
onClick={async () => {
handleExit();
await handleLogout();
}}>
Log Out
</PromptButton>
</p>
] : [
<p key="0">
<Link href="https://insomnia.rest/plus/">Insomnia Plus</Link> helps you <i>rest</i> easy by
keeping your workspaces securely backed up and synced across all of your devices.
</p>,
<p key="1">
Upgrade today to start enjoying
{" "}
<Link href="https://insomnia.rest/pricing/">all of the benefits</Link>, while also helping
2016-12-01 23:05:25 +00:00
support my continuous effort of making Insomnia awesome! <i
className="fa fa-smile-o txt-xl"/>
</p>,
<p key="2" className="pad-top text-center">
<button className="btn txt-lg btn--outlined"
onClick={() => {
handleExit();
trackEvent('Settings Sync', 'Click Upgrade');
handleShowSignup()
}}>
Upgrade to Plus
</button>
</p>,
<p key="3" className="text-center italic">
$5 per month or $50 per year
2016-11-17 18:45:54 +00:00
<br/>
<span className="txt-sm faint pad-top-sm">
2016-11-17 23:22:23 +00:00
14-day trial (cancel at any time)
2016-11-17 18:45:54 +00:00
</span>
</p>
]}
</div>
);
SettingsSync.propTypes = {
loggedIn: PropTypes.bool.isRequired,
firstName: PropTypes.string.isRequired,
handleExit: PropTypes.func.isRequired,
handleUpdateSetting: PropTypes.func.isRequired,
handleShowSignup: PropTypes.func.isRequired,
handleCancelAccount: PropTypes.func.isRequired,
handleLogout: PropTypes.func.isRequired,
2016-11-11 01:36:23 +00:00
handleReset: PropTypes.func.isRequired,
};
export default SettingsSync;