Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profile Icon indicating you authored review #412

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion site/src/component/Review/Review.scss
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@
.add-report-button:hover {
background-color: lightgray;
}

.gapped {
display: flex;
align-items: center;
gap: 0.25rem;
}
@media only screen and (max-width: 600px) {
.subreview-content {
flex-direction: column;
Expand Down
15 changes: 12 additions & 3 deletions site/src/component/Review/SubReview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Tooltip from 'react-bootstrap/Tooltip';
import OverlayTrigger from 'react-bootstrap/OverlayTrigger';
import { useCookies } from 'react-cookie';
import { Link } from 'react-router-dom';

import { PersonFill } from 'react-bootstrap-icons';
import { ReviewData, VoteRequest, CourseGQLData, ProfessorGQLData, VoteColor } from '../../types/types';
import ReportForm from '../ReportForm/ReportForm';

Expand Down Expand Up @@ -41,6 +41,7 @@ const SubReview: FC<SubReviewProps> = ({ review, course, professor, colors, colo
alert('You must be logged in to vote.');
return;
}

const votes = {
id: ((e.target as HTMLElement).parentNode! as Element).getAttribute('id')!,
upvote: true,
Expand Down Expand Up @@ -74,13 +75,20 @@ const SubReview: FC<SubReviewProps> = ({ review, course, professor, colors, colo
};

const badgeOverlay = <Tooltip id="verified-tooltip">This review was verified by an administrator.</Tooltip>;
const authorOverlay = <Tooltip id="authored-tooltip">You are the author of this review.</Tooltip>;

const verifiedBadge = (
<OverlayTrigger overlay={badgeOverlay}>
<Badge variant="primary">Verified</Badge>
</OverlayTrigger>
);

const authorBadge = (
<OverlayTrigger overlay={authorOverlay}>
<PersonFill size={25} fill="green"></PersonFill>
</OverlayTrigger>
);

return (
<div className="subreview">
<div>
Expand Down Expand Up @@ -137,9 +145,10 @@ const SubReview: FC<SubReviewProps> = ({ review, course, professor, colors, colo
</div>
<div>
<div className="subreview-author">
<p>
<span className="mr-1">Posted by {review.userDisplay}</span>
<p className=" gapped">
<span className=" mr-1">Posted by {review.userDisplay}</span>
{review.verified && verifiedBadge}
{cookies.user?.id === review.userID && authorBadge}
</p>
<p>
{new Date(review.timestamp).toLocaleString('default', {
Expand Down
Loading