Mailspring/internal_packages/onboarding/lib/page-account-choose.jsx
Jackie Luo 6a628102ba feat(self-hosting): Add onboarding flow for self-hosted sync engine
Summary:
Adds a fun new UI for adding accounts to the sync engine. After creating your sync engine instance, all you have to do is auth your accounts on the command line and then enter the URL/port number in this flow. That pulls all of your accounts from the `/accounts` endpoint, mocks an identity token, and edits your `config.json` properly.

TODO: Update the docs in the repo and revert the PR with the temporary fix.

Test Plan: Tested locally.

Reviewers: bengotow, halla, juan

Reviewed By: halla, juan

Differential Revision: https://phab.nylas.com/D3114
2016-07-21 14:25:30 -07:00

54 lines
1.6 KiB
JavaScript

import React from 'react';
import {RetinaImg} from 'nylas-component-kit';
import OnboardingActions from './onboarding-actions';
import AccountTypes from './account-types';
import SelfHostingConfigPage from './page-self-hosting-config'
export default class AccountChoosePage extends React.Component {
static displayName = "AccountChoosePage";
static propTypes = {
accountInfo: React.PropTypes.object,
}
_renderAccountTypes() {
return AccountTypes.map((accountType) =>
<div
key={accountType.type}
className={`provider ${accountType.type}`}
onClick={() => OnboardingActions.setAccountType(accountType.type)}
>
<div className="icon-container">
<RetinaImg
name={accountType.icon}
mode={RetinaImg.Mode.ContentPreserve}
className="icon"
/>
</div>
<span className="provider-name">{accountType.displayName}</span>
</div>
);
}
render() {
if (NylasEnv.config.get('env', 'custom') ||
NylasEnv.config.get('env', 'local')) {
return (<SelfHostingConfigPage addAccount />)
}
return (
<div className="page account-choose">
<h2>
Connect an email account
</h2>
<div className="cloud-sync-note">
Nylas syncs your mail through the cloud. <a href="https://support.nylas.com/hc/en-us/articles/217518207-Why-does-Nylas-N1-sync-email-via-the-cloud-">Learn More</a>
</div>
<div className="provider-list">
{this._renderAccountTypes()}
</div>
</div>
);
}
}