React = require 'react'
{RetinaImg, Flexbox} = require 'nylas-component-kit'
{LaunchServices, 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: =>
if @state.defaultClient is true
@setState(defaultClient: false)
@_services.resetURLScheme('mailto')
else
@setState(defaultClient: true)
@_services.registerForURLScheme('mailto')
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
class WorkspaceSection extends React.Component
@displayName: 'WorkspaceSection'
@propTypes:
config: React.PropTypes.object
configSchema: React.PropTypes.object
render: =>
module.exports = WorkspaceSection