This is an automated email from the ASF dual-hosted git repository.
shuai pushed a commit to branch test
in repository https://gitbox.apache.org/repos/asf/answer.git
The following commit(s) were added to refs/heads/test by this push:
new aeb7b083 update: timeline page need logged
aeb7b083 is described below
commit aeb7b08371f65f81d8d2681c50f787a653925f9c
Author: shuai <[email protected]>
AuthorDate: Mon Sep 22 11:32:04 2025 +0800
update: timeline page need logged
---
.../Questions/Detail/components/Question/index.tsx | 51 +++++++++++++++-------
ui/src/pages/Questions/Detail/index.tsx | 1 +
2 files changed, 36 insertions(+), 16 deletions(-)
diff --git a/ui/src/pages/Questions/Detail/components/Question/index.tsx
b/ui/src/pages/Questions/Detail/components/Question/index.tsx
index 97ca1fd4..149cd850 100644
--- a/ui/src/pages/Questions/Detail/components/Question/index.tsx
+++ b/ui/src/pages/Questions/Detail/components/Question/index.tsx
@@ -41,9 +41,10 @@ interface Props {
data: any;
hasAnswer: boolean;
initPage: (type: string) => void;
+ isLogged: boolean;
}
-const Index: FC<Props> = ({ data, initPage, hasAnswer }) => {
+const Index: FC<Props> = ({ data, initPage, hasAnswer, isLogged }) => {
const { t } = useTranslation('translation', {
keyPrefix: 'question_detail',
});
@@ -104,21 +105,39 @@ const Index: FC<Props> = ({ data, initPage, hasAnswer })
=> {
<div className="d-flex flex-wrap align-items-center small mb-4
text-secondary border-bottom pb-3">
<BaseUserCard data={data.user_info} className="me-3" />
- <Link to={`/posts/${data.id}/timeline`}>
- <FormatTime
- time={data.create_time}
- preFix={t('created')}
- className="me-3 link-secondary"
- />
- </Link>
-
- <Link to={`/posts/${data.id}/timeline`}>
- <FormatTime
- time={data.edit_time}
- preFix={t('Edited')}
- className="me-3 link-secondary"
- />
- </Link>
+ {isLogged ? (
+ <>
+ <Link to={`/posts/${data.id}/timeline`}>
+ <FormatTime
+ time={data.create_time}
+ preFix={t('created')}
+ className="me-3 link-secondary"
+ />
+ </Link>
+
+ <Link to={`/posts/${data.id}/timeline`}>
+ <FormatTime
+ time={data.edit_time}
+ preFix={t('Edited')}
+ className="me-3 link-secondary"
+ />
+ </Link>
+ </>
+ ) : (
+ <>
+ <FormatTime
+ time={data.create_time}
+ preFix={t('created')}
+ className="me-3 link-secondary"
+ />
+
+ <FormatTime
+ time={data.edit_time}
+ preFix={t('Edited')}
+ className="me-3 link-secondary"
+ />
+ </>
+ )}
{data?.view_count > 0 && (
<div className="me-3">
diff --git a/ui/src/pages/Questions/Detail/index.tsx
b/ui/src/pages/Questions/Detail/index.tsx
index 2a1e1d77..8c8921b8 100644
--- a/ui/src/pages/Questions/Detail/index.tsx
+++ b/ui/src/pages/Questions/Detail/index.tsx
@@ -253,6 +253,7 @@ const Index = () => {
data={question}
initPage={initPage}
hasAnswer={answers.count > 0}
+ isLogged={isLogged}
/>
)}
{!isLoading && answers.count > 0 && (