React = require 'react' _ = require 'underscore' {Flexbox, RetinaImg, Switch} = require 'nylas-component-kit' PluginsActions = require './plugins-actions' class Package extends React.Component @displayName: 'Package' @propTypes: 'package': React.PropTypes.object.isRequired constructor: (@props) -> render: => actions = [] extras = [] if @props.package.icon icon = else icon = if @props.package.installed if @props.package.category in ['user' ,'dev', 'example'] and not @props.package.theme if @props.package.enabled actions.push Disable else actions.push Enable if @props.package.category is 'user' uninstallButton =
Uninstall
if @props.package.category is 'dev' actions.push
Show...
else if @props.package.installing actions.push
Installing...
else actions.push
Install
{name, description, title} = @props.package if @props.package.newerVersionAvailable extras.push(
A newer version is available: {@props.package.newerVersion}
Update
)
{icon}
{title ? name}
{uninstallButton}
{description}
{actions}
{extras}
_onDisablePackage: => PluginsActions.disablePackage(@props.package) _onEnablePackage: => PluginsActions.enablePackage(@props.package) _onUninstallPackage: => PluginsActions.uninstallPackage(@props.package) _onUpdatePackage: => PluginsActions.updatePackage(@props.package) _onInstallPackage: => PluginsActions.installPackage(@props.package) _onShowPackage: => PluginsActions.showPackage(@props.package) module.exports = Package