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: Answer links for improved question management

robine45ecdc0ef99
diff --git a/ui/src/pages/Admin/Answers/index.tsx b/ui/src/pages/Admin/Answers/index.tsx
index 89a0ae26..aa2c47d4 100644
--- a/ui/src/pages/Admin/Answers/index.tsx
+++ b/ui/src/pages/Admin/Answers/index.tsx
@@ -28,6 +28,7 @@ const Answers: FC = () => {
const PAGE_SIZE = 20;
const curPage = Number(urlSearchParams.get('page')) || 1;
const curQuery = urlSearchParams.get('query') || '';
+ const questionId = urlSearchParams.get('questionId') || '';
const { t } = useTranslation('translation', { keyPrefix: 'admin.answers' });
const {
@@ -39,6 +40,7 @@ const Answers: FC = () => {
page: curPage,
status: curFilter as Type.AdminContentsFilterBy,
query: curQuery,
+ question_id: questionId,
});
const count = listData?.count || 0;
@@ -105,12 +107,12 @@ const Answers: FC = () => {
style={{ width: '12.25rem' }}
/>
</div>
- <Table>
+ <Table responsive>
<thead>
<tr>
- <th style={{ width: '45%' }}>{t('post')}</th>
+ <th>{t('post')}</th>
<th>{t('votes')}</th>
- <th style={{ width: '20%' }}>{t('created')}</th>
+ <th>{t('created')}</th>
<th>{t('status')}</th>
{curFilter !== 'deleted' && <th>{t('action')}</th>}
</tr>
@@ -141,6 +143,7 @@ const Answers: FC = () => {
__html: li.description,
}}
className="last-p text-truncate-2 fs-14"
+ style={{ maxWidth: '30rem' }}
/>
</Stack>
</td>
diff --git a/ui/src/services/admin/answer.ts b/ui/src/services/admin/answer.ts
index 6fd0fbb6..cd6bc824 100644
--- a/ui/src/services/admin/answer.ts
+++ b/ui/src/services/admin/answer.ts
@@ -4,7 +4,9 @@ import qs from 'qs';
import request from '@answer/utils/request';
import type * as Type from '@answer/common/interface';
-export const useAnswerSearch = (params: Type.AdminContentsReq) => {
+export const useAnswerSearch = (
+ params: Type.AdminContentsReq & { question_id?: string },
+) => {
const apiUrl = `/answer/admin/api/answer/page?${qs.stringify(params)}`;
const { data, error, mutate } = useSWR<Type.ListResult, Error>(
[apiUrl],