From 05554e0414dbeb1963b8dbe170b8c5198434de99 Mon Sep 17 00:00:00 2001 From: 0xKurt Date: Mon, 2 Dec 2024 15:13:22 +0100 Subject: [PATCH] fix: i suggestion bug --- .../components/ProjectReviewList/ProjectReviewList.tsx | 9 +++++---- src/lib/utils.ts | 6 ++++++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/features/checker/components/ProjectReviewList/ProjectReviewList.tsx b/src/features/checker/components/ProjectReviewList/ProjectReviewList.tsx index a07e033..f856053 100644 --- a/src/features/checker/components/ProjectReviewList/ProjectReviewList.tsx +++ b/src/features/checker/components/ProjectReviewList/ProjectReviewList.tsx @@ -10,6 +10,7 @@ import { ProjectReview } from "~checker/types"; import { getReviewsCount } from "~checker/utils/getReviewsCount"; import { ReviewsCounterLabel } from "../ReviewsCounterLabel"; +import { addressFrom } from "@/lib"; export interface ProjectReviewListProps { projects: ProjectReview[]; @@ -65,11 +66,11 @@ export const ProjectReviewList = ({ header: "AI Suggestion", key: "aiSuggestion", width: "0.9fr", - render: (item) => { - return item.aiSuggestion !== 0 ? ( - - ) : ( + render: (item) => { // addressFrom(1) === ai evaluator + return item.reviews.some(review => review.reviewer === addressFrom(1)) ? ( + ) : ( + ); }, }, diff --git a/src/lib/utils.ts b/src/lib/utils.ts index ebbd1b1..48f3aae 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -2,6 +2,7 @@ import { clsx, type ClassValue } from "clsx"; import { twMerge } from "tailwind-merge"; import { match, P } from "ts-pattern"; + export function cn(...inputs: ClassValue[]) { return twMerge(clsx(inputs)); } @@ -54,3 +55,8 @@ export function capitalizeWord(word: string): string { if (!word) return word; return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase(); } + +export const addressFrom = (index: number): string => { + const address = index.toString(16).padStart(40, "0"); + return `0x${address}`; +}; \ No newline at end of file