React = require 'react' _ = require 'underscore' SettingsActions = require './settings-actions' class Package extends React.Component @displayName: 'Package' @propTypes: 'package': React.PropTypes.object.isRequired constructor: (@props) -> render: => actions = [] extras = [] if @props.package.installed if @props.package.enabled actions.push
Disable
else actions.push
Enable
if @props.package.category is 'user' actions.push
Uninstall
if @props.package.category is 'dev' actions.push
Show...
else if @props.package.installing actions.push
Installing...
else actions.push
Install
{name, description} = @props.package if @props.package.newerVersionAvailable extras.push(
A newer version is available: {@props.package.newerVersion}
Update
)
{actions}
{name}
{description}
{extras}
_onDisablePackage: => SettingsActions.disablePackage(@props.package) _onEnablePackage: => SettingsActions.enablePackage(@props.package) _onUninstallPackage: => SettingsActions.uninstallPackage(@props.package) _onUpdatePackage: => SettingsActions.updatePackage(@props.package) _onInstallPackage: => SettingsActions.installPackage(@props.package) _onShowPackage: => SettingsActions.showPackage(@props.package) module.exports = Package