1
0
mirror of https://github.com/ascribe/onion.git synced 2025-01-07 04:04:20 +01:00
onion/js/components/ascribe_settings/settings_container.js

65 lines
2.0 KiB
JavaScript
Raw Permalink 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 ApiSettings from './api_settings';
import BitcoinWalletSettings from './bitcoin_wallet_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 withContext from '../context/with_context';
import { whitelabelShape } from '../prop_types';
2015-09-23 15:41:12 +02:00
import { setDocumentTitle } from '../../utils/dom';
import { getLangText } from '../../utils/lang';
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
]),
// Injected through HOCs
isLoggedIn: React.PropTypes.bool.isRequired, // eslint-disable-line react/sort-prop-types
2016-06-08 14:54:05 +02:00
whitelabel: whitelabelShape.isRequired // eslint-disable-line react/sort-prop-types
2015-09-18 09:46:37 +02:00
},
loadUser(invalidateCache) {
UserActions.fetchCurrentUser(invalidateCache);
2015-09-18 09:46:37 +02:00
},
render() {
const { children, isLoggedIn, whitelabel } = this.props;
setDocumentTitle(getLangText('Account settings'));
if (isLoggedIn) {
2015-09-21 10:32:35 +02:00
return (
<div className="settings-container">
<AccountSettings loadUser={this.loadUser} />
{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 />
2015-09-23 15:41:12 +02:00
</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 withContext(SettingsContainer, 'isLoggedIn', 'whitelabel');