From 233aa95d4b09ad2d5edf0fd463b335e6bb5838fa Mon Sep 17 00:00:00 2001 From: Illya Gerasymchuk Date: Mon, 27 Jan 2025 14:43:03 +0000 Subject: [PATCH 1/2] bug: correctly parse comment phase --- src/components/ProposalComments.tsx | 25 ++++++++++--------------- src/components/ProposalDetails.tsx | 2 +- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/components/ProposalComments.tsx b/src/components/ProposalComments.tsx index fb00ebc..0d1135d 100644 --- a/src/components/ProposalComments.tsx +++ b/src/components/ProposalComments.tsx @@ -18,13 +18,8 @@ import { TooltipTrigger, } from "@/components/ui/tooltip" import { Button } from "@/components/ui/button" -import type { ProposalComment } from "@/types/deliberation" +import type { CategorizedComments, ProposalComment } from "@/types/deliberation" -interface CategorizedComments { - reviewerConsideration: ProposalComment[]; - reviewerDeliberation: ProposalComment[]; - communityDeliberation: ProposalComment[]; -} interface ProposalCommentsProps { comments: CategorizedComments; @@ -40,9 +35,9 @@ export function ProposalComments({ comments }: ProposalCommentsProps) { const sortedComments = useMemo(() => { // Combine all comments into a single array const allComments = [ - ...(comments.reviewerConsideration || []), - ...(comments.reviewerDeliberation || []), - ...(comments.communityDeliberation || []), + ...(comments.reviewerConsideration || []).map(c => ({ ...c, category: 'reviewerConsideration' as const })), + ...(comments.reviewerDeliberation || []).map(c => ({ ...c, category: 'reviewerDeliberation' as const })), + ...(comments.communityDeliberation || []).map(c => ({ ...c, category: 'communityDeliberation' as const })), ]; if (sortType === 'date') { @@ -146,7 +141,7 @@ function truncateUsername(username: string, maxLength: number = 20): { truncated }; } -function CommentCard({ comment }: { comment: ProposalComment }) { +function CommentCard({ comment }: { comment: ProposalComment & { category: 'reviewerConsideration' | 'reviewerDeliberation' | 'communityDeliberation' } }) { const { truncated: displayUsername, isShortened } = comment.reviewer ? truncateUsername(comment.reviewer.username) : { truncated: '', isShortened: false }; @@ -218,17 +213,17 @@ function CommentCard({ comment }: { comment: ProposalComment }) {
{comment.recommendation !== undefined && ( {comment.recommendation ? - Recommended + Approved : - Not Recommended + Rejected } @@ -237,12 +232,12 @@ function CommentCard({ comment }: { comment: ProposalComment }) { variant="outline" className={cn( "transition-all duration-200", - comment.isReviewerComment && comment.recommendation !== undefined + comment.category === 'reviewerConsideration' ? "bg-blue-50 text-blue-700 dark:bg-blue-900/10 dark:text-blue-400" : "bg-gray-50 text-gray-700 dark:bg-gray-900/10 dark:text-gray-400" )} > - {comment.isReviewerComment && comment.recommendation !== undefined + {comment.category === 'reviewerConsideration' ? "Consideration" : "Deliberation" } diff --git a/src/components/ProposalDetails.tsx b/src/components/ProposalDetails.tsx index be858e9..2aef851 100644 --- a/src/components/ProposalDetails.tsx +++ b/src/components/ProposalDetails.tsx @@ -19,7 +19,7 @@ import { import { useFundingRounds } from "@/hooks/use-funding-rounds" import type { UserMetadata } from '@/services/UserService' import { ProposalComments } from "@/components/ProposalComments" -import type { ProposalComment, CategorizedComments } from "@/types/deliberation" +import type { CategorizedComments } from "@/types/deliberation" interface LinkedAccount { id: string; From 9802a17b34619fc63e5e36ed7330162a30d08f0e Mon Sep 17 00:00:00 2001 From: Illya Gerasymchuk Date: Mon, 27 Jan 2025 14:43:27 +0000 Subject: [PATCH 2/2] chore: bump verstion to .39 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fc1119e..8c2c3bb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pgt-web-app", - "version": "0.1.38", + "version": "0.1.39", "private": true, "type": "module", "scripts": {