bigbuffet-rw/app/soapbox/features/admin/index.tsx

38 lines
1 KiB
TypeScript
Raw Normal View History

2022-04-28 09:36:45 -07:00
import React from 'react';
2022-04-28 13:44:12 -07:00
import { defineMessages, useIntl } from 'react-intl';
import { Switch, Route } from 'react-router-dom';
2022-04-28 09:36:45 -07:00
2022-04-28 13:44:12 -07:00
import { useOwnAccount } from 'soapbox/hooks';
2022-04-28 09:36:45 -07:00
import Column from '../ui/components/column';
2022-04-28 13:44:12 -07:00
import Waitlist from './awaiting_approval';
2022-04-28 13:04:49 -07:00
import AdminTabs from './components/admin-tabs';
2022-04-28 13:44:12 -07:00
import Reports from './reports';
import Dashboard from './tabs/dashboard';
2022-04-28 09:36:45 -07:00
const messages = defineMessages({
heading: { id: 'column.admin.dashboard', defaultMessage: 'Dashboard' },
});
2022-04-28 13:44:12 -07:00
const Admin: React.FC = () => {
2022-04-28 09:36:45 -07:00
const intl = useIntl();
const account = useOwnAccount();
if (!account) return null;
return (
2022-04-28 12:06:47 -07:00
<Column label={intl.formatMessage(messages.heading)} withHeader={false}>
2022-04-28 13:04:49 -07:00
<AdminTabs activeItem='dashboard' />
2022-04-28 12:06:47 -07:00
2022-04-28 13:44:12 -07:00
<Switch>
<Route path='/admin' exact component={Dashboard} />
<Route path='/admin/reports' exact component={Reports} />
<Route path='/admin/approval' exact component={Waitlist} />
</Switch>
2022-04-28 09:36:45 -07:00
</Column>
);
};
2022-04-28 13:44:12 -07:00
export default Admin;