mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-12 04:25:31 +08:00
6e07dce03c
Summary: Adds new redesigned preferences with horizontal tab bar and refactored code. Converts Preferences, Plugins, and a few components to ES6. Test Plan: Tested locally. Reviewers: evan, bengotow Reviewed By: bengotow Subscribers: juan Differential Revision: https://phab.nylas.com/D2818
52 lines
1.3 KiB
JavaScript
52 lines
1.3 KiB
JavaScript
import _ from 'underscore';
|
|
import React from 'react';
|
|
import {AccountStore} from 'nylas-exports';
|
|
import ConfigSchemaItem from './config-schema-item';
|
|
|
|
|
|
class SendingSection extends React.Component {
|
|
|
|
static displayName = 'SendingSection';
|
|
|
|
static propTypes = {
|
|
config: React.PropTypes.object,
|
|
configSchema: React.PropTypes.object,
|
|
}
|
|
|
|
_getExtendedSchema(configSchema) {
|
|
const accounts = AccountStore.accounts();
|
|
|
|
let values = accounts.map((acc) => {return acc.id});
|
|
let labels = accounts.map((acc) => {return acc.me().toString()});
|
|
|
|
values = ['selected-mailbox'].concat(values);
|
|
labels = ['Account of selected mailbox'].concat(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() {
|
|
const sendingSchema = this._getExtendedSchema(this.props.configSchema);
|
|
|
|
return (
|
|
<ConfigSchemaItem
|
|
config={this.props.config}
|
|
configSchema={sendingSchema}
|
|
keyName="Sending"
|
|
keyPath="core.sending" />
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
export default SendingSection;
|