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: =>
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