mirror of https://gitee.com/answerdev/answer.git
feat(question): add [closed] tip for all question title
This commit is contained in:
parent
ff6cf2db03
commit
49d0f6df8d
|
@ -301,6 +301,7 @@ export interface SearchResItem {
|
||||||
answer_count: number;
|
answer_count: number;
|
||||||
accepted: boolean;
|
accepted: boolean;
|
||||||
tags: TagBase[];
|
tags: TagBase[];
|
||||||
|
status?: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
export interface SearchRes extends ListResult<SearchResItem> {
|
export interface SearchRes extends ListResult<SearchResItem> {
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
$link-hover-decoration: none;
|
$link-hover-decoration: none;
|
||||||
|
$blue: #0033FF !default;
|
||||||
|
|
|
@ -30,7 +30,12 @@ const SearchQuestion = ({ similarQuestions }) => {
|
||||||
key={item.id}
|
key={item.id}
|
||||||
href={`/questions/${item.id}`}
|
href={`/questions/${item.id}`}
|
||||||
target="_blank">
|
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 ? (
|
{item.accepted_answer ? (
|
||||||
<span className="ms-3 text-success">
|
<span className="ms-3 text-success">
|
||||||
<Icon type="bi" name="check-circle-fill" />
|
<Icon type="bi" name="check-circle-fill" />
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { memo, FC } from 'react';
|
import { memo, FC } from 'react';
|
||||||
import { ListGroupItem, Badge } from 'react-bootstrap';
|
import { ListGroupItem, Badge } from 'react-bootstrap';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import { Icon, Tag, FormatTime, BaseUserCard } from '@answer/components';
|
import { Icon, Tag, FormatTime, BaseUserCard } from '@answer/components';
|
||||||
import type { SearchResItem } from '@answer/common/interface';
|
import type { SearchResItem } from '@answer/common/interface';
|
||||||
|
@ -8,6 +9,8 @@ interface Props {
|
||||||
data: SearchResItem;
|
data: SearchResItem;
|
||||||
}
|
}
|
||||||
const Index: FC<Props> = ({ data }) => {
|
const Index: FC<Props> = ({ data }) => {
|
||||||
|
const { t } = useTranslation('translation', { keyPrefix: 'question' });
|
||||||
|
console.log('t: ', t);
|
||||||
if (!data?.object_type) {
|
if (!data?.object_type) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -24,6 +27,9 @@ const Index: FC<Props> = ({ data }) => {
|
||||||
className="h5 mb-0 text-body text-break"
|
className="h5 mb-0 text-body text-break"
|
||||||
href={`/questions/${data.object.id}`}>
|
href={`/questions/${data.object.id}`}>
|
||||||
{data.object.title}
|
{data.object.title}
|
||||||
|
{data.object.status === 'closed'
|
||||||
|
? ` [${t('closed', { keyPrefix: 'question' })}]`
|
||||||
|
: null}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div className="d-flex flex-wrap align-items-center fs-14 text-secondary mb-2">
|
<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>
|
<span>{data.object?.answer_count}</span>
|
||||||
</div>
|
</div>
|
||||||
{/* <div className="d-flex align-items-center">
|
|
||||||
<Icon name="eye-fill fs-6 me-1" />
|
|
||||||
<span> 0</span>
|
|
||||||
</div> */}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,9 @@ const Index: FC<Props> = ({ visible, tabName, data }) => {
|
||||||
tabName === 'questions' ? item.question_id : item.id
|
tabName === 'questions' ? item.question_id : item.id
|
||||||
}`}>
|
}`}>
|
||||||
{item.title}
|
{item.title}
|
||||||
|
{tabName === 'questions' && item.status === 'closed'
|
||||||
|
? ` [${t('closed', { keyPrefix: 'question' })}]`
|
||||||
|
: null}
|
||||||
</a>
|
</a>
|
||||||
</h6>
|
</h6>
|
||||||
<div className="d-flex align-items-center fs-14 text-secondary mb-2">
|
<div className="d-flex align-items-center fs-14 text-secondary mb-2">
|
||||||
|
|
Loading…
Reference in New Issue