Did more work to beer post page, seed

Worked on comments and beer recs features. Fine tuning database seed amounts.
This commit is contained in:
Aaron William Po
2023-01-29 21:53:05 -05:00
parent fe277d5964
commit 0b96c8f1f5
38 changed files with 833 additions and 221 deletions

View File

@@ -1,19 +1,28 @@
import BeerPostQueryResult from '@/services/BeerPost/types/BeerPostQueryResult';
import BeerCommentQueryResult from '@/services/BeerPost/types/BeerCommentQueryResult';
import formatDistanceStrict from 'date-fns/formatDistanceStrict';
// @ts-expect-error
import ReactStars from 'react-rating-stars-component';
const CommentCard: React.FC<{
comment: BeerPostQueryResult['beerComments'][number];
comment: BeerCommentQueryResult;
}> = ({ comment }) => {
const timeDistance = formatDistanceStrict(new Date(comment.createdAt), new Date());
return (
<div className="card bg-base-300">
<div className="card-body">
<h3 className="text-2xl font-semibold">{comment.postedBy.username}</h3>
<h4 className="italic">{`posted ${formatDistanceStrict(
new Date(comment.createdAt),
new Date(),
)} ago`}</h4>
<p>{comment.content}</p>
<div className="card-body h-56">
<div className="flex justify-between">
<div>
<h3 className="text-2xl font-semibold">{comment.postedBy.username}</h3>
<h4 className="italic">posted {timeDistance} ago</h4>
</div>
<ReactStars
count={5}
size={24}
activeColor="#ffd700"
edit={false}
value={comment.rating}
/>
</div>
<p>{comment.content}</p>
</div>
);
};