React = require 'react' {RetinaImg, Flexbox} = require 'nylas-component-kit' {LaunchServices, SystemStartService, AccountStore} = require 'nylas-exports' ConfigSchemaItem = require './config-schema-item' class DefaultMailClientItem extends React.Component constructor: (@props) -> @state = {} @_services = new LaunchServices() if @_services.available() @_services.isRegisteredForURLScheme 'mailto', (registered) => @setState(defaultClient: registered) render: => return false unless process.platform is 'darwin'
toggleDefaultMailClient: (event) => if @state.defaultClient is true @setState(defaultClient: false) @_services.resetURLScheme('mailto') else @setState(defaultClient: true) @_services.registerForURLScheme('mailto') event.target.blur() class LaunchSystemStartItem extends React.Component constructor: (@props) -> @state = { available: false launchOnStart: false } @_service = new SystemStartService() componentDidMount: -> @_service.checkAvailability().then (available) => @setState {available} return if not available @_service.doesLaunchOnSystemStart().then (launchOnStart) => @setState({launchOnStart}) render: => return false if not @state.available
_toggleLaunchOnStart: (event) => if @state.launchOnStart is true @setState(launchOnStart: false) @_service.dontLaunchOnSystemStart() else @setState(launchOnStart: true) @_service.configureToLaunchOnSystemStart() event.target.blur() class AppearanceModeSwitch extends React.Component @displayName: 'AppearanceModeSwitch' @propTypes: config: React.PropTypes.object.isRequired constructor: (@props) -> @state = { value: @props.config.get('core.workspace.mode') } componentWillReceiveProps: (nextProps) -> @setState({ value: nextProps.config.get('core.workspace.mode') }) render: -> hasChanges = @state.value isnt @props.config.get('core.workspace.mode') applyChangesClass = "btn btn-small" applyChangesClass += " btn-disabled" unless hasChanges
{@_renderModeOptions()}
Apply Changes
_renderModeOptions: -> ['list', 'split'].map (mode) => @setState(value: mode) } /> _onApplyChanges: => @props.config.set('core.workspace.mode', @state.value) class AppearanceModeOption extends React.Component @propTypes: mode: React.PropTypes.string.isRequired active: React.PropTypes.bool onClick: React.PropTypes.func constructor: (@props) -> render: => classname = "appearance-mode" classname += " active" if @props.active label = { 'list': 'Single Panel' 'split': 'Two Panel' }[@props.mode]
{label}
class ThemeSelector extends React.Component constructor: (@props) -> @_themeManager = NylasEnv.themes @state = @_getState() componentDidMount: => @disposable = @_themeManager.onDidChangeActiveThemes => @setState @_getState() componentWillUnmount: -> @disposable.dispose() _getState: => themes: @_themeManager.getLoadedThemes() activeTheme: @_themeManager.getActiveTheme().name _setActiveTheme: (theme) => @setState activeTheme: theme @_themeManager.setActiveTheme theme _onChangeTheme: (event) => value = event.target.value if value is 'install' NylasEnv.commands.dispatch document.body, 'application:install-package' else @_setActiveTheme(value) render: =>
Select theme:
class WorkspaceSection extends React.Component @displayName: 'WorkspaceSection' @propTypes: config: React.PropTypes.object configSchema: React.PropTypes.object render: =>

Workspace

Layout

module.exports = WorkspaceSection