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.

feat(question): add [closed] tip for all question title

haitao(lj)49d0f6df8d4d
diff --git a/ui/src/common/interface.ts b/ui/src/common/interface.ts
index daf17261..08d206f2 100644
--- a/ui/src/common/interface.ts
+++ b/ui/src/common/interface.ts
@@ -301,6 +301,7 @@ export interface SearchResItem {
answer_count: number;
accepted: boolean;
tags: TagBase[];
+ status?: string;
};
}
export interface SearchRes extends ListResult<SearchResItem> {
diff --git a/ui/src/common/variable.scss b/ui/src/common/variable.scss
index 1f6b7fca..99766954 100644
--- a/ui/src/common/variable.scss
+++ b/ui/src/common/variable.scss
@@ -1 +1,2 @@
$link-hover-decoration: none;
+$blue: #0033FF !default;
diff --git a/ui/src/pages/Questions/Ask/components/SearchQuestion/index.tsx b/ui/src/pages/Questions/Ask/components/SearchQuestion/index.tsx
index 1f3bde27..84ccfe47 100644
--- a/ui/src/pages/Questions/Ask/components/SearchQuestion/index.tsx
+++ b/ui/src/pages/Questions/Ask/components/SearchQuestion/index.tsx
@@ -30,7 +30,12 @@ const SearchQuestion = ({ similarQuestions }) => {
key={item.id}
href={`/questions/${item.id}`}
target="_blank">
- <span className="text-wrap text-break">{item.title}</span>
+ <span className="text-wrap text-break">
+ {item.title}
+ {item.status === 'closed'
+ ? ` [${t('closed', { keyPrefix: 'question' })}]`
+ : null}
+ </span>
{item.accepted_answer ? (
<span className="ms-3 text-success">
<Icon type="bi" name="check-circle-fill" />
diff --git a/ui/src/pages/Search/components/SearchItem/index.tsx b/ui/src/pages/Search/components/SearchItem/index.tsx
index c0c7af52..73e98a03 100644
--- a/ui/src/pages/Search/components/SearchItem/index.tsx
+++ b/ui/src/pages/Search/components/SearchItem/index.tsx
@@ -1,5 +1,6 @@
import { memo, FC } from 'react';
import { ListGroupItem, Badge } from 'react-bootstrap';
+import { useTranslation } from 'react-i18next';
import { Icon, Tag, FormatTime, BaseUserCard } from '@answer/components';
import type { SearchResItem } from '@answer/common/interface';
@@ -8,6 +9,8 @@ interface Props {
data: SearchResItem;
}
const Index: FC<Props> = ({ data }) => {
+ const { t } = useTranslation('translation', { keyPrefix: 'question' });
+ console.log('t: ', t);
if (!data?.object_type) {
return null;
}
@@ -24,6 +27,9 @@ const Index: FC<Props> = ({ data }) => {
className="h5 mb-0 text-body text-break"
href={`/questions/${data.object.id}`}>
{data.object.title}
+ {data.object.status === 'closed'
+ ? ` [${t('closed', { keyPrefix: 'question' })}]`
+ : null}
</a>
</div>
<div className="d-flex flex-wrap align-items-center fs-14 text-secondary mb-2">
@@ -51,10 +57,6 @@ const Index: FC<Props> = ({ data }) => {
)}
<span>{data.object?.answer_count}</span>
</div>
- {/* <div className="d-flex align-items-center">
- <Icon name="eye-fill fs-6 me-1" />
- <span> 0</span>
- </div> */}
</div>
</div>
diff --git a/ui/src/pages/Users/Personal/components/DefaultList/index.tsx b/ui/src/pages/Users/Personal/components/DefaultList/index.tsx
index 369e6eb4..f0d69b62 100644
--- a/ui/src/pages/Users/Personal/components/DefaultList/index.tsx
+++ b/ui/src/pages/Users/Personal/components/DefaultList/index.tsx
@@ -27,6 +27,9 @@ const Index: FC<Props> = ({ visible, tabName, data }) => {
tabName === 'questions' ? item.question_id : item.id
}`}>
{item.title}
+ {tabName === 'questions' && item.status === 'closed'
+ ? ` [${t('closed', { keyPrefix: 'question' })}]`
+ : null}
</a>
</h6>
<div className="d-flex align-items-center fs-14 text-secondary mb-2">