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/incubator-answer.git
The following commit(s) were added to refs/heads/test by this push:
new e0ffb967 fix: linked question component not use empty content
e0ffb967 is described below
commit e0ffb9670d76db0019153845d8bb29d63912df1e
Author: shuai <[email protected]>
AuthorDate: Fri Oct 18 15:25:22 2024 +0800
fix: linked question component not use empty content
---
ui/src/components/Modal/BadgeModal.tsx | 1 -
.../Detail/components/LinkedQuestions/index.tsx | 66 +++++++++-------------
2 files changed, 28 insertions(+), 39 deletions(-)
diff --git a/ui/src/components/Modal/BadgeModal.tsx
b/ui/src/components/Modal/BadgeModal.tsx
index 18524852..5cb6c360 100644
--- a/ui/src/components/Modal/BadgeModal.tsx
+++ b/ui/src/components/Modal/BadgeModal.tsx
@@ -98,7 +98,6 @@ const BadgeModal: FC<BadgeModalProps> = ({ badge, visible })
=> {
};
const destroyAnimation = () => {
- console.log('destroyAnimation');
clearTimeout(timeout);
bg1?.destroy();
bg2?.destroy();
diff --git a/ui/src/pages/Questions/Detail/components/LinkedQuestions/index.tsx
b/ui/src/pages/Questions/Detail/components/LinkedQuestions/index.tsx
index 0706cc4b..208953b6 100644
--- a/ui/src/pages/Questions/Detail/components/LinkedQuestions/index.tsx
+++ b/ui/src/pages/Questions/Detail/components/LinkedQuestions/index.tsx
@@ -58,45 +58,35 @@ const Index: FC<Props> = ({ id }) => {
</Link>
</Card.Header>
<ListGroup variant="flush">
- {data.list.length > 0 ? (
- data.list.map((item) => (
- <ListGroup.Item
- action
- key={item.id}
- as={Link}
- to={pathFactory.questionLanding(item.id, item.url_title)}>
- <div className="link-dark">{item.title}</div>
- {item.answer_count > 0 && (
- <div
- className={`mt-1 small me-2 ${
+ {data.list?.map((item) => (
+ <ListGroup.Item
+ action
+ key={item.id}
+ as={Link}
+ to={pathFactory.questionLanding(item.id, item.url_title)}>
+ <div className="link-dark">{item.title}</div>
+ {item.answer_count > 0 && (
+ <div
+ className={`mt-1 small me-2 ${
+ item.accepted_answer_id > 0
+ ? 'link-success'
+ : 'link-secondary'
+ }`}>
+ <Icon
+ name={
item.accepted_answer_id > 0
- ? 'link-success'
- : 'link-secondary'
- }`}>
- <Icon
- name={
- item.accepted_answer_id > 0
- ? 'check-circle-fill'
- : 'chat-square-text-fill'
- }
- className="me-1"
- />
- <span>
- {item.answer_count} {t2('answers')}
- </span>
- </div>
- )}
- </ListGroup.Item>
- ))
- ) : (
- <div
- className="text-muted"
- style={{
- padding: 'var(--bs-card-spacer-y) var(--bs-card-spacer-x)',
- }}>
- {t('no_linked_question')}
- </div>
- )}
+ ? 'check-circle-fill'
+ : 'chat-square-text-fill'
+ }
+ className="me-1"
+ />
+ <span>
+ {item.answer_count} {t2('answers')}
+ </span>
+ </div>
+ )}
+ </ListGroup.Item>
+ ))}
</ListGroup>
</Card>
);