mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-09-13 08:04:40 +08:00
Add styling to Subscription tab in prefs
This commit is contained in:
parent
384433a338
commit
2ba9aedfe9
8 changed files with 109 additions and 7 deletions
|
@ -7,7 +7,6 @@ import PreferencesAccountDetails from './preferences-account-details';
|
||||||
|
|
||||||
|
|
||||||
class PreferencesAccounts extends React.Component {
|
class PreferencesAccounts extends React.Component {
|
||||||
|
|
||||||
static displayName = 'PreferencesAccounts';
|
static displayName = 'PreferencesAccounts';
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {shell} from 'electron';
|
import {shell} from 'electron';
|
||||||
|
import {Actions, IdentityStore} from 'nylas-exports';
|
||||||
import {RetinaImg} from 'nylas-component-kit';
|
import {RetinaImg} from 'nylas-component-kit';
|
||||||
import {IdentityStore} from 'nylas-exports';
|
|
||||||
import request from 'request';
|
import request from 'request';
|
||||||
|
|
||||||
class OpenIdentityPageButton extends React.Component {
|
class OpenIdentityPageButton extends React.Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
destination: React.PropTypes.string,
|
destination: React.PropTypes.string,
|
||||||
label: React.PropTypes.string,
|
label: React.PropTypes.string,
|
||||||
|
img: React.PropTypes.string,
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
@ -58,6 +59,14 @@ class OpenIdentityPageButton extends React.Component {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (this.props.img) {
|
||||||
|
return (
|
||||||
|
<div className="btn">
|
||||||
|
<RetinaImg name={this.props.img} mode={RetinaImg.Mode.ContentPreserve} />
|
||||||
|
{this.props.label}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div className="btn" onClick={this._onClick}>{this.props.label}</div>
|
<div className="btn" onClick={this._onClick}>{this.props.label}</div>
|
||||||
);
|
);
|
||||||
|
@ -65,7 +74,6 @@ class OpenIdentityPageButton extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
class PreferencesIdentity extends React.Component {
|
class PreferencesIdentity extends React.Component {
|
||||||
|
|
||||||
static displayName = 'PreferencesIdentity';
|
static displayName = 'PreferencesIdentity';
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -86,20 +94,45 @@ class PreferencesIdentity extends React.Component {
|
||||||
getStateFromStores() {
|
getStateFromStores() {
|
||||||
return {
|
return {
|
||||||
identity: IdentityStore.identity(),
|
identity: IdentityStore.identity(),
|
||||||
|
trialDaysRemaining: IdentityStore.trialDaysRemaining(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const {identity, trialDaysRemaining} = this.state
|
||||||
|
const {firstname, lastname, email} = identity
|
||||||
return (
|
return (
|
||||||
<div className="container-identity">
|
<div className="container-identity">
|
||||||
<div className="identity-content">
|
<div className="id-header">Nylas ID:</div>
|
||||||
{JSON.stringify(this.state.identity)}
|
<div className="identity-content-box">
|
||||||
<OpenIdentityPageButton label="Go to web" destination="/billing" />
|
<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" destination="/billing" />
|
||||||
|
<div className="btn" onClick={() => Actions.logoutNylasIdentity()}>Sign Out</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="row trial-row">
|
||||||
|
<div>There are {trialDaysRemaining} days remaining in your trial of Nylas N1</div>
|
||||||
|
<OpenIdentityPageButton
|
||||||
|
img="ic-upgrade.png"
|
||||||
|
label="Upgrade to Nylas Pro"
|
||||||
|
destination="/billing"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default PreferencesIdentity;
|
export default PreferencesIdentity;
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
@import "ui-variables";
|
||||||
|
|
||||||
|
.container-identity {
|
||||||
|
width: 50%;
|
||||||
|
margin: auto;
|
||||||
|
padding-top: @padding-base-vertical * 2;
|
||||||
|
|
||||||
|
.id-header {
|
||||||
|
color: @text-color-very-subtle;
|
||||||
|
margin-bottom: @padding-base-vertical * 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.identity-content-box {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
color: @text-color-subtle;
|
||||||
|
border-radius: @border-radius-large;
|
||||||
|
border: 1px solid @border-color-primary;
|
||||||
|
background-color: @background-secondary;
|
||||||
|
|
||||||
|
.row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.trial-row {
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: flex-start;
|
||||||
|
border-top: 1px solid @border-color-primary;
|
||||||
|
padding: 20px;
|
||||||
|
padding-left: 137px;
|
||||||
|
&>div:first-child {
|
||||||
|
margin-bottom: @padding-base-vertical * 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-row {
|
||||||
|
padding: 30px;
|
||||||
|
.logo {
|
||||||
|
margin-right: 30px;
|
||||||
|
}
|
||||||
|
.identity-info {
|
||||||
|
line-height: 1.9em;
|
||||||
|
.name {
|
||||||
|
font-size: 1.2em;
|
||||||
|
}
|
||||||
|
.identity-actions {
|
||||||
|
margin-top: @padding-small-vertical + 1;
|
||||||
|
.btn {
|
||||||
|
width: 150px;
|
||||||
|
text-align: center;
|
||||||
|
&+.btn {
|
||||||
|
margin-left: @padding-base-horizontal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -14,6 +14,9 @@ class IdentityStore extends NylasStore {
|
||||||
|
|
||||||
this.URLRoot = "https://billing-staging.nylas.com";
|
this.URLRoot = "https://billing-staging.nylas.com";
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
this._trialDaysRemaining = 14
|
||||||
|
|
||||||
this.listenTo(Actions.setNylasIdentity, this._onSetNylasIdentity);
|
this.listenTo(Actions.setNylasIdentity, this._onSetNylasIdentity);
|
||||||
this.listenTo(Actions.logoutNylasIdentity, this._onLogoutNylasIdentity);
|
this.listenTo(Actions.logoutNylasIdentity, this._onLogoutNylasIdentity);
|
||||||
|
|
||||||
|
@ -35,6 +38,10 @@ class IdentityStore extends NylasStore {
|
||||||
return this._identity;
|
return this._identity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trialDaysRemaining() {
|
||||||
|
return this._trialDaysRemaining;
|
||||||
|
}
|
||||||
|
|
||||||
_onLogoutNylasIdentity = () => {
|
_onLogoutNylasIdentity = () => {
|
||||||
keytar.deletePassword(keytarServiceName, keytarIdentityKey);
|
keytar.deletePassword(keytarServiceName, keytarIdentityKey);
|
||||||
NylasEnv.config.unset(configIdentityKey);
|
NylasEnv.config.unset(configIdentityKey);
|
||||||
|
|
BIN
static/images/preferences/identity/ic-upgrade@2x.png
Normal file
BIN
static/images/preferences/identity/ic-upgrade@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 791 B |
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 7.9 KiB |
Loading…
Add table
Reference in a new issue