From da8eaec7b95c07ad05917d3a4d69c0234c9e9c18 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 28 Apr 2022 15:14:58 -0500 Subject: [PATCH] Delete AdminNav, AdminTabs i18n --- .../features/admin/components/admin-tabs.tsx | 14 ++- .../features/admin/components/admin_nav.js | 99 ------------------- .../features/ui/util/async-components.ts | 4 - app/soapbox/locales/en.json | 2 +- 4 files changed, 12 insertions(+), 107 deletions(-) delete mode 100644 app/soapbox/features/admin/components/admin_nav.js diff --git a/app/soapbox/features/admin/components/admin-tabs.tsx b/app/soapbox/features/admin/components/admin-tabs.tsx index fd0202003..e51d48a41 100644 --- a/app/soapbox/features/admin/components/admin-tabs.tsx +++ b/app/soapbox/features/admin/components/admin-tabs.tsx @@ -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 = ({ 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'), }]; diff --git a/app/soapbox/features/admin/components/admin_nav.js b/app/soapbox/features/admin/components/admin_nav.js deleted file mode 100644 index de7b0d337..000000000 --- a/app/soapbox/features/admin/components/admin_nav.js +++ /dev/null @@ -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 ( - <> -
-
- - - - - - - - - {((instance.get('registrations') && instance.get('approval_required')) || approvalCount > 0) && ( - - - - - )} - {/* !instance.get('registrations') && ( - - - - - ) */} - {/* - - - */} -
-
- {/*
-
- - - - - - - - - - - - - - - - -
-
-
-
- - - - - - - - - - - - -
-
*/} - - ); - } - -} diff --git a/app/soapbox/features/ui/util/async-components.ts b/app/soapbox/features/ui/util/async-components.ts index cd202afb5..4b3e4d335 100644 --- a/app/soapbox/features/ui/util/async-components.ts +++ b/app/soapbox/features/ui/util/async-components.ts @@ -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'); } diff --git a/app/soapbox/locales/en.json b/app/soapbox/locales/en.json index cb8fc8414..c3698e9fd 100644 --- a/app/soapbox/locales/en.json +++ b/app/soapbox/locales/en.json @@ -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",