diff --git a/i18n/en_US.yaml b/i18n/en_US.yaml index da34fcb1..2d804918 100644 --- a/i18n/en_US.yaml +++ b/i18n/en_US.yaml @@ -1407,9 +1407,11 @@ ui: search: Search people question_detail: action: Action + created: Created Asked: Asked asked: asked update: Modified + Edited: Edited edit: edited commented: commented Views: Viewed diff --git a/i18n/zh_CN.yaml b/i18n/zh_CN.yaml index b62fd470..35162045 100644 --- a/i18n/zh_CN.yaml +++ b/i18n/zh_CN.yaml @@ -1381,9 +1381,11 @@ ui: search: 搜索人员 question_detail: action: 操作 + created: 创建于 Asked: 提问于 asked: 提问于 update: 修改于 + Edited: 编辑于 edit: 编辑于 commented: 评论 Views: 阅读次数 diff --git a/ui/src/components/Comment/components/ActionBar/index.tsx b/ui/src/components/Comment/components/ActionBar/index.tsx index c55bf40e..692b0d20 100644 --- a/ui/src/components/Comment/components/ActionBar/index.tsx +++ b/ui/src/components/Comment/components/ActionBar/index.tsx @@ -64,7 +64,9 @@ const ActionBar = ({ }`} onClick={onVote}> - {voteCount > 0 && {voteCount}} + {voteCount > 0 && ( + {voteCount} + )} ); - } - return ( - - ); - })} - {secondAction.length > 0 && ( - - - {t('action', { keyPrefix: 'question_detail' })} - - - {secondAction.map((item) => { - return ( - handleAction(item.action)}> - {item.name} - - ); - })} - - - )} - + })} + {secondAction.length > 0 && ( + + + + + + {secondAction.map((item) => { + return ( + handleAction(item.action)}> + {item.name} + + ); + })} + + + )} + +
+ {memberActions.length > 0 && ( + + + + + + + {[...firstAction, ...secondAction].map((item) => { + return ( + handleAction(item.action)}> + {item.name} + + ); + })} + + + )} +
+ ); }; diff --git a/ui/src/components/Share/index.tsx b/ui/src/components/Share/index.tsx index 89ae05ce..d63147b1 100644 --- a/ui/src/components/Share/index.tsx +++ b/ui/src/components/Share/index.tsx @@ -23,6 +23,7 @@ import { useTranslation } from 'react-i18next'; import { FacebookShareButton, TwitterShareButton } from 'next-share'; import copy from 'copy-to-clipboard'; +import classNames from 'classnames'; import { BASE_ORIGIN } from '@/router/alias'; import { loggedUserInfoStore } from '@/stores'; @@ -32,10 +33,12 @@ interface IProps { qid: any; aid?: any; title: string; + className?: string; + mode?: 'normal' | 'mobile'; // slugTitle: string; } -const Index: FC = ({ type, qid, aid, title }) => { +const Index: FC = ({ type, qid, aid, title, className, mode }) => { const user = loggedUserInfoStore((state) => state.user); const [show, setShow] = useState(false); const [showTip, setShowTip] = useState(false); @@ -78,12 +81,21 @@ const Index: FC = ({ type, qid, aid, title }) => { setSystemShareState(true); } }, []); + + if (mode === 'mobile') { + if (canSystemShare) { + return ( + {t('share.name')} + ); + } + return null; + } return ( setShow(true)} style={{ lineHeight: '23px' }}> {t('share.name')} diff --git a/ui/src/components/UserCard/index.tsx b/ui/src/components/UserCard/index.tsx index 44bd19e0..cc7e883c 100644 --- a/ui/src/components/UserCard/index.tsx +++ b/ui/src/components/UserCard/index.tsx @@ -28,10 +28,12 @@ import { formatCount } from '@/utils'; interface Props { data: any; time: number; - preFix: string; + preFix?: string; isLogged: boolean; timelinePath: string; className?: string; + updateTime?: number; + updateTimePrefix?: string; } const Index: FC = ({ @@ -41,6 +43,8 @@ const Index: FC = ({ isLogged, timelinePath, className = '', + updateTime = 0, + updateTimePrefix = '', }) => { return (
@@ -81,7 +85,7 @@ const Index: FC = ({ /> )} -
+
{data?.status !== 'deleted' ? ( = ({ preFix={preFix} className="link-secondary" /> + {updateTime > 0 && ( + <> + + + + )} ) : ( - + <> + + {updateTime > 0 && ( + <> + + + + )} + ))}
diff --git a/ui/src/index.scss b/ui/src/index.scss index fb1e06a7..e3153fd2 100644 --- a/ui/src/index.scss +++ b/ui/src/index.scss @@ -422,3 +422,7 @@ img[src=''] { display: none; line-height: 1; } + +.inherit { + color: inherit !important; +} diff --git a/ui/src/pages/Questions/Detail/components/Answer/index.tsx b/ui/src/pages/Questions/Detail/components/Answer/index.tsx index 825f698d..957a60df 100644 --- a/ui/src/pages/Questions/Detail/components/Answer/index.tsx +++ b/ui/src/pages/Questions/Detail/components/Answer/index.tsx @@ -20,7 +20,7 @@ import { memo, FC, useEffect, useRef } from 'react'; import { Button, Alert, Badge } from 'react-bootstrap'; import { useTranslation } from 'react-i18next'; -import { Link, useSearchParams } from 'react-router-dom'; +import { useSearchParams } from 'react-router-dom'; import { Actions, @@ -28,7 +28,6 @@ import { UserCard, Icon, Comment, - FormatTime, htmlRender, ImgViewer, } from '@/components'; @@ -110,22 +109,34 @@ const Index: FC = ({ {t('post_pending', { keyPrefix: 'messages' })} )} - - {data?.accepted === 2 && ( -
- - - Best answer - +
+
+
- )} + + {data?.accepted === 2 && ( +
+ + + Best answer + +
+ )} +
-
+
= ({ )}
-
-
- -
-
- {data.update_user_info && - data.update_user_info?.username !== data.user_info?.username ? ( - - ) : isLogged ? ( - - - - ) : ( - - )} -
-
- -
-
- + commentId={String(searchParams.get('commentId'))}> + +
); }; diff --git a/ui/src/pages/Questions/Detail/components/Question/index.tsx b/ui/src/pages/Questions/Detail/components/Question/index.tsx index 93134578..19b73b06 100644 --- a/ui/src/pages/Questions/Detail/components/Question/index.tsx +++ b/ui/src/pages/Questions/Detail/components/Question/index.tsx @@ -26,7 +26,7 @@ import { Tag, Actions, Operate, - UserCard, + BaseUserCard, Comment, FormatTime, htmlRender, @@ -40,11 +40,10 @@ import { pathFactory } from '@/router/pathFactory'; interface Props { data: any; hasAnswer: boolean; - isLogged: boolean; initPage: (type: string) => void; } -const Index: FC = ({ data, initPage, hasAnswer, isLogged }) => { +const Index: FC = ({ data, initPage, hasAnswer }) => { const { t } = useTranslation('translation', { keyPrefix: 'question_detail', }); @@ -90,7 +89,7 @@ const Index: FC = ({ data, initPage, hasAnswer, isLogged }) => { return (
-

+

= ({ data, initPage, hasAnswer, isLogged }) => {

-
+
+ + + {data?.view_count > 0 && (
{t('Views')} {formatCount(data.view_count)} @@ -131,18 +133,20 @@ const Index: FC = ({ data, initPage, hasAnswer, isLogged }) => {
+ + +
+ +
{data?.tags?.map((item: any) => { return ; })}
- -
- = ({ data, initPage, hasAnswer, isLogged }) => { }} /> -
-
+
+ = ({ data, initPage, hasAnswer, isLogged }) => { isAccepted={Boolean(data?.accepted_answer_id)} callback={initPage} /> -
-
- {data.update_user_info && - data.update_user_info?.username !== data.user_info?.username ? ( - - ) : isLogged ? ( - - - - ) : ( - - )} -
-
- -
+
- -
); }; diff --git a/ui/src/pages/Questions/Detail/components/Reactions/index.tsx b/ui/src/pages/Questions/Detail/components/Reactions/index.tsx index 9c747cf8..9386b94c 100644 --- a/ui/src/pages/Questions/Detail/components/Reactions/index.tsx +++ b/ui/src/pages/Questions/Detail/components/Reactions/index.tsx @@ -21,8 +21,6 @@ import { FC, memo, useEffect, useState } from 'react'; import { Button, OverlayTrigger, Popover, Tooltip } from 'react-bootstrap'; import { useTranslation } from 'react-i18next'; -import classNames from 'classnames'; - import { Icon } from '@/components'; import { queryReactions, updateReaction } from '@/services'; import { tryNormalLogged } from '@/utils/guard'; @@ -111,10 +109,7 @@ const Index: FC = ({ ); return ( -
+
{showAddCommentBtn && (