// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import React from 'react';
import * as Utils from 'utils/utils.jsx';
import AdminSettings from './admin_settings.jsx';
import BooleanSetting from './boolean_setting.jsx';
import BrandImageSetting from './brand_image_setting.jsx';
import {FormattedMessage} from 'react-intl';
import SettingsGroup from './settings_group.jsx';
import TextSetting from './text_setting.jsx';
import Constants from 'utils/constants.jsx';
export default class CustomBrandSettings extends AdminSettings {
constructor(props) {
super(props);
this.getConfigFromState = this.getConfigFromState.bind(this);
this.renderSettings = this.renderSettings.bind(this);
}
getConfigFromState(config) {
config.TeamSettings.SiteName = this.state.siteName;
if (global.window.mm_license.IsLicensed === 'true' && global.window.mm_license.CustomBrand === 'true') {
config.TeamSettings.customDescriptionText = this.state.customDescriptionText;
config.TeamSettings.EnableCustomBrand = this.state.enableCustomBrand;
config.TeamSettings.CustomBrandText = this.state.customBrandText;
}
return config;
}
getStateFromConfig(config) {
return {
siteName: config.TeamSettings.SiteName,
enableCustomBrand: config.TeamSettings.EnableCustomBrand,
customBrandText: config.TeamSettings.CustomBrandText,
customDescriptionText: config.TeamSettings.CustomDescriptionText
};
}
renderTitle() {
return (
);
}
renderSettings() {
const enterpriseSettings = [];
if (global.window.mm_license.IsLicensed === 'true' && global.window.mm_license.CustomBrand === 'true') {
enterpriseSettings.push(
}
helpText={
}
value={this.state.customDescriptionText}
placeholder={Utils.localizeMessage('web.root.signup_info', 'All team communication in one place, searchable and accessible anywhere')}
onChange={this.handleChange}
/>
);
enterpriseSettings.push(
}
helpText={
}
value={this.state.enableCustomBrand}
onChange={this.handleChange}
/>
);
enterpriseSettings.push(
);
enterpriseSettings.push(
}
helpText={
}
value={this.state.customBrandText}
onChange={this.handleChange}
disabled={!this.state.enableCustomBrand}
/>
);
}
return (
}
maxLength={Constants.MAX_SITENAME_LENGTH}
placeholder={Utils.localizeMessage('admin.team.siteNameExample', 'Ex "Mattermost"')}
helpText={
}
value={this.state.siteName}
onChange={this.handleChange}
/>
{enterpriseSettings}
);
}
}