bigbuffet-rw/app/soapbox/features/admin/components/admin_nav.js

99 lines
4.6 KiB
JavaScript
Raw Normal View History

2020-12-29 10:34:23 -08:00
import React from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import ImmutablePropTypes from 'react-immutable-proptypes';
2020-12-29 10:34:23 -08:00
import Icon from 'soapbox/components/icon';
import IconWithCounter from 'soapbox/components/icon_with_counter';
2020-12-29 10:34:23 -08:00
import { NavLink } from 'react-router-dom';
import { FormattedMessage } from 'react-intl';
const mapStateToProps = (state, props) => ({
instance: state.get('instance'),
approvalCount: state.getIn(['admin', 'awaitingApproval']).count(),
2020-12-31 12:29:31 -08:00
reportsCount: state.getIn(['admin', 'openReports']).count(),
});
export default @connect(mapStateToProps)
2020-12-29 10:34:23 -08:00
class AdminNav extends React.PureComponent {
static propTypes = {
instance: ImmutablePropTypes.map.isRequired,
approvalCount: PropTypes.number,
reportsCount: PropTypes.number,
};
2020-12-29 10:34:23 -08:00
render() {
const { instance, approvalCount, reportsCount } = this.props;
2020-12-29 10:34:23 -08:00
return (
2020-12-29 12:16:19 -08:00
<>
<div className='wtf-panel promo-panel'>
<div className='promo-panel__container'>
<NavLink className='promo-panel-item' to='/admin'>
2021-09-27 21:47:43 -07:00
<Icon src={require('@tabler/icons/icons/dashboard.svg')} className='promo-panel-item__icon' />
2020-12-29 12:16:19 -08:00
<FormattedMessage id='admin_nav.dashboard' defaultMessage='Dashboard' />
</NavLink>
2020-12-31 12:41:43 -08:00
<NavLink className='promo-panel-item' to='/admin/reports'>
2021-10-02 08:06:26 -07:00
<IconWithCounter src={require('icons/gavel.svg')} count={reportsCount} />
2020-12-29 12:16:19 -08:00
<FormattedMessage id='admin_nav.reports' defaultMessage='Reports' />
2020-12-31 12:41:43 -08:00
</NavLink>
2020-12-29 21:25:07 -08:00
{((instance.get('registrations') && instance.get('approval_required')) || approvalCount > 0) && (
2020-12-29 13:55:04 -08:00
<NavLink className='promo-panel-item' to='/admin/approval'>
2021-09-27 21:47:43 -07:00
<IconWithCounter src={require('@tabler/icons/icons/user.svg')} count={approvalCount} />
2020-12-29 12:16:19 -08:00
<FormattedMessage id='admin_nav.awaiting_approval' defaultMessage='Awaiting Approval' />
2020-12-29 13:55:04 -08:00
</NavLink>
2020-12-29 12:16:19 -08:00
)}
2020-12-29 21:25:07 -08:00
{/* !instance.get('registrations') && (
<NavLink className='promo-panel-item' to='#'>
<Icon id='envelope' className='promo-panel-item__icon' fixedWidth />
<FormattedMessage id='admin_nav.invites' defaultMessage='Invites' />
2020-12-29 21:25:07 -08:00
</NavLink>
) */}
{/* <NavLink className='promo-panel-item' to='#'>
2020-12-29 12:16:19 -08:00
<Icon id='group' className='promo-panel-item__icon' fixedWidth />
<FormattedMessage id='admin_nav.registration' defaultMessage='Registration' />
</NavLink> */}
2020-12-29 12:16:19 -08:00
</div>
2020-12-29 10:34:23 -08:00
</div>
{/* <div className='wtf-panel promo-panel'>
2020-12-29 12:16:19 -08:00
<div className='promo-panel__container'>
<NavLink className='promo-panel-item' to='#'>
<Icon id='info-circle' className='promo-panel-item__icon' fixedWidth />
<FormattedMessage id='admin_nav.site_profile' defaultMessage='Site Profile' />
</NavLink>
<NavLink className='promo-panel-item' to='#'>
<Icon id='paint-brush' className='promo-panel-item__icon' fixedWidth />
<FormattedMessage id='admin_nav.branding' defaultMessage='Branding' />
</NavLink>
<NavLink className='promo-panel-item' to='#'>
<Icon id='bars' className='promo-panel-item__icon' fixedWidth />
<FormattedMessage id='admin_nav.menus' defaultMessage='Menus' />
</NavLink>
<NavLink className='promo-panel-item' to='#'>
<Icon id='file-o' className='promo-panel-item__icon' fixedWidth />
<FormattedMessage id='admin_nav.pages' defaultMessage='Pages' />
</NavLink>
</div>
</div>
<div className='wtf-panel promo-panel'>
<div className='promo-panel__container'>
<NavLink className='promo-panel-item' to='#'>
<Icon id='fediverse' className='promo-panel-item__icon' fixedWidth />
<FormattedMessage id='admin_nav.mrf' defaultMessage='Federation' />
</NavLink>
<NavLink className='promo-panel-item' to='#'>
<Icon id='filter' className='promo-panel-item__icon' fixedWidth />
<FormattedMessage id='admin_nav.filtering' defaultMessage='Filtering' />
</NavLink>
<a className='promo-panel-item' href='/pleroma/admin/#/settings/index' target='_blank'>
<Icon id='code' className='promo-panel-item__icon' fixedWidth />
<FormattedMessage id='admin_nav.advanced' defaultMessage='Advanced' />
</a>
</div>
</div> */}
2020-12-29 12:16:19 -08:00
</>
2020-12-29 10:34:23 -08:00
);
}
}