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.

refactor: tidy all constants to commom/constants

haitao(lj)5e61ece0283f
diff --git a/ui/src/common/index.ts b/ui/src/common/constants.ts
similarity index 62%
rename from ui/src/common/index.ts
rename to ui/src/common/constants.ts
index cdbff5b3..9f7f6f5e 100644
--- a/ui/src/common/index.ts
+++ b/ui/src/common/constants.ts
@@ -34,3 +34,25 @@ export const ADMIN_LIST_STATUS = {
name: 'deleted',
},
};
+
+export const ADMIN_NAV_MENUS = [
+ {
+ name: 'dashboard',
+ children: [],
+ },
+ {
+ name: 'contents',
+ child: [{ name: 'questions' }, { name: 'answers' }],
+ },
+ {
+ name: 'users',
+ },
+ {
+ name: 'flags',
+ // badgeContent: 5,
+ },
+ {
+ name: 'settings',
+ child: [{ name: 'general' }, { name: 'interface' }],
+ },
+];
diff --git a/ui/src/pages/Admin/Answers/index.tsx b/ui/src/pages/Admin/Answers/index.tsx
index aa6d9d55..77823fb9 100644
--- a/ui/src/pages/Admin/Answers/index.tsx
+++ b/ui/src/pages/Admin/Answers/index.tsx
@@ -18,7 +18,7 @@ import {
BaseUserCard,
Empty,
} from '@answer/components';
-import { ADMIN_LIST_STATUS } from '@answer/common';
+import { ADMIN_LIST_STATUS } from '@answer/common/constants';
import { useEditStatusModal } from '@answer/hooks';
import * as Type from '@/services/types';
diff --git a/ui/src/pages/Admin/Questions/index.tsx b/ui/src/pages/Admin/Questions/index.tsx
index 827df7da..05bf2de5 100644
--- a/ui/src/pages/Admin/Questions/index.tsx
+++ b/ui/src/pages/Admin/Questions/index.tsx
@@ -18,7 +18,7 @@ import {
BaseUserCard,
Empty,
} from '@answer/components';
-import { ADMIN_LIST_STATUS } from '@answer/common';
+import { ADMIN_LIST_STATUS } from '@answer/common/constants';
import { useEditStatusModal, useReportModal } from '@answer/hooks';
import { questionDelete } from '@answer/services/api';
diff --git a/ui/src/pages/Admin/UserOverview/index.tsx b/ui/src/pages/Admin/UserOverview/index.tsx
index 39d9ded7..4fc106eb 100644
--- a/ui/src/pages/Admin/UserOverview/index.tsx
+++ b/ui/src/pages/Admin/UserOverview/index.tsx
@@ -11,7 +11,7 @@ import {
import { AccordionNav } from '@answer/components';
-import { ADMIN_NAV_MENUS } from '@/pages/Admin/admin.constants';
+import { ADMIN_NAV_MENUS } from '@answer/common/constants';
import '../index.scss';
const UserOverview: FC = () => {
diff --git a/ui/src/pages/Admin/admin.constants.ts b/ui/src/pages/Admin/admin.constants.ts
deleted file mode 100644
index 96b74aac..00000000
--- a/ui/src/pages/Admin/admin.constants.ts
+++ /dev/null
@@ -1,21 +0,0 @@
-export const ADMIN_NAV_MENUS = [
- {
- name: 'dashboard',
- children: [],
- },
- {
- name: 'contents',
- child: [{ name: 'questions' }, { name: 'answers' }],
- },
- {
- name: 'users',
- },
- {
- name: 'flags',
- // badgeContent: 5,
- },
- {
- name: 'settings',
- child: [{ name: 'general' }, { name: 'interface' }],
- },
-];
diff --git a/ui/src/pages/Admin/index.tsx b/ui/src/pages/Admin/index.tsx
index f204587e..f37786ee 100644
--- a/ui/src/pages/Admin/index.tsx
+++ b/ui/src/pages/Admin/index.tsx
@@ -5,7 +5,7 @@ import { Outlet } from 'react-router-dom';
import { AccordionNav, PageTitle } from '@answer/components';
-import { ADMIN_NAV_MENUS } from '@/pages/Admin/admin.constants';
+import { ADMIN_NAV_MENUS } from '@answer/common/constants';
import './index.scss';
diff --git a/ui/src/utils/index.ts b/ui/src/utils/index.ts
index 3f91871f..11b54916 100644
--- a/ui/src/utils/index.ts
+++ b/ui/src/utils/index.ts
@@ -1,4 +1,4 @@
-import { LOGIN_NEED_BACK } from '@answer/common';
+import { LOGIN_NEED_BACK } from '@answer/common/constants';
import Storage from './storage';