mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-12 04:25:31 +08:00
42 lines
1.1 KiB
CoffeeScript
42 lines
1.1 KiB
CoffeeScript
_ = require 'underscore'
|
|
React = require 'react'
|
|
{AccountStore} = require 'nylas-exports'
|
|
ConfigSchemaItem = require './config-schema-item'
|
|
|
|
class SendingSection extends React.Component
|
|
@displayName: 'SendingSection'
|
|
@propTypes:
|
|
config: React.PropTypes.object
|
|
configSchema: React.PropTypes.object
|
|
|
|
_getExtendedSchema: (configSchema) ->
|
|
accounts = AccountStore.accounts()
|
|
|
|
values = accounts.map (acc) -> acc.id
|
|
labels = accounts.map (acc) -> acc.me().toString()
|
|
|
|
values = ['selected-mailbox', values...]
|
|
labels = ['Account of selected mailbox', labels...]
|
|
|
|
_.extend(configSchema.properties.sending.properties, {
|
|
defaultAccountIdForSend:
|
|
type: 'string'
|
|
title: 'Send new messages from'
|
|
default: 'selected-mailbox'
|
|
enum: values
|
|
enumLabels: labels
|
|
})
|
|
|
|
return configSchema.properties.sending
|
|
|
|
render: ->
|
|
sendingSchema = @_getExtendedSchema(@props.configSchema)
|
|
|
|
<ConfigSchemaItem
|
|
config={@props.config}
|
|
configSchema={sendingSchema}
|
|
keyName="Sending"
|
|
keyPath="core.sending" />
|
|
|
|
|
|
module.exports = SendingSection
|