= ({
if (action === 'reopen') {
handleReopen();
}
+
+ if (
+ action === 'pin' ||
+ action === 'unpin' ||
+ action === 'hide' ||
+ action === 'show'
+ ) {
+ handlOtherActions(action);
+ }
};
+ const firstAction =
+ memberActions?.filter(
+ (v) =>
+ v.action === 'report' || v.action === 'edit' || v.action === 'delete',
+ ) || [];
+ const secondAction =
+ memberActions?.filter(
+ (v) =>
+ v.action === 'close' ||
+ v.action === 'reopen' ||
+ v.action === 'pin' ||
+ v.action === 'unpin' ||
+ v.action === 'hide' ||
+ v.action === 'show',
+ ) || [];
+
return (
= ({
title={title}
slugTitle={slugTitle}
/>
- {memberActions?.map((item) => {
+ {firstAction?.map((item) => {
if (item.action === 'edit') {
return (
handleEdit(evt, editUrl)}
style={{ lineHeight: '23px' }}>
{item.name}
@@ -190,12 +263,32 @@ const Index: FC = ({
);
})}
+ {secondAction.length > 0 && (
+
+
+ {t('action', { keyPrefix: 'question_detail' })}
+
+
+ {secondAction.map((item) => {
+ return (
+ handleAction(item.action)}>
+ {item.name}
+
+ );
+ })}
+
+
+ )}
);
};
diff --git a/ui/src/components/QuestionList/index.tsx b/ui/src/components/QuestionList/index.tsx
index 94377b18..26599c79 100644
--- a/ui/src/components/QuestionList/index.tsx
+++ b/ui/src/components/QuestionList/index.tsx
@@ -14,6 +14,7 @@ import {
QueryGroup,
QuestionListLoader,
Counts,
+ Icon,
} from '@/components';
const QuestionOrderKeys: Type.QuestionOrderBy[] = [
@@ -62,6 +63,13 @@ const QuestionList: FC = ({ source, data, isLoading = false }) => {
key={li.id}
className="bg-transparent py-3 px-0 border-start-0 border-end-0">
+ {li.pin === 2 && (
+
+ )}
diff --git a/ui/src/components/Share/index.tsx b/ui/src/components/Share/index.tsx
index 855b02cb..34c45fc3 100644
--- a/ui/src/components/Share/index.tsx
+++ b/ui/src/components/Share/index.tsx
@@ -71,7 +71,7 @@ const Index: FC = ({ type, qid, aid, title, slugTitle = '' }) => {
setShow(true)}
style={{ lineHeight: '23px' }}>
{t('share.name')}
diff --git a/ui/src/components/TagSelector/index.tsx b/ui/src/components/TagSelector/index.tsx
index a8bb0a6c..01961ff5 100644
--- a/ui/src/components/TagSelector/index.tsx
+++ b/ui/src/components/TagSelector/index.tsx
@@ -38,7 +38,7 @@ const TagSelector: FC = ({
const [initialValue, setInitialValue] = useState([...value]);
const [currentIndex, setCurrentIndex] = useState(0);
const [repeatIndex, setRepeatIndex] = useState(-1);
- const [tag, setTag] = useState('');
+ const [searchValue, setSearchValue] = useState('');
const [tags, setTags] = useState(null);
const { t } = useTranslation('translation', { keyPrefix: 'tag_selector' });
const [visibleMenu, setVisibleMenu] = useState(false);
@@ -101,12 +101,12 @@ const TagSelector: FC = ({
const fetchTags = (str) => {
queryTags(str).then((res) => {
const tagArray: Type.Tag[] = filterTags(res || []);
- setTags(tagArray);
+ setTags(tagArray?.length > 5 ? tagArray.slice(0, 5) : tagArray);
});
};
useEffect(() => {
- fetchTags(tag);
+ fetchTags(searchValue);
}, [visibleMenu]);
const handleClick = (val: Type.Tag) => {
@@ -146,7 +146,7 @@ const TagSelector: FC = ({
const handleSearch = async (e: React.ChangeEvent) => {
const searchStr = e.currentTarget.value.replace(';', '');
- setTag(searchStr);
+ setSearchValue(searchStr);
fetchTags(searchStr);
};
@@ -172,7 +172,7 @@ const TagSelector: FC = ({
e.preventDefault();
if (tags.length === 0) {
- tagModal.onShow(tag);
+ tagModal.onShow(searchValue);
return;
}
if (currentIndex <= tags.length - 1) {
@@ -228,13 +228,14 @@ const TagSelector: FC = ({
)}
- {showRequiredTagText &&
+ {!searchValue &&
+ showRequiredTagText &&
tags &&
tags.filter((v) => v.recommend)?.length > 0 && (
{t('tag_required_text')}
@@ -251,17 +252,17 @@ const TagSelector: FC = ({
);
})}
- {tag && tags && tags.length === 0 && (
+ {searchValue && tags && tags.length === 0 && (
{t('no_result')}
)}
- {!hiddenCreateBtn && tag && (
+ {!hiddenCreateBtn && searchValue && (
diff --git a/ui/src/pages/Questions/Detail/components/Question/index.tsx b/ui/src/pages/Questions/Detail/components/Question/index.tsx
index 94a42981..3cfb7de0 100644
--- a/ui/src/pages/Questions/Detail/components/Question/index.tsx
+++ b/ui/src/pages/Questions/Detail/components/Question/index.tsx
@@ -11,6 +11,7 @@ import {
Comment,
FormatTime,
htmlRender,
+ Icon,
} from '@/components';
import { formatCount, guard } from '@/utils';
import { following } from '@/services';
@@ -65,6 +66,13 @@ const Index: FC = ({ data, initPage, hasAnswer, isLogged }) => {
return (
+ {data?.pin === 2 && (
+
+ )}
{
-
+
{t('avatar.label')}
{
export const saveQuestionWidthAnaser = (params: Type.QuestionWithAnswer) => {
return request.post('/answer/api/v1/question/answer', params);
};
+
+export const questionOpetation = (params: Type.QuestionOperationReq) => {
+ return request.put('/answer/api/v1/question/operation', params);
+};