Mailspring/internal_packages/preferences/lib/tabs/preferences-identity.jsx
Evan Morikawa 7aefb73ef8 feat(usage): add new feature usage modal
Summary:
This adds the "You've reached max features" modal in N1.

http://g.recordit.co/9O7R0mLlXE.gif

Test Plan:
1. Pull latest nylas/cloud-core and start Billing site:
```
  cd cloud-core
  vagrant up
  vagrant ssh
  cd /vagrant
  bin/setup-up-feature-usage
  bin/launch
```
2. Blow away ~/.nylas-mail (err backup your old one first)
3. Restart N1
4. Before logging in, edit `~/.nylas-mail/config.json`
   - set env to "local"
   - remove `thread-snooze` from the list of `disabledPlugins`
5. `cd /nylas-mail/src/k2` and run `npm start`
6. Restart N1 and create accounts & log in

Reviewers: khamidou, juan, halla

Reviewed By: halla

Differential Revision: https://phab.nylas.com/D3846
2017-02-07 15:46:57 -05:00

74 lines
2.2 KiB
JavaScript

import React from 'react';
import {Actions, IdentityStore} from 'nylas-exports';
import {OpenIdentityPageButton, RetinaImg} from 'nylas-component-kit';
import {shell} from 'electron';
class PreferencesIdentity extends React.Component {
static displayName = 'PreferencesIdentity';
constructor() {
super();
this.state = this.getStateFromStores();
}
componentDidMount() {
this.unsubscribe = IdentityStore.listen(() => {
this.setState(this.getStateFromStores());
});
}
componentWillUnmount() {
this.unsubscribe();
}
getStateFromStores() {
return {
identity: IdentityStore.identity() || {},
};
}
render() {
const {identity} = this.state;
const {firstname, lastname, email} = identity;
const logout = () => Actions.logoutNylasIdentity()
const learnMore = () => shell.openExternal("https://nylas.com/nylas-pro")
return (
<div className="container-identity">
<div className="id-header">
Nylas ID:
</div>
<div className="identity-content-box">
<div className="row info-row">
<div className="logo">
<RetinaImg
name="prefs-identity-nylas-logo.png"
mode={RetinaImg.Mode.ContentPreserve}
/>
</div>
<div className="identity-info">
<div className="name">{firstname} {lastname}</div>
<div className="email">{email}</div>
<div className="identity-actions">
<OpenIdentityPageButton label="Account Details" path="/dashboard" source="Preferences" campaign="Dashboard" />
<OpenIdentityPageButton label="Upgrade to Nylas Pro" path="/dashboard?upgrade_to_pro=true" source="Preferences" campaign="Dashboard" />
<div className="btn" onClick={logout}>Sign Out</div>
</div>
</div>
</div>
<div className="row payment-row">
<div>
You are using Nylas Mail Basic. Upgrade to Nylas Pro to unlock a more powerful email experience.
</div>
<div className="btn" onClick={learnMore}>Learn More about Nylas Pro</div>
</div>
</div>
</div>
);
}
}
export default PreferencesIdentity;