Skip to content

Commit

Permalink
fix: linked question component not use empty content
Browse files Browse the repository at this point in the history
  • Loading branch information
shuashuai committed Oct 18, 2024
1 parent 13c17f1 commit e0ffb96
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 39 deletions.
1 change: 0 additions & 1 deletion ui/src/components/Modal/BadgeModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ const BadgeModal: FC<BadgeModalProps> = ({ badge, visible }) => {
};

const destroyAnimation = () => {
console.log('destroyAnimation');
clearTimeout(timeout);
bg1?.destroy();
bg2?.destroy();
Expand Down
66 changes: 28 additions & 38 deletions ui/src/pages/Questions/Detail/components/LinkedQuestions/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
);
Expand Down

0 comments on commit e0ffb96

Please sign in to comment.