Delete AdminNav, AdminTabs i18n

This commit is contained in:
Alex Gleason 2022-04-28 15:14:58 -05:00
parent 5c89040692
commit da8eaec7b9
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
4 changed files with 12 additions and 107 deletions

View file

@ -1,26 +1,34 @@
import React from 'react';
import { useIntl, defineMessages } from 'react-intl';
import { useHistory } from 'react-router-dom';
import { Tabs } from 'soapbox/components/ui';
const messages = defineMessages({
dashboard: { id: 'admin_nav.dashboard', defaultMessage: 'Dashboard' },
reports: { id: 'admin_nav.reports', defaultMessage: 'Reports' },
waitlist: { id: 'admin_nav.awaiting_approval', defaultMessage: 'Waitlist' },
});
interface IAdminTabs {
activeItem: 'dashboard' | 'reports' | 'approval',
}
const AdminTabs: React.FC<IAdminTabs> = ({ activeItem }) => {
const intl = useIntl();
const history = useHistory();
const tabs = [{
name: 'dashboard',
text: 'Dashboard',
text: intl.formatMessage(messages.dashboard),
action: () => history.push('/admin'),
}, {
name: 'reports',
text: 'Reports',
text: intl.formatMessage(messages.reports),
action: () => history.push('/admin/reports'),
}, {
name: 'approval',
text: 'Waitlist',
text: intl.formatMessage(messages.waitlist),
action: () => history.push('/admin/approval'),
}];

View file

@ -1,99 +0,0 @@
import PropTypes from 'prop-types';
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import { FormattedMessage } from 'react-intl';
import { connect } from 'react-redux';
import { NavLink } from 'react-router-dom';
import Icon from 'soapbox/components/icon';
import IconWithCounter from 'soapbox/components/icon_with_counter';
const mapStateToProps = (state, props) => ({
instance: state.get('instance'),
approvalCount: state.getIn(['admin', 'awaitingApproval']).count(),
reportsCount: state.getIn(['admin', 'openReports']).count(),
});
export default @connect(mapStateToProps)
class AdminNav extends React.PureComponent {
static propTypes = {
instance: ImmutablePropTypes.map.isRequired,
approvalCount: PropTypes.number,
reportsCount: PropTypes.number,
};
render() {
const { instance, approvalCount, reportsCount } = this.props;
return (
<>
<div className='wtf-panel promo-panel'>
<div className='promo-panel__container'>
<NavLink className='promo-panel-item' to='/admin'>
<Icon src={require('@tabler/icons/icons/dashboard.svg')} className='promo-panel-item__icon' />
<FormattedMessage id='admin_nav.dashboard' defaultMessage='Dashboard' />
</NavLink>
<NavLink className='promo-panel-item' to='/admin/reports'>
<IconWithCounter src={require('@tabler/icons/icons/gavel.svg')} count={reportsCount} />
<FormattedMessage id='admin_nav.reports' defaultMessage='Reports' />
</NavLink>
{((instance.get('registrations') && instance.get('approval_required')) || approvalCount > 0) && (
<NavLink className='promo-panel-item' to='/admin/approval'>
<IconWithCounter src={require('@tabler/icons/icons/user.svg')} count={approvalCount} />
<FormattedMessage id='admin_nav.awaiting_approval' defaultMessage='Awaiting Approval' />
</NavLink>
)}
{/* !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' />
</NavLink>
) */}
{/* <NavLink className='promo-panel-item' to='#'>
<Icon id='group' className='promo-panel-item__icon' fixedWidth />
<FormattedMessage id='admin_nav.registration' defaultMessage='Registration' />
</NavLink> */}
</div>
</div>
{/* <div className='wtf-panel promo-panel'>
<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> */}
</>
);
}
}

View file

@ -386,10 +386,6 @@ export function LatestAccountsPanel() {
return import(/* webpackChunkName: "features/admin" */'../../admin/components/latest_accounts_panel');
}
export function AdminNav() {
return import(/* webpackChunkName: "features/admin" */'../../admin/components/admin_nav');
}
export function SidebarMenu() {
return import(/* webpackChunkName: "features/ui" */'../../../components/sidebar_menu');
}

View file

@ -109,7 +109,7 @@
"admin.users.user_unsuggested_message": "@{acct} was unsuggested",
"admin.users.user_unverified_message": "@{acct} was unverified",
"admin.users.user_verified_message": "@{acct} was verified",
"admin_nav.awaiting_approval": "Awaiting Approval",
"admin_nav.awaiting_approval": "Waitlist",
"admin_nav.dashboard": "Dashboard",
"admin_nav.reports": "Reports",
"alert.unexpected.clear_cookies": "clear cookies and browser data",