mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 23:00:30 +00:00
3056921fda
* Support multiline text in form data editors * Some tweaks around rendering and syntax * Embed markdown editor
83 lines
2.3 KiB
JavaScript
83 lines
2.3 KiB
JavaScript
import React, {PureComponent} from 'react';
|
|
import autobind from 'autobind-decorator';
|
|
import * as session from '../../../sync/session';
|
|
import * as sync from '../../../sync/index';
|
|
import Link from '../base/link';
|
|
import LoginModal from '../modals/login-modal';
|
|
import {hideAllModals, showModal} from '../modals/index';
|
|
import PromptButton from '../base/prompt-button';
|
|
|
|
@autobind
|
|
class Account extends PureComponent {
|
|
async _handleLogout () {
|
|
await sync.logout();
|
|
this.forceUpdate();
|
|
}
|
|
|
|
_handleLogin (e) {
|
|
e.preventDefault();
|
|
hideAllModals();
|
|
showModal(LoginModal);
|
|
}
|
|
|
|
renderUpgrade () {
|
|
return (
|
|
<div>
|
|
<div className="notice pad surprise">
|
|
<h1 className="no-margin-top">Try Insomnia Plus!</h1>
|
|
<p>
|
|
🚀 Sync your data across devices or with a team<br/>
|
|
🚀 Keep synced data safe with end-to-end encryption<br/>
|
|
🚀 Access to premium color themes<br/>
|
|
🚀 Prioritized email support<br/>
|
|
</p>
|
|
<br/>
|
|
<div className="pad">
|
|
<Link button
|
|
className="btn btn--clicky"
|
|
href="https://insomnia.rest/plus/">
|
|
Plus for Individuals <i className="fa fa-external-link"/>
|
|
</Link>
|
|
<Link button
|
|
className="margin-left-sm btn btn--clicky"
|
|
href="https://insomnia.rest/teams/">
|
|
Plus for Teams <i className="fa fa-external-link"/>
|
|
</Link>
|
|
</div>
|
|
</div>
|
|
<p>
|
|
Or <a href="#" onClick={this._handleLogin}>Login</a>
|
|
</p>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
renderAccount () {
|
|
return (
|
|
<div>
|
|
<h2 className="no-margin-top">
|
|
Welcome {session.getFirstName()}!
|
|
</h2>
|
|
<p>
|
|
You are currently logged in as
|
|
{' '}
|
|
<code className="code--compact">{session.getEmail()}</code>
|
|
</p>
|
|
<br/>
|
|
<Link button href="https://insomnia.rest/app/" className="btn btn--clicky">
|
|
Manage Account
|
|
</Link>
|
|
<PromptButton className="margin-left-sm btn btn--clicky" onClick={this._handleLogout}>
|
|
Sign Out
|
|
</PromptButton>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
render () {
|
|
return session.isLoggedIn() ? this.renderAccount() : this.renderUpgrade();
|
|
}
|
|
}
|
|
|
|
export default Account;
|