Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix: votes button usee title to show tips

shuai171312b81a8d
diff --git a/ui/src/components/Actions/index.tsx b/ui/src/components/Actions/index.tsx
index 518708ec..268ff9d1 100644
--- a/ui/src/components/Actions/index.tsx
+++ b/ui/src/components/Actions/index.tsx
@@ -1,5 +1,5 @@
import { memo, FC, useState, useEffect } from 'react';
-import { Button, ButtonGroup, Tooltip, OverlayTrigger } from 'react-bootstrap';
+import { Button, ButtonGroup } from 'react-bootstrap';
import { useTranslation } from 'react-i18next';
import classNames from 'classnames';
@@ -102,40 +102,31 @@ const Index: FC<Props> = ({ className, data, source }) => {
return (
<div className={classNames(className)}>
<ButtonGroup>
- <OverlayTrigger
- overlay={
- <Tooltip>
- {source === 'question'
- ? t('question_detail.question_useful')
- : t('question_detail.answer_useful')}
- </Tooltip>
- }>
- <Button
- variant="outline-secondary"
- active={like}
- onClick={() => handleVote('up')}>
- <Icon name="hand-thumbs-up-fill me-2" />
- <span>{t('question_detail.useful')}</span>
- </Button>
- </OverlayTrigger>
+ <Button
+ title={
+ source === 'question'
+ ? t('question_detail.question_useful')
+ : t('question_detail.answer_useful')
+ }
+ variant="outline-secondary"
+ active={like}
+ onClick={() => handleVote('up')}>
+ <Icon name="hand-thumbs-up-fill" />
+ </Button>
<Button variant="outline-secondary" className="opacity-100" disabled>
{votes}
</Button>
- <OverlayTrigger
- overlay={
- <Tooltip>
- {source === 'question'
- ? t('question_detail.question_un_useful')
- : t('question_detail.answer_un_useful')}
- </Tooltip>
- }>
- <Button
- variant="outline-secondary"
- active={hate}
- onClick={() => handleVote('down')}>
- <Icon name="hand-thumbs-down-fill" />
- </Button>
- </OverlayTrigger>
+ <Button
+ title={
+ source === 'question'
+ ? t('question_detail.question_un_useful')
+ : t('question_detail.answer_un_useful')
+ }
+ variant="outline-secondary"
+ active={hate}
+ onClick={() => handleVote('down')}>
+ <Icon name="hand-thumbs-down-fill" />
+ </Button>
</ButtonGroup>
{!data?.hideCollect && (
<Button
diff --git a/ui/src/components/Comment/components/ActionBar/index.tsx b/ui/src/components/Comment/components/ActionBar/index.tsx
index 49a22967..4bb84f65 100644
--- a/ui/src/components/Comment/components/ActionBar/index.tsx
+++ b/ui/src/components/Comment/components/ActionBar/index.tsx
@@ -1,5 +1,5 @@
import { memo } from 'react';
-import { Button, Dropdown, Tooltip, OverlayTrigger } from 'react-bootstrap';
+import { Button, Dropdown } from 'react-bootstrap';
import { useTranslation } from 'react-i18next';
import { Link } from 'react-router-dom';
@@ -31,19 +31,15 @@ const ActionBar = ({
)}
<span className="mx-1">•</span>
<FormatTime time={createdAt} className="me-3" />
- <OverlayTrigger
- overlay={<Tooltip className="comment-tip">{t('tip_vote')}</Tooltip>}>
- <Button
- variant="link"
- size="sm"
- className={`me-3 btn-no-border p-0 ${
- isVote ? '' : 'link-secondary'
- }`}
- onClick={onVote}>
- <Icon name="hand-thumbs-up-fill" />
- {voteCount > 0 && <span className="ms-2">{voteCount}</span>}
- </Button>
- </OverlayTrigger>
+ <Button
+ title={t('tip_vote')}
+ variant="link"
+ size="sm"
+ className={`me-3 btn-no-border p-0 ${isVote ? '' : 'link-secondary'}`}
+ onClick={onVote}>
+ <Icon name="hand-thumbs-up-fill" />
+ {voteCount > 0 && <span className="ms-2">{voteCount}</span>}
+ </Button>
<Button
variant="link"
size="sm"