1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-16 01:23:18 +02:00
onion/js/components/ascribe_settings/settings_container.js

70 lines
2.1 KiB
JavaScript
Raw Normal View History

'use strict';
import React from 'react';
2015-09-18 09:46:37 +02:00
import UserActions from '../../actions/user_actions';
import AccountSettings from './account_settings';
import BitcoinWalletSettings from './bitcoin_wallet_settings';
import APISettings from './api_settings';
2015-11-27 03:24:37 +01:00
import WebhookSettings from './webhook_settings';
2015-09-23 15:41:12 +02:00
import AclProxy from '../acl_proxy';
import { mergeOptions } from '../../utils/general_utils';
import { getLangText } from '../../utils/lang_utils';
import { setDocumentTitle } from '../../utils/dom_utils';
2015-09-23 15:41:12 +02:00
let SettingsContainer = React.createClass({
propTypes: {
children: React.PropTypes.oneOfType([
React.PropTypes.arrayOf(React.PropTypes.element),
React.PropTypes.element
]),
// Provided from AscribeApp
currentUser: React.PropTypes.object.isRequired,
whitelabel: React.PropTypes.object.isRequired,
2015-09-18 09:46:37 +02:00
2016-01-11 16:26:36 +01:00
// Provided from router
location: React.PropTypes.object
2015-09-18 09:46:37 +02:00
},
loadUser(invalidateCache) {
UserActions.fetchCurrentUser(invalidateCache);
2015-09-18 09:46:37 +02:00
},
render() {
const { children, currentUser, whitelabel } = this.props;
setDocumentTitle(getLangText('Account settings'));
if (currentUser.username) {
2015-09-21 10:32:35 +02:00
return (
<div className="settings-container">
<AccountSettings
currentUser={currentUser}
loadUser={this.loadUser}
whitelabel={whitelabel} />
{children}
2015-09-23 15:41:12 +02:00
<AclProxy
aclObject={whitelabel}
2015-09-23 15:41:12 +02:00
aclName="acl_view_settings_api">
<APISettings />
</AclProxy>
2015-11-27 03:24:37 +01:00
<WebhookSettings />
2015-09-23 15:41:12 +02:00
<AclProxy
aclObject={whitelabel}
2015-09-23 15:41:12 +02:00
aclName="acl_view_settings_bitcoin">
<BitcoinWalletSettings />
</AclProxy>
2015-09-21 10:32:35 +02:00
</div>
);
}
return null;
}
});
export default SettingsContainer;