Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

refeactor(components): remove unnecessary component AdminHeader

haitao(lj)1590b662f6eb
diff --git a/ui/src/components/AdminHeader/index.tsx b/ui/src/components/AdminHeader/index.tsx
deleted file mode 100644
index cb5d6401..00000000
--- a/ui/src/components/AdminHeader/index.tsx
+++ /dev/null
@@ -1,23 +0,0 @@
-import { FC, memo } from 'react';
-import { Container } from 'react-bootstrap';
-import { useTranslation } from 'react-i18next';
-import { useMatch } from 'react-router-dom';
-
-const Index: FC = () => {
- const { t } = useTranslation('translation', {
- keyPrefix: 'admin.admin_header',
- });
- const adminPathMatch = useMatch('/admin/*');
- if (!adminPathMatch) {
- return null;
- }
- return (
- <div className="bg-light py-2">
- <Container className="py-1">
- <h6 className="mb-0 fw-bold lh-base">{t('title')}</h6>
- </Container>
- </div>
- );
-};
-
-export default memo(Index);
diff --git a/ui/src/components/index.ts b/ui/src/components/index.ts
index a4f3a0d8..d1a801ae 100644
--- a/ui/src/components/index.ts
+++ b/ui/src/components/index.ts
@@ -18,7 +18,6 @@ import TextArea from './TextArea';
import Mentions from './Mentions';
import FormatTime from './FormatTime';
import Toast from './Toast';
-import AdminHeader from './AdminHeader';
import AccordionNav from './AccordionNav';
import PageTitle from './PageTitle';
import Empty from './Empty';
@@ -50,7 +49,6 @@ export {
Mentions,
FormatTime,
Toast,
- AdminHeader,
AccordionNav,
PageTitle,
Empty,
diff --git a/ui/src/pages/Admin/index.tsx b/ui/src/pages/Admin/index.tsx
index a61c1030..7ae60655 100644
--- a/ui/src/pages/Admin/index.tsx
+++ b/ui/src/pages/Admin/index.tsx
@@ -3,7 +3,7 @@ import { Container, Row, Col } from 'react-bootstrap';
import { useTranslation } from 'react-i18next';
import { Outlet, useLocation } from 'react-router-dom';
-import { AccordionNav, AdminHeader, PageTitle } from '@/components';
+import { AccordionNav, PageTitle } from '@/components';
import { ADMIN_NAV_MENUS } from '@/common/constants';
import './index.scss';
@@ -20,10 +20,17 @@ const formPaths = [
const Index: FC = () => {
const { t } = useTranslation('translation', { keyPrefix: 'page_title' });
const { pathname } = useLocation();
+
return (
<>
<PageTitle title={t('admin')} />
- <AdminHeader />
+ <div className="bg-light py-2">
+ <Container className="py-1">
+ <h6 className="mb-0 fw-bold lh-base">
+ {t('title', { keyPrefix: 'admin.admin_header' })}
+ </h6>
+ </Container>
+ </div>
<Container className="admin-container">
<Row>
<Col lg={2}>