kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Merge branch 'sidebar-features' into 'develop'
SidebarMenu: conditional display of features See merge request soapbox-pub/soapbox-fe!733public-report
commit
5eafa61760
|
@ -19,6 +19,7 @@ import ThemeToggle from '../features/ui/components/theme_toggle_container';
|
||||||
import { fetchOwnAccounts } from 'soapbox/actions/auth';
|
import { fetchOwnAccounts } from 'soapbox/actions/auth';
|
||||||
import { is as ImmutableIs } from 'immutable';
|
import { is as ImmutableIs } from 'immutable';
|
||||||
import { getSoapboxConfig } from 'soapbox/actions/soapbox';
|
import { getSoapboxConfig } from 'soapbox/actions/soapbox';
|
||||||
|
import { getFeatures } from 'soapbox/utils/features';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
followers: { id: 'account.followers', defaultMessage: 'Followers' },
|
followers: { id: 'account.followers', defaultMessage: 'Followers' },
|
||||||
|
@ -53,6 +54,9 @@ const makeMapStateToProps = () => {
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
const me = state.get('me');
|
const me = state.get('me');
|
||||||
|
const instance = state.get('instance');
|
||||||
|
|
||||||
|
const features = getFeatures(instance);
|
||||||
const soapbox = getSoapboxConfig(state);
|
const soapbox = getSoapboxConfig(state);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -61,6 +65,7 @@ const makeMapStateToProps = () => {
|
||||||
donateUrl: state.getIn(['patron', 'instance', 'url']),
|
donateUrl: state.getIn(['patron', 'instance', 'url']),
|
||||||
hasCrypto: typeof soapbox.getIn(['cryptoAddresses', 0, 'ticker']) === 'string',
|
hasCrypto: typeof soapbox.getIn(['cryptoAddresses', 0, 'ticker']) === 'string',
|
||||||
otherAccounts: getOtherAccounts(state),
|
otherAccounts: getOtherAccounts(state),
|
||||||
|
features,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -93,6 +98,7 @@ class SidebarMenu extends ImmutablePureComponent {
|
||||||
otherAccounts: ImmutablePropTypes.list,
|
otherAccounts: ImmutablePropTypes.list,
|
||||||
sidebarOpen: PropTypes.bool,
|
sidebarOpen: PropTypes.bool,
|
||||||
onClose: PropTypes.func.isRequired,
|
onClose: PropTypes.func.isRequired,
|
||||||
|
features: PropTypes.object.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
|
@ -149,7 +155,7 @@ class SidebarMenu extends ImmutablePureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { sidebarOpen, intl, account, onClickLogOut, donateUrl, otherAccounts, hasCrypto } = this.props;
|
const { sidebarOpen, intl, account, onClickLogOut, donateUrl, otherAccounts, hasCrypto, features } = this.props;
|
||||||
const { switcher } = this.state;
|
const { switcher } = this.state;
|
||||||
if (!account) return null;
|
if (!account) return null;
|
||||||
const acct = account.get('acct');
|
const acct = account.get('acct');
|
||||||
|
@ -231,10 +237,10 @@ class SidebarMenu extends ImmutablePureComponent {
|
||||||
<Icon id='ban' />
|
<Icon id='ban' />
|
||||||
<span className='sidebar-menu-item__title'>{intl.formatMessage(messages.blocks)}</span>
|
<span className='sidebar-menu-item__title'>{intl.formatMessage(messages.blocks)}</span>
|
||||||
</NavLink>
|
</NavLink>
|
||||||
<NavLink className='sidebar-menu-item' to='/domain_blocks' onClick={this.handleClose}>
|
{features.federating && <NavLink className='sidebar-menu-item' to='/domain_blocks' onClick={this.handleClose}>
|
||||||
<Icon id='ban' />
|
<Icon id='ban' />
|
||||||
<span className='sidebar-menu-item__title'>{intl.formatMessage(messages.domain_blocks)}</span>
|
<span className='sidebar-menu-item__title'>{intl.formatMessage(messages.domain_blocks)}</span>
|
||||||
</NavLink>
|
</NavLink>}
|
||||||
<NavLink className='sidebar-menu-item' to='/mutes' onClick={this.handleClose}>
|
<NavLink className='sidebar-menu-item' to='/mutes' onClick={this.handleClose}>
|
||||||
<Icon id='times-circle' />
|
<Icon id='times-circle' />
|
||||||
<span className='sidebar-menu-item__title'>{intl.formatMessage(messages.mutes)}</span>
|
<span className='sidebar-menu-item__title'>{intl.formatMessage(messages.mutes)}</span>
|
||||||
|
@ -259,10 +265,10 @@ class SidebarMenu extends ImmutablePureComponent {
|
||||||
<Icon id='cloud-upload' />
|
<Icon id='cloud-upload' />
|
||||||
<span className='sidebar-menu-item__title'>{intl.formatMessage(messages.import_data)}</span>
|
<span className='sidebar-menu-item__title'>{intl.formatMessage(messages.import_data)}</span>
|
||||||
</NavLink>
|
</NavLink>
|
||||||
<NavLink className='sidebar-menu-item' to='/settings/aliases' onClick={this.handleClose}>
|
{(features.federating && features.accountAliasesAPI) && <NavLink className='sidebar-menu-item' to='/settings/aliases' onClick={this.handleClose}>
|
||||||
<Icon id='suitcase' />
|
<Icon id='suitcase' />
|
||||||
<span className='sidebar-menu-item__title'>{intl.formatMessage(messages.account_aliases)}</span>
|
<span className='sidebar-menu-item__title'>{intl.formatMessage(messages.account_aliases)}</span>
|
||||||
</NavLink>
|
</NavLink>}
|
||||||
<NavLink className='sidebar-menu-item' to='/auth/edit' onClick={this.handleClose}>
|
<NavLink className='sidebar-menu-item' to='/auth/edit' onClick={this.handleClose}>
|
||||||
<Icon id='lock' />
|
<Icon id='lock' />
|
||||||
<span className='sidebar-menu-item__title'>{intl.formatMessage(messages.security)}</span>
|
<span className='sidebar-menu-item__title'>{intl.formatMessage(messages.security)}</span>
|
||||||
|
|
Ładowanie…
Reference in New Issue