React = require 'react' path = require 'path' {RetinaImg, ConfigPropContainer} = require 'nylas-component-kit' {EdgehillAPI} = require 'nylas-exports' OnboardingActions = require './onboarding-actions' InitialPackagesStore = require './initial-packages-store' RunningPackageInstalls = 0 class InstallButton extends React.Component constructor: (@props) -> @state = installed: NylasEnv.packages.resolvePackagePath(@props.package.name)? installing: false render: => classname = "btn btn-install" classname += " installing" if @state.installing classname += " installed" if @state.installed
_onInstall: => return if @state.installing or @state.installed return unless @props.package.path RunningPackageInstalls += 1 @setState(installing: true) NylasEnv.packages.installPackageFromPath @props.package.path, (err) => RunningPackageInstalls -= 1 @props.onPackageInstaled() @setState({ installing: false installed: NylasEnv.packages.resolvePackagePath(@props.package.name)? }) class InitialPackagesPage extends React.Component @displayName: "InitialPackagesPage" constructor: (@props) -> @state = @getStateFromStores() componentDidMount: => @unlisten = InitialPackagesStore.listen => @setState(@getStateFromStores()) componentWillUnmount: => @unlisten?() getStateFromStores: => packages: InitialPackagesStore.starterPackages error: InitialPackagesStore.lastError render: =>

Explore plugins

Plugins lie at the heart of N1 and give it its powerful features.
Want to enable a few example plugins now? They'll be installed to ~/.nylas

{@_renderError()} {@state.packages.map (item) =>
{item.title}
{item.description}
}
_renderError: => return false unless @state.error
{@state.error.toString()}
_renderStartSpinner: => return false unless @state.waitingToGetStarted
_onPrevPage: => OnboardingActions.moveToPage('initial-preferences') _onPackageInstaled: => if RunningPackageInstalls is 0 and @state.waitingToGetStarted @_onGetStarted() _onGetStarted: => if RunningPackageInstalls > 0 @setState(waitingToGetStarted: true) else require('electron').ipcRenderer.send('account-setup-successful') module.exports = InitialPackagesPage