Skip to content

Commit

Permalink
Merge pull request #71 from aic-factcheck/migrate_fe
Browse files Browse the repository at this point in the history
fix my reviews opinion
  • Loading branch information
romanbutora committed Aug 10, 2023
2 parents eb9c35a + 8d5b54f commit 9da3541
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions src/components/UserReview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next';
import { BiQuestionMark } from 'react-icons/bi';
import { AiOutlineLike, AiOutlineDislike } from 'react-icons/ai';
import {
CheckOutlined, CloseOutlined, EditOutlined, UserOutlined,
EditOutlined, UserOutlined,
} from '@ant-design/icons';
import { useRecoilValue } from 'recoil';
import { Link } from 'react-router-dom';
Expand Down Expand Up @@ -121,6 +121,28 @@ const UserReview: React.FC<Props> = ({ review, indexReview }) => {
}
};

const renderVote = React.useCallback(() => {
switch (review.vote) {
case 'TRUE':
return t('thinks_true');

case 'PARTIALLY_TRUE':
return t('thinks_partially_true');

case 'FALSE':
return t('thinks_false');

case 'INCONCLUSIVE':
return t('thinks_inconclusive');

case 'NON_VERIFIABLE':
return t('thinks_non_verifiable');

default:
return ' ';
}
}, [review.vote]);

return (
<div>
<Row style={{
Expand Down Expand Up @@ -168,15 +190,18 @@ const UserReview: React.FC<Props> = ({ review, indexReview }) => {
>
<Col span={20}>
<Paragraph style={{ color: 'black', margin: '0%' }}>
<p style={{ display: 'inline' }}>
<p style={{ display: 'flex' }}>
<Tooltip title={t('open_profile')}>
<Link to={`/profileSearch/${review.author._id}`} style={{ color: 'black' }}>
{`${review?.author.firstName} ${review?.author.lastName}`}
</Link>
</Tooltip>
{review.vote === 'TRUE' && <CheckOutlined style={{ marginLeft: '7px' }} /> }
{review.vote === 'FALSE' && <CloseOutlined style={{ marginLeft: '7px' }} />}
{review.vote === 'INCONCLUSIVE' && <BiQuestionMark style={{ marginLeft: '7px' }} />}
<div style={{
fontWeight: 'normal', float: 'right', marginLeft: '3%', fontStyle: 'italic',
}}
>
{renderVote()}
</div>
</p>
</Paragraph>
</Col>
Expand Down

0 comments on commit 9da3541

Please sign in to comment.