fix: question detail closed reason

This commit is contained in:
shuai 2022-09-30 12:13:59 +08:00 committed by mingcheng
parent 2f2c79c26b
commit 9dfba0a79f
3 changed files with 42 additions and 4 deletions

View File

@ -187,6 +187,11 @@ const useReportModal = (callback?: () => void) => {
}
value={content.value}
isInvalid={content.isInvalid}
placeholder={
item.content_type === 'text'
? t('input_placeholder')
: t('textarea_placeholder')
}
onChange={(e) =>
setContent({
value: e.target.value,

View File

@ -199,7 +199,9 @@
},
"msg": {
"empty": "Please select a reason."
}
},
"input_placeholder": "Enter the existing question link",
"textarea_placeholder": "Let us know specifically what you are concerned about"
},
"tag_modal": {
"title": "Create New Tag",
@ -590,6 +592,8 @@
"edit": "edit",
"Views": "Views",
"answered": "answered",
"closed_in": "Closed in",
"show_exist": "Show existing question.",
"answers": {
"title": "Answers",
"score": "Score",
@ -870,4 +874,4 @@
}
}
}
}
}

View File

@ -1,15 +1,44 @@
import { memo, FC } from 'react';
import { Alert } from 'react-bootstrap';
import { useTranslation } from 'react-i18next';
import dayjs from 'dayjs';
interface Props {
data;
}
const Index: FC<Props> = ({ data }) => {
const { t } = useTranslation();
return (
<Alert className="mb-4" variant="info">
<div>
<strong>{data.operation_msg} </strong>
{data.operation_description}
{data.operation_msg.indexOf('http') > -1 ? (
<p>
{data.operation_description}
<a href={data.operation_msg} style={{ color: '#055160' }}>
<strong>{t('question_detail.show_exist')}</strong>
</a>
</p>
) : (
<p>
{data.operation_msg
? data.operation_msg
: data.operation_description}
</p>
)}
<div className="fs-14">
{t('question_detail.closed_in')}{' '}
<time
dateTime={dayjs.unix(data.operation_time).toISOString()}
title={dayjs
.unix(data.operation_time)
.format(t('dates.long_date_with_time'))}>
{dayjs
.unix(data.operation_time)
.format(t('dates.long_date_with_year'))}
</time>
.
</div>
</div>
</Alert>
);