From cdaa9631c1e05a3678ff17137ddf6da98cbde76c Mon Sep 17 00:00:00 2001 From: heronlancellot Date: Fri, 4 Oct 2024 16:06:54 -0300 Subject: [PATCH 01/55] feat: add reviews-history style --- components/Icons/ClockIcon.tsx | 20 ++++++++++++++ .../Pages/Project/Review/CardReview.tsx | 27 ++++++++++++++----- .../Pages/Project/Review/NavbarReview.tsx | 12 ++++++++- 3 files changed, 52 insertions(+), 7 deletions(-) create mode 100644 components/Icons/ClockIcon.tsx diff --git a/components/Icons/ClockIcon.tsx b/components/Icons/ClockIcon.tsx new file mode 100644 index 00000000..4e69def8 --- /dev/null +++ b/components/Icons/ClockIcon.tsx @@ -0,0 +1,20 @@ +import { SVGProps } from "react"; + +export const ClockIcon = (props: SVGProps) => ( + + + + + +); diff --git a/components/Pages/Project/Review/CardReview.tsx b/components/Pages/Project/Review/CardReview.tsx index 3e3fcd90..ae037a0c 100644 --- a/components/Pages/Project/Review/CardReview.tsx +++ b/components/Pages/Project/Review/CardReview.tsx @@ -32,21 +32,36 @@ export const CardReview = ({ storie }: { storie: GrantStory }) => { return (
-
+
+
+

+ REVIEW +

+

+ / +

+

+ September 9, 2024 +

+
{storie && badges && badges.map((badge: Badge, index: number) => ( -
+
Badge Metadata -
-
-
{badge.name}
-
{badge.description}
+
+
+
+ {badge.name} +
+
+ {badge.description} +
{ const isStarSelected = useReviewStore((state: any) => state.isStarSelected); @@ -87,7 +88,16 @@ export const NavbarReview = () => { }; return ( -
+
+
+ +

+ Reviews History +

+
{stories && stories.length > 0 ? ( stories From 483fc57fbc95ebe38b8599389ab2c4b7ef3ea32a Mon Sep 17 00:00:00 2001 From: heronlancellot Date: Fri, 4 Oct 2024 16:51:15 -0300 Subject: [PATCH 02/55] update: navbar-selection review style --- .../Pages/Project/Review/NavbarReview.tsx | 58 ++++++++----------- 1 file changed, 24 insertions(+), 34 deletions(-) diff --git a/components/Pages/Project/Review/NavbarReview.tsx b/components/Pages/Project/Review/NavbarReview.tsx index cedcd2f9..2d245d7b 100644 --- a/components/Pages/Project/Review/NavbarReview.tsx +++ b/components/Pages/Project/Review/NavbarReview.tsx @@ -4,7 +4,7 @@ import { useEffect, useState } from "react"; import { useReviewStore } from "@/store/review"; import { useSearchParams } from "next/navigation"; -import { GrantStory } from "@/types/review"; +import { GrantStory, ReviewMode } from "@/types/review"; import { StarReviewIcon } from "@/components/Icons/StarReview"; import { CardReview } from "@/components/Pages/Project/Review/CardReview"; @@ -14,6 +14,7 @@ import { formatDate } from "@/utilities/formatDate"; import { getGrantStories } from "@/utilities/review/getGrantStories"; import { SCORER_DECIMALS } from "@/utilities/review/constants/constants"; import { ClockIcon } from "@/components/Icons/ClockIcon"; +import { DynamicStarsReview } from "./DynamicStarsReview"; export const NavbarReview = () => { const isStarSelected = useReviewStore((state: any) => state.isStarSelected); @@ -98,47 +99,36 @@ export const NavbarReview = () => { Reviews History
-
+
{stories && stories.length > 0 ? ( stories .sort((a: any, b: any) => Number(b.timestamp) - Number(a.timestamp)) .map((storie: GrantStory, index: number) => (
{ + setBadges(null); + handleToggleReviewSelected(index); + }} > -

{formatDate(new Date(Number(storie.timestamp) * 1000))}

-
- { - setBadges(null); - handleToggleReviewSelected(index); - }, - }} - /> +

{(Number(storie.averageScore) / 10 ** SCORER_DECIMALS).toFixed(1)}

- {isStarSelected === index && ( -
- -
- )} - {index < stories.length - 1 && ( - <> -
-

- {Number(timeDifference[index]) / 86400 >= 1 - ? `${Math.ceil(Number(timeDifference[index]) / 86400)} days` - : "Less than 1 day"} -

-
- - )} + {}} + mode={ReviewMode.READ} + /> +
+
+

{formatDate(new Date(Number(storie.timestamp) * 1000))}

)) From 1fa5a9ef9f66ebd9cb016ff57a103fcd5c91b5d1 Mon Sep 17 00:00:00 2001 From: heronlancellot Date: Fri, 4 Oct 2024 16:53:14 -0300 Subject: [PATCH 03/55] update: navbar review style --- components/Pages/Project/Review/NavbarReview.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/Pages/Project/Review/NavbarReview.tsx b/components/Pages/Project/Review/NavbarReview.tsx index 2d245d7b..2367ad12 100644 --- a/components/Pages/Project/Review/NavbarReview.tsx +++ b/components/Pages/Project/Review/NavbarReview.tsx @@ -115,7 +115,9 @@ export const NavbarReview = () => { }} >
-

{(Number(storie.averageScore) / 10 ** SCORER_DECIMALS).toFixed(1)}

+

+ {(Number(storie.averageScore) / 10 ** SCORER_DECIMALS).toFixed(1)} +

{ />
-

{formatDate(new Date(Number(storie.timestamp) * 1000))}

+

+ {formatDate(new Date(Number(storie.timestamp) * 1000))} +

)) From 346591791b682b19c04a4d9d2440b38077f221ea Mon Sep 17 00:00:00 2001 From: heronlancellot Date: Mon, 7 Oct 2024 10:00:20 -0300 Subject: [PATCH 04/55] update: star icon color --- .../Pages/Project/Review/DynamicStarsReview.tsx | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/components/Pages/Project/Review/DynamicStarsReview.tsx b/components/Pages/Project/Review/DynamicStarsReview.tsx index 6041f3d2..93d927ab 100644 --- a/components/Pages/Project/Review/DynamicStarsReview.tsx +++ b/components/Pages/Project/Review/DynamicStarsReview.tsx @@ -39,20 +39,13 @@ export const DynamicStarsReview = ({ mode === ReviewMode.WRITE ? "transition-all ease-in-out duration-300 cursor-pointer" : "transition-all ease-in-out duration-300", - onClick: - mode === ReviewMode.WRITE - ? () => handleStarClick(currentRating) - : undefined, + onClick: mode === ReviewMode.WRITE ? () => handleStarClick(currentRating) : undefined, style: { - fill: isHoveredOrRated ? "#004EEB" : "none", - stroke: isHoveredOrRated ? "#004EEB" : "#98A2B3", + fill: isHoveredOrRated ? "#1832ED" : "#959FA8", + stroke: isHoveredOrRated ? "#1832ED" : "#98A2B3", }, - onMouseEnter: - mode === ReviewMode.WRITE - ? () => setHover(currentRating) - : undefined, - onMouseLeave: - mode === ReviewMode.WRITE ? () => setHover(null) : undefined, + onMouseEnter: mode === ReviewMode.WRITE ? () => setHover(currentRating) : undefined, + onMouseLeave: mode === ReviewMode.WRITE ? () => setHover(null) : undefined, }} /> ); From f202af2c37a978dfe9044189a5f5d59ba9de8339 Mon Sep 17 00:00:00 2001 From: heronlancellot Date: Mon, 7 Oct 2024 10:26:43 -0300 Subject: [PATCH 05/55] update: styles dark/light mode --- components/Pages/Project/Review/CardNewReview.tsx | 2 +- components/Pages/Project/Review/CardReviewSummary.tsx | 2 +- components/Pages/Project/Review/NavbarReview.tsx | 8 +++----- components/Pages/Project/Review/ProgressBar.tsx | 4 +--- components/Pages/Project/Review/index.tsx | 8 ++++---- 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/components/Pages/Project/Review/CardNewReview.tsx b/components/Pages/Project/Review/CardNewReview.tsx index e60e89b4..1199c350 100644 --- a/components/Pages/Project/Review/CardNewReview.tsx +++ b/components/Pages/Project/Review/CardNewReview.tsx @@ -263,7 +263,7 @@ export const CardNewReview = () => {
))} -
+
diff --git a/components/Pages/Project/Review/CardReviewSummary.tsx b/components/Pages/Project/Review/CardReviewSummary.tsx index d229a6bb..d644d327 100644 --- a/components/Pages/Project/Review/CardReviewSummary.tsx +++ b/components/Pages/Project/Review/CardReviewSummary.tsx @@ -261,7 +261,7 @@ export const CardReviewSummary = () => {
{starRatingFiltered.map(({ stars, count, percentage }) => (
-

+

{stars}

diff --git a/components/Pages/Project/Review/NavbarReview.tsx b/components/Pages/Project/Review/NavbarReview.tsx index 2367ad12..02fd0c39 100644 --- a/components/Pages/Project/Review/NavbarReview.tsx +++ b/components/Pages/Project/Review/NavbarReview.tsx @@ -6,9 +6,7 @@ import { useSearchParams } from "next/navigation"; import { GrantStory, ReviewMode } from "@/types/review"; -import { StarReviewIcon } from "@/components/Icons/StarReview"; import { CardReview } from "@/components/Pages/Project/Review/CardReview"; -import { ChevronDown } from "@/components/Icons"; import { formatDate } from "@/utilities/formatDate"; import { getGrantStories } from "@/utilities/review/getGrantStories"; @@ -94,7 +92,7 @@ export const NavbarReview = () => {

Reviews History

@@ -107,7 +105,7 @@ export const NavbarReview = () => {
{ setBadges(null); @@ -115,7 +113,7 @@ export const NavbarReview = () => { }} >
-

+

{(Number(storie.averageScore) / 10 ** SCORER_DECIMALS).toFixed(1)}

index ? "dark:bg-[#1832ED]" : "dark:bg-[#26252A]" - }`} + className={`h-1 w-full ${actualPercentage > index ? "bg-[#1832ED]" : "bg-[#26252A]"}`} /> ); })} diff --git a/components/Pages/Project/Review/index.tsx b/components/Pages/Project/Review/index.tsx index d793362b..4bbf8148 100644 --- a/components/Pages/Project/Review/index.tsx +++ b/components/Pages/Project/Review/index.tsx @@ -27,17 +27,17 @@ export const ReviewSection = ({ grant }: GrantAllReviewsProps) => { return (
-
+
{isOpenReview === ReviewMode.WRITE ? ( <> -
+
{ setIsOpenReview(ReviewMode.READ); }} /> -

+

Write a new review

From 8b43ae0109a04d6614ddfd5f3a4d4895ea4a6ccd Mon Sep 17 00:00:00 2001 From: heronlancellot Date: Mon, 7 Oct 2024 11:52:52 -0300 Subject: [PATCH 06/55] update: review summary percentage --- components/Pages/Project/Review/CardReviewSummary.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/Pages/Project/Review/CardReviewSummary.tsx b/components/Pages/Project/Review/CardReviewSummary.tsx index d644d327..f2240d7b 100644 --- a/components/Pages/Project/Review/CardReviewSummary.tsx +++ b/components/Pages/Project/Review/CardReviewSummary.tsx @@ -266,7 +266,7 @@ export const CardReviewSummary = () => {

- {count ? percentage : "0"}% + {count ? percentage.toFixed(0) : "0"}%

))} From e442c17948d20310c82d4d42fd348b7decb27a85 Mon Sep 17 00:00:00 2001 From: heronlancellot Date: Mon, 7 Oct 2024 12:11:21 -0300 Subject: [PATCH 07/55] update: file name to constants/index & remove unnused code --- components/Pages/Project/Review/CardNewReview.tsx | 3 ++- components/Pages/Project/Review/CardReviewSummary.tsx | 2 +- components/Pages/Project/Review/NavbarReview.tsx | 2 +- utilities/review/attest.ts | 5 +---- utilities/review/constants/{constants.ts => index.ts} | 0 utilities/review/getBadge.ts | 2 +- utilities/review/getBadgeIds.ts | 2 +- utilities/review/getGrantProgramAverageScore.ts | 2 +- utilities/review/getGrantStories.ts | 2 +- 9 files changed, 9 insertions(+), 11 deletions(-) rename utilities/review/constants/{constants.ts => index.ts} (100%) diff --git a/components/Pages/Project/Review/CardNewReview.tsx b/components/Pages/Project/Review/CardNewReview.tsx index 1199c350..7fcfcdc0 100644 --- a/components/Pages/Project/Review/CardNewReview.tsx +++ b/components/Pages/Project/Review/CardNewReview.tsx @@ -1,4 +1,5 @@ "use client"; +/* eslint-disable react-hooks/exhaustive-deps */ /* eslint-disable @next/next/no-img-element */ import toast from "react-hot-toast"; import { useEffect } from "react"; @@ -14,7 +15,7 @@ import { Button } from "@/components/Utilities/Button"; import { DynamicStarsReview } from "./DynamicStarsReview"; import { AbiCoder } from "ethers"; -import { KARMA_EAS_SCHEMA_UID } from "@/utilities/review/constants/constants"; +import { KARMA_EAS_SCHEMA_UID } from "@/utilities/review/constants"; import { addPrefixToIPFSLink } from "@/utilities/review/constants/utilitary"; import { submitAttest } from "@/utilities/review/attest"; import { Spinner } from "@/components/Utilities/Spinner"; diff --git a/components/Pages/Project/Review/CardReviewSummary.tsx b/components/Pages/Project/Review/CardReviewSummary.tsx index f2240d7b..296d1130 100644 --- a/components/Pages/Project/Review/CardReviewSummary.tsx +++ b/components/Pages/Project/Review/CardReviewSummary.tsx @@ -11,7 +11,7 @@ import toast from "react-hot-toast"; import { arbitrum } from "viem/chains"; import { useReviewStore } from "@/store/review"; import { getBadgeIds } from "@/utilities/review/getBadgeIds"; -import { SCORER_DECIMALS, SCORER_ID } from "@/utilities/review/constants/constants"; +import { SCORER_DECIMALS, SCORER_ID } from "@/utilities/review/constants/"; import { getBadge } from "@/utilities/review/getBadge"; import { ProgressBar } from "./ProgressBar"; import React, { useEffect, useState } from "react"; diff --git a/components/Pages/Project/Review/NavbarReview.tsx b/components/Pages/Project/Review/NavbarReview.tsx index 02fd0c39..3c2bdd86 100644 --- a/components/Pages/Project/Review/NavbarReview.tsx +++ b/components/Pages/Project/Review/NavbarReview.tsx @@ -10,7 +10,7 @@ import { CardReview } from "@/components/Pages/Project/Review/CardReview"; import { formatDate } from "@/utilities/formatDate"; import { getGrantStories } from "@/utilities/review/getGrantStories"; -import { SCORER_DECIMALS } from "@/utilities/review/constants/constants"; +import { SCORER_DECIMALS } from "@/utilities/review/constants/"; import { ClockIcon } from "@/components/Icons/ClockIcon"; import { DynamicStarsReview } from "./DynamicStarsReview"; diff --git a/utilities/review/attest.ts b/utilities/review/attest.ts index 95654c36..4228aaa4 100644 --- a/utilities/review/attest.ts +++ b/utilities/review/attest.ts @@ -1,5 +1,3 @@ -import { getWalletClient } from "@wagmi/core"; -import { config } from "@/utilities/wagmi/config"; import { createPublicClient, encodeFunctionData, @@ -10,8 +8,7 @@ import { } from "viem"; import { sendTransaction, waitForTransactionReceipt } from "viem/actions"; import { arbitrum } from "viem/chains"; -import { ARB_ONE_EAS } from "./constants/constants"; -import toast from "react-hot-toast"; +import { ARB_ONE_EAS } from "./constants"; export interface AttestationRequestData { recipient: Hex; diff --git a/utilities/review/constants/constants.ts b/utilities/review/constants/index.ts similarity index 100% rename from utilities/review/constants/constants.ts rename to utilities/review/constants/index.ts diff --git a/utilities/review/getBadge.ts b/utilities/review/getBadge.ts index c3b0e123..63afad38 100644 --- a/utilities/review/getBadge.ts +++ b/utilities/review/getBadge.ts @@ -4,7 +4,7 @@ import { arbitrum } from "viem/chains"; import { Badge } from "@/types/review"; -import { BADGE_REGISTRY } from "./constants/constants"; +import { BADGE_REGISTRY } from "./constants"; const publicClient = createPublicClient({ chain: arbitrum, diff --git a/utilities/review/getBadgeIds.ts b/utilities/review/getBadgeIds.ts index 2bbd26f8..27196927 100644 --- a/utilities/review/getBadgeIds.ts +++ b/utilities/review/getBadgeIds.ts @@ -2,7 +2,7 @@ import { createPublicClient, http, Hex } from "viem"; import { readContract } from "viem/actions"; import { arbitrum } from "viem/chains"; -import { TRUSTFUL_SCORER } from "./constants/constants"; +import { TRUSTFUL_SCORER } from "./constants"; const publicClient = createPublicClient({ chain: arbitrum, diff --git a/utilities/review/getGrantProgramAverageScore.ts b/utilities/review/getGrantProgramAverageScore.ts index 3ac9c142..010772f9 100644 --- a/utilities/review/getGrantProgramAverageScore.ts +++ b/utilities/review/getGrantProgramAverageScore.ts @@ -1,7 +1,7 @@ import { readContract } from "viem/actions"; import { createPublicClient, http } from "viem"; import { arbitrum } from "viem/chains"; -import { RESOLVER_TRUSTFUL, SCORER_DECIMALS } from "./constants/constants"; +import { RESOLVER_TRUSTFUL, SCORER_DECIMALS } from "./constants"; const publicClient = createPublicClient({ chain: arbitrum, diff --git a/utilities/review/getGrantStories.ts b/utilities/review/getGrantStories.ts index 90843080..4032eb9f 100644 --- a/utilities/review/getGrantStories.ts +++ b/utilities/review/getGrantStories.ts @@ -1,7 +1,7 @@ import { readContract } from "viem/actions"; import { createPublicClient, http } from "viem"; import { arbitrum } from "viem/chains"; -import { RESOLVER_TRUSTFUL } from "./constants/constants"; +import { RESOLVER_TRUSTFUL } from "./constants"; import { GrantStory } from "@/types/review"; const publicClient = createPublicClient({ From cf61358773ac19e8a521e7f38144ffe1895036f3 Mon Sep 17 00:00:00 2001 From: heronlancellot Date: Mon, 7 Oct 2024 13:05:08 -0300 Subject: [PATCH 08/55] update: card-new-review with corrected interfaces from backend & update axios api call to send answers info to database. --- .../Pages/Project/Review/CardNewReview.tsx | 58 ++++++++++++++----- utilities/review/constants/index.ts | 34 +++++++++++ 2 files changed, 76 insertions(+), 16 deletions(-) diff --git a/components/Pages/Project/Review/CardNewReview.tsx b/components/Pages/Project/Review/CardNewReview.tsx index 7fcfcdc0..f81cfd87 100644 --- a/components/Pages/Project/Review/CardNewReview.tsx +++ b/components/Pages/Project/Review/CardNewReview.tsx @@ -15,16 +15,22 @@ import { Button } from "@/components/Utilities/Button"; import { DynamicStarsReview } from "./DynamicStarsReview"; import { AbiCoder } from "ethers"; -import { KARMA_EAS_SCHEMA_UID } from "@/utilities/review/constants"; +import { + Category, + CreatePreReviewRequest, + KARMA_EAS_SCHEMA_UID, + ReceivedGrant, +} from "@/utilities/review/constants"; import { addPrefixToIPFSLink } from "@/utilities/review/constants/utilitary"; import { submitAttest } from "@/utilities/review/attest"; import { Spinner } from "@/components/Utilities/Spinner"; import { config } from "@/utilities/wagmi/config"; import { useForm, Controller } from "react-hook-form"; import { CheckIcon } from "@heroicons/react/24/solid"; +import axios from "axios"; export const CardNewReview = () => { - const { control, handleSubmit } = useForm(); + const { control, handleSubmit, getValues } = useForm(); const setIsOpenReview = useReviewStore((state: any) => state.setIsOpenReview); const setBadgeScores = useReviewStore((state: any) => state.setBadgeScores); const badgeScores = useReviewStore((state: any) => state.badgeScores); @@ -107,6 +113,26 @@ export const CardNewReview = () => { walletClient, ); + /** Creating Request to save label info into database */ + const newPreReview: CreatePreReviewRequest = { + connectedUserAddress: address, + preReviewAnswers: { + category: Category.Community, + receivedGrant: ReceivedGrant.Yes, + }, + programId: 0x1dac0e2beeba6f3eec76117545f39f28e8ecc3d2c22731b6072b2d87e82fa35d, + // TODO: Get Category/ReceivedGrant/ProgramId dinamic + }; + + try { + const axiosPostBD = await axios.post("http://localhost:3001/api/v1/reviews", newPreReview); + console.log("axiosPostBD", axiosPostBD); + } catch (error) { + console.error("Error posting review:", error); + toast.error("Error submitting review. Try again."); + return; + } + if (response instanceof Error) { toast.error("Error submitting review. Try again."); return; @@ -121,21 +147,21 @@ export const CardNewReview = () => { }; const optionsWhyDidYouApplyFor = [ - { label: "Dev tooling", value: "devTooling" }, - { label: "Education", value: "education" }, - { label: "Marketing and Growth", value: "marketingAndGrowth" }, - { label: "DeFi", value: "deFi" }, - { label: "DAOs and Governance", value: "dAOsAndGovernance" }, - { label: "Community", value: "Community" }, - { label: "Public Goods", value: "publicGoods" }, - { label: "ZK and privacy", value: "zkAndPrivacy" }, - { label: "Other", value: "other" }, + { label: Category.DevTooling, value: Category.DevTooling }, + { label: Category.Education, value: Category.Education }, + { label: Category.MarketingAndGrowth, value: Category.MarketingAndGrowth }, + { label: Category.DeFi, value: Category.DeFi }, + { label: Category.DAOsAndGovernance, value: Category.DAOsAndGovernance }, + { label: Category.Community, value: Category.Community }, + { label: Category.PublicGoods, value: Category.PublicGoods }, + { label: Category.ZKAndPrivacy, value: Category.ZKAndPrivacy }, + { label: Category.Other, value: Category.Other }, ]; const optionsDidYouReceiveTheGrant = [ - { label: "Yes, I got approved", value: "yesIGotApproved" }, - { label: "No", value: "no" }, - { label: "I don't have the answer yet", value: "iDontHaveTheAnswerYet" }, + { label: ReceivedGrant.Yes, value: ReceivedGrant.Yes }, + { label: ReceivedGrant.No, value: ReceivedGrant.No }, + { label: ReceivedGrant.Pending, value: ReceivedGrant.Pending }, ]; const onSubmit = (data: any) => { @@ -171,7 +197,7 @@ export const CardNewReview = () => { checked={value.includes(option.value)} onChange={(e) => { const newValue = e.target.checked - ? [...value, option.value] + ? [option.value] : value.filter((value: string) => value !== option.value); onChange(newValue); }} @@ -213,7 +239,7 @@ export const CardNewReview = () => { checked={value.includes(option.value)} onChange={(e) => { const newValue = e.target.checked - ? [...value, option.value] + ? [option.value] : value.filter((value: string) => value !== option.value); onChange(newValue); }} diff --git a/utilities/review/constants/index.ts b/utilities/review/constants/index.ts index b462b5c5..20f2bf6e 100644 --- a/utilities/review/constants/index.ts +++ b/utilities/review/constants/index.ts @@ -1,3 +1,5 @@ +import { Hex } from "viem"; + // EAS contracts export const ARB_ONE_EAS = "0xbD75f629A22Dc1ceD33dDA0b68c546A1c035c458"; export const ARB_ONE_SCHEMA_REGISTRY = "0xA310da9c5B885E7fb3fbA9D66E9Ba6Df512b78eB"; @@ -16,3 +18,35 @@ export const BADGE_REGISTRY = "0xF0d7f324521B6f93EA6b9B8DB934E1D01C0c75b0"; export const TRUSTFUL_SCORER = "0x3B0C859cD18B836Df11bB7c45E22993a5AbA0069"; export const RESOLVER_EAS = "0x9533A8B883128412ed228e73292D5DE55fd7cAe9"; export const RESOLVER_TRUSTFUL = "0x44b17f32Be8Dde88a43A0A39F3801343f2d5D446"; + +/**Creating Review Configuration Answers to send to database. */ +export interface PreReviewAnswers { + category: Category; + otherCategoryDescriptions?: string; + receivedGrant: ReceivedGrant; +} + +export interface CreatePreReviewRequest { + preReviewAnswers: PreReviewAnswers; + connectedUserAddress: Hex; + programId: number; +} + +export enum Category { + DevTooling = "Dev tooling", + Education = "Education", + MarketingAndGrowth = "Marketing and Growth", + DeFi = "DeFi", + DAOsAndGovernance = "DAOs and Governance", + Community = "Community", + Gaming = "Gaming", + PublicGoods = "Public Goods", + ZKAndPrivacy = "ZK and privacy", + Other = "Other", +} + +export enum ReceivedGrant { + Yes = "Yes, I got approved", + No = "No", + Pending = "I don't have the answer yet", +} From 854afffa103b9da8009c1accbdc8f5138fa3e2ec Mon Sep 17 00:00:00 2001 From: heronlancellot Date: Mon, 7 Oct 2024 15:27:18 -0300 Subject: [PATCH 09/55] feat: add card-new-review api call --- .../Pages/Project/Review/CardNewReview.tsx | 85 ++++++++++++++----- 1 file changed, 62 insertions(+), 23 deletions(-) diff --git a/components/Pages/Project/Review/CardNewReview.tsx b/components/Pages/Project/Review/CardNewReview.tsx index f81cfd87..c3ffcaf5 100644 --- a/components/Pages/Project/Review/CardNewReview.tsx +++ b/components/Pages/Project/Review/CardNewReview.tsx @@ -30,7 +30,7 @@ import { CheckIcon } from "@heroicons/react/24/solid"; import axios from "axios"; export const CardNewReview = () => { - const { control, handleSubmit, getValues } = useForm(); + const { control, handleSubmit, getValues, trigger } = useForm(); const setIsOpenReview = useReviewStore((state: any) => state.setIsOpenReview); const setBadgeScores = useReviewStore((state: any) => state.setBadgeScores); const badgeScores = useReviewStore((state: any) => state.badgeScores); @@ -68,6 +68,63 @@ export const CardNewReview = () => { } }; + const handleSubmitAnswersReview = async () => { + const isValid = await trigger(["WhyDidYouApplyFor", "DidYouReceiveTheGrant"]); + + if (isValid && address) { + const values = getValues(); + const whyDidYouApplyFor: Category = values.WhyDidYouApplyFor; + const didYouReceiveTheGrant: ReceivedGrant = values.DidYouReceiveTheGrant; + + if (whyDidYouApplyFor.length === 0 || didYouReceiveTheGrant.length === 0) { + console.log("Você precisa selecionar uma opção em ambos os formulários."); + } else { + console.log("Valores do formulário:", values); + + // const connectedUserAddressData = { + // connectedUserAddress: address, + // }; + + // try { + // const axiosPostBD = await axios.post( + // "http://localhost:3001/api/v1/users", + // connectedUserAddressData, + // ); + // console.log("axiosPostBD", axiosPostBD); + // } catch (error) { + // console.error("Error creating User:", error); + // toast.error("Error creating User. Try again."); + // return; + // } + + /** Creating Request to save label info into database */ + const newPreReview: CreatePreReviewRequest = { + connectedUserAddress: address, + preReviewAnswers: { + category: whyDidYouApplyFor, + receivedGrant: didYouReceiveTheGrant, + }, + programId: 0x1dac0e2beeba6f3eec76117545f39f28e8ecc3d2c22731b6072b2d87e82fa35d, + // TODO: Get Category/ReceivedGrant/ProgramId dinamic + }; + + try { + const axiosPostBD = await axios.post( + "http://localhost:3001/api/v1/reviews", + newPreReview, + ); + console.log("axiosPostBD", axiosPostBD); + } catch (error) { + console.error("Error posting review:", error); + toast.error("Error submitting review. Try again."); + return; + } + } + } else { + console.log("Validação falhou."); + } + }; + /** * Handles the submission of a review to submitAttest. * @@ -113,25 +170,7 @@ export const CardNewReview = () => { walletClient, ); - /** Creating Request to save label info into database */ - const newPreReview: CreatePreReviewRequest = { - connectedUserAddress: address, - preReviewAnswers: { - category: Category.Community, - receivedGrant: ReceivedGrant.Yes, - }, - programId: 0x1dac0e2beeba6f3eec76117545f39f28e8ecc3d2c22731b6072b2d87e82fa35d, - // TODO: Get Category/ReceivedGrant/ProgramId dinamic - }; - - try { - const axiosPostBD = await axios.post("http://localhost:3001/api/v1/reviews", newPreReview); - console.log("axiosPostBD", axiosPostBD); - } catch (error) { - console.error("Error posting review:", error); - toast.error("Error submitting review. Try again."); - return; - } + handleSubmitAnswersReview(); if (response instanceof Error) { toast.error("Error submitting review. Try again."); @@ -165,7 +204,7 @@ export const CardNewReview = () => { ]; const onSubmit = (data: any) => { - console.log(data); + console.log("data", data); }; return ( @@ -177,7 +216,7 @@ export const CardNewReview = () => { Why did you apply for? -
+ {

Did you receive the grant?

- + Date: Tue, 8 Oct 2024 12:01:00 -0300 Subject: [PATCH 10/55] fix: style text light mode --- components/Pages/Project/Review/CardReviewSummary.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/Pages/Project/Review/CardReviewSummary.tsx b/components/Pages/Project/Review/CardReviewSummary.tsx index d205e19f..8289b49c 100644 --- a/components/Pages/Project/Review/CardReviewSummary.tsx +++ b/components/Pages/Project/Review/CardReviewSummary.tsx @@ -268,7 +268,7 @@ export const CardReviewSummary = () => {
{ratingData.map(({ countOfReviews, percentageComparedToAllTheReviews }, index) => (
-

+

{index + 1}

From 52473d5d6b2a79851ee80d040ba190079aa7b3e1 Mon Sep 17 00:00:00 2001 From: heronlancellot Date: Tue, 8 Oct 2024 17:51:21 -0300 Subject: [PATCH 11/55] feat: add ArrowNavigationBar --- .../Project/Review/ArrowNavigationBar.tsx | 161 ++++++++++++++++++ .../Pages/Project/Review/NavbarReview.tsx | 103 +++++------ components/Pages/Project/Review/Skeleton.tsx | 14 ++ styles/globals.css | 18 ++ 4 files changed, 247 insertions(+), 49 deletions(-) create mode 100644 components/Pages/Project/Review/ArrowNavigationBar.tsx create mode 100644 components/Pages/Project/Review/Skeleton.tsx diff --git a/components/Pages/Project/Review/ArrowNavigationBar.tsx b/components/Pages/Project/Review/ArrowNavigationBar.tsx new file mode 100644 index 00000000..d3d3b31f --- /dev/null +++ b/components/Pages/Project/Review/ArrowNavigationBar.tsx @@ -0,0 +1,161 @@ +/* eslint-disable react-hooks/exhaustive-deps */ +import { ChevronLeftIcon, ChevronRightIcon } from "@heroicons/react/24/solid"; +import { useEffect, useRef, useState } from "react"; +import lodash from "lodash"; +import { useTheme } from "next-themes"; +interface ArrowNavigationBarProps { + centerID?: string | null; + skeletonMarkup: JSX.Element; + barContentMarkup: JSX.Element; +} + +enum ScrollDirection { + LEFT, + RIGHT, +} + +interface ShowNavButtons { + left: boolean; + right: boolean; +} + +const VISIBLE_SCROLLER_WIDTH_AFTER_NAVIGATOR_CLICK = 75; +const DELAY_FOR_DOM_PROPERTY_UPDATE = 2000; + +export const ArrowNavigationBar = ({ + centerID, + skeletonMarkup, + barContentMarkup, +}: ArrowNavigationBarProps) => { + const navigationBarWrapper = useRef(null); + const { theme } = useTheme(); + + const [showNavButtons, setShowNavButtons] = useState(null); + + useEffect(() => { + setDisplayOfInfiniteShadowsAndNavigationButtons(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [navigationBarWrapper]); + + useEffect(() => { + if (window) { + window.addEventListener( + "resize", + lodash.debounce(setDisplayOfInfiniteShadowsAndNavigationButtons, 100), + ); + } + + if (navigationBarWrapper.current) { + navigationBarWrapper.current.addEventListener( + "scroll", + lodash.debounce(setDisplayOfInfiniteShadowsAndNavigationButtons, 100), + ); + } + + return () => { + window.removeEventListener( + "resize", + lodash.debounce(setDisplayOfInfiniteShadowsAndNavigationButtons, 100), + ); + + navigationBarWrapper.current?.removeEventListener( + "scroll", + lodash.debounce(setDisplayOfInfiniteShadowsAndNavigationButtons, 100), + ); + }; + }, []); + + const scrollQuickJumpScrollerTo = (scrollDirection: ScrollDirection) => { + if (navigationBarWrapper.current) { + const amountToScroll = + navigationBarWrapper.current.clientWidth - VISIBLE_SCROLLER_WIDTH_AFTER_NAVIGATOR_CLICK; + + navigationBarWrapper.current.scroll({ + behavior: "smooth", + left: + scrollDirection === ScrollDirection.LEFT + ? navigationBarWrapper.current.scrollLeft - amountToScroll + : navigationBarWrapper.current.scrollLeft + amountToScroll, + }); + + setTimeout(setDisplayOfInfiniteShadowsAndNavigationButtons, DELAY_FOR_DOM_PROPERTY_UPDATE); + } + }; + + const setDisplayOfInfiniteShadowsAndNavigationButtons = () => { + let showLeft, showRight; + + if (navigationBarWrapper.current) { + const needsNavigationArrows = + navigationBarWrapper.current?.scrollWidth > navigationBarWrapper.current?.clientWidth; + + const userScrolledToRight = + navigationBarWrapper.current?.scrollLeft > 0 && needsNavigationArrows; + showLeft = userScrolledToRight; + const scrolledToTheFartest = + navigationBarWrapper.current?.scrollLeft + navigationBarWrapper.current?.clientWidth === + navigationBarWrapper.current?.scrollWidth; + showRight = !scrolledToTheFartest && needsNavigationArrows; + + setShowNavButtons({ + left: showLeft, + right: showRight, + }); + } + }; + + useEffect(() => { + if (centerID) { + const centerElement = document.querySelector( + '[data-navigation-item="' + centerID + '"]', + ) as HTMLElement; + + if (centerElement && navigationBarWrapper.current) { + navigationBarWrapper.current.scrollTo({ + behavior: "smooth", + left: centerElement.offsetLeft - 80, + }); + + setTimeout(setDisplayOfInfiniteShadowsAndNavigationButtons, DELAY_FOR_DOM_PROPERTY_UPDATE); + } + } + }, [centerID]); + + return ( +
+
+
+ +
+
+ {showNavButtons === null && skeletonMarkup} + {
{barContentMarkup}
} +
+
+
+ +
+
+ ); +}; diff --git a/components/Pages/Project/Review/NavbarReview.tsx b/components/Pages/Project/Review/NavbarReview.tsx index 3c2bdd86..6643e3dd 100644 --- a/components/Pages/Project/Review/NavbarReview.tsx +++ b/components/Pages/Project/Review/NavbarReview.tsx @@ -3,16 +3,15 @@ import { useEffect, useState } from "react"; import { useReviewStore } from "@/store/review"; import { useSearchParams } from "next/navigation"; - import { GrantStory, ReviewMode } from "@/types/review"; - import { CardReview } from "@/components/Pages/Project/Review/CardReview"; - import { formatDate } from "@/utilities/formatDate"; import { getGrantStories } from "@/utilities/review/getGrantStories"; import { SCORER_DECIMALS } from "@/utilities/review/constants/"; import { ClockIcon } from "@/components/Icons/ClockIcon"; import { DynamicStarsReview } from "./DynamicStarsReview"; +import { ArrowNavigationBar } from "./ArrowNavigationBar"; +import { Skeleton } from "./Skeleton"; export const NavbarReview = () => { const isStarSelected = useReviewStore((state: any) => state.isStarSelected); @@ -86,6 +85,57 @@ export const NavbarReview = () => { }); }; + const skeletonMarkup = ; + + const barContentMarkup = ( +
+ {stories && stories.length > 0 ? ( + stories + .sort((a: any, b: any) => Number(b.timestamp) - Number(a.timestamp)) + .map((storie: GrantStory, index: number) => ( +
{ + setBadges(null); + handleToggleReviewSelected(index); + }} + > +
+

+ {(Number(storie.averageScore) / 10 ** SCORER_DECIMALS).toFixed(1)} +

+ {}} + mode={ReviewMode.READ} + /> +
+
+

+ {formatDate(new Date(Number(storie.timestamp) * 1000))} +

+
+
+ )) + ) : ( +
+

+ Be the first to share your thoughts! Reach out to the grantee and encourage them to + leave a review. +

+
+ )} +
+ ); + return (
@@ -97,52 +147,7 @@ export const NavbarReview = () => { Reviews History
-
- {stories && stories.length > 0 ? ( - stories - .sort((a: any, b: any) => Number(b.timestamp) - Number(a.timestamp)) - .map((storie: GrantStory, index: number) => ( -
{ - setBadges(null); - handleToggleReviewSelected(index); - }} - > -
-

- {(Number(storie.averageScore) / 10 ** SCORER_DECIMALS).toFixed(1)} -

- {}} - mode={ReviewMode.READ} - /> -
-
-

- {formatDate(new Date(Number(storie.timestamp) * 1000))} -

-
-
- )) - ) : ( -
-

- Be the first to share your thoughts! Reach out to the grantee and encourage them to - leave a review. -

-
- )} -
+
{isStarSelected !== null && stories && }
diff --git a/components/Pages/Project/Review/Skeleton.tsx b/components/Pages/Project/Review/Skeleton.tsx new file mode 100644 index 00000000..9d5daf52 --- /dev/null +++ b/components/Pages/Project/Review/Skeleton.tsx @@ -0,0 +1,14 @@ +interface SkeletonProps { + className?: string; + roundedClass?: string; +} +export const Skeleton = ({ + className = "w-16 h-2", + roundedClass = "rounded-md", +}: SkeletonProps) => { + return ( +
+
+
+ ); +}; diff --git a/styles/globals.css b/styles/globals.css index e33bd359..e1265190 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -152,4 +152,22 @@ label { .scroller { scrollbar-width: thin; + } + + .gradient-white-to-transparent { + background: linear-gradient(270deg, rgba(255, 255, 255, 1) 50%, rgba(255, 255, 255, 0.80) 60%, rgba(255, 255, 255, 0.70) 65%, rgba(255, 255, 255, 0.60) 70%, rgba(255, 255, 255, 0.50) 75%, rgba(255, 255, 255, 0.40) 80%, rgba(255, 255, 255, 0.30) 85%, rgba(255, 255, 255, 0.15) 90%, rgba(255, 255, 255, 0) 100%); + } + + .gradient-black-to-transparent { + background: linear-gradient(270deg, rgba(0, 0, 0, 1) 50%, rgba(0, 0, 0, 0.80) 60%, rgba(0, 0, 0, 0.70) 65%, rgba(0, 0, 0, 0.60) 70%, rgba(0, 0, 0, 0.50) 75%, rgba(0, 0, 0, 0.40) 80%, rgba(0, 0, 0, 0.30) 85%, rgba(0, 0, 0, 0.15) 90%, rgba(0, 0, 0, 0) 100%); + } + + /* Hide scrollbar for Chrome, Safari and Opera */ + .no-scrollbar::-webkit-scrollbar { + display: none; + } + /* Hide scrollbar for IE, Edge and Firefox */ + .no-scrollbar { + -ms-overflow-style: none; /* IE and Edge */ + scrollbar-width: none; /* Firefox */ } \ No newline at end of file From 1e3e09cde76f109372b5826430a76e8a9b192415 Mon Sep 17 00:00:00 2001 From: "heronlancellot.eth" Date: Wed, 9 Oct 2024 14:27:24 -0300 Subject: [PATCH 12/55] Update components/Pages/Project/Review/ArrowNavigationBar.tsx Co-authored-by: caco.eth <49823133+FrancoAguzzi@users.noreply.github.com> --- components/Pages/Project/Review/ArrowNavigationBar.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/Pages/Project/Review/ArrowNavigationBar.tsx b/components/Pages/Project/Review/ArrowNavigationBar.tsx index d3d3b31f..6fb6ba64 100644 --- a/components/Pages/Project/Review/ArrowNavigationBar.tsx +++ b/components/Pages/Project/Review/ArrowNavigationBar.tsx @@ -3,7 +3,8 @@ import { ChevronLeftIcon, ChevronRightIcon } from "@heroicons/react/24/solid"; import { useEffect, useRef, useState } from "react"; import lodash from "lodash"; import { useTheme } from "next-themes"; -interface ArrowNavigationBarProps { + +interface HorizontalNavigationBarProps { centerID?: string | null; skeletonMarkup: JSX.Element; barContentMarkup: JSX.Element; From 18409f299ff6284d80d4e1816a26da3d1e90b552 Mon Sep 17 00:00:00 2001 From: "heronlancellot.eth" Date: Wed, 9 Oct 2024 14:27:54 -0300 Subject: [PATCH 13/55] Update utilities/review/constants/index.ts Co-authored-by: caco.eth <49823133+FrancoAguzzi@users.noreply.github.com> --- utilities/review/constants/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/review/constants/index.ts b/utilities/review/constants/index.ts index 20f2bf6e..a2ea4872 100644 --- a/utilities/review/constants/index.ts +++ b/utilities/review/constants/index.ts @@ -28,7 +28,7 @@ export interface PreReviewAnswers { export interface CreatePreReviewRequest { preReviewAnswers: PreReviewAnswers; - connectedUserAddress: Hex; + connectedUserAddress: Address; programId: number; } From 2e9148327f3fa3ec667f0bd3de80041fc16b9c34 Mon Sep 17 00:00:00 2001 From: "heronlancellot.eth" Date: Wed, 9 Oct 2024 14:28:04 -0300 Subject: [PATCH 14/55] Update utilities/review/constants/index.ts Co-authored-by: caco.eth <49823133+FrancoAguzzi@users.noreply.github.com> --- utilities/review/constants/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/review/constants/index.ts b/utilities/review/constants/index.ts index a2ea4872..ba6e80d9 100644 --- a/utilities/review/constants/index.ts +++ b/utilities/review/constants/index.ts @@ -32,7 +32,7 @@ export interface CreatePreReviewRequest { programId: number; } -export enum Category { +export enum CategoryOptions { DevTooling = "Dev tooling", Education = "Education", MarketingAndGrowth = "Marketing and Growth", From 902922e0ec00b0a5d3c63070a8b5ac07c9df7241 Mon Sep 17 00:00:00 2001 From: "heronlancellot.eth" Date: Wed, 9 Oct 2024 14:28:12 -0300 Subject: [PATCH 15/55] Update utilities/review/constants/index.ts Co-authored-by: caco.eth <49823133+FrancoAguzzi@users.noreply.github.com> --- utilities/review/constants/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/review/constants/index.ts b/utilities/review/constants/index.ts index ba6e80d9..b9262ac3 100644 --- a/utilities/review/constants/index.ts +++ b/utilities/review/constants/index.ts @@ -45,7 +45,7 @@ export enum CategoryOptions { Other = "Other", } -export enum ReceivedGrant { +export enum ReceivedGrantOptions { Yes = "Yes, I got approved", No = "No", Pending = "I don't have the answer yet", From c494b39b3c584129cb9a35d0f866f849be1a04a0 Mon Sep 17 00:00:00 2001 From: "heronlancellot.eth" Date: Wed, 9 Oct 2024 14:28:22 -0300 Subject: [PATCH 16/55] Update utilities/review/constants/index.ts Co-authored-by: caco.eth <49823133+FrancoAguzzi@users.noreply.github.com> --- utilities/review/constants/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/review/constants/index.ts b/utilities/review/constants/index.ts index b9262ac3..e9d82e55 100644 --- a/utilities/review/constants/index.ts +++ b/utilities/review/constants/index.ts @@ -19,7 +19,7 @@ export const TRUSTFUL_SCORER = "0x3B0C859cD18B836Df11bB7c45E22993a5AbA0069"; export const RESOLVER_EAS = "0x9533A8B883128412ed228e73292D5DE55fd7cAe9"; export const RESOLVER_TRUSTFUL = "0x44b17f32Be8Dde88a43A0A39F3801343f2d5D446"; -/**Creating Review Configuration Answers to send to database. */ +/** Pre-review form interfaces to connect form to the API. */ export interface PreReviewAnswers { category: Category; otherCategoryDescriptions?: string; From 298762e08ce747a553f203f3b85ee36f852a01cb Mon Sep 17 00:00:00 2001 From: "heronlancellot.eth" Date: Wed, 9 Oct 2024 14:28:36 -0300 Subject: [PATCH 17/55] Update utilities/review/constants/index.ts Co-authored-by: caco.eth <49823133+FrancoAguzzi@users.noreply.github.com> --- utilities/review/constants/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/review/constants/index.ts b/utilities/review/constants/index.ts index e9d82e55..c159e35b 100644 --- a/utilities/review/constants/index.ts +++ b/utilities/review/constants/index.ts @@ -1,4 +1,4 @@ -import { Hex } from "viem"; +import { Address } from "viem"; // EAS contracts export const ARB_ONE_EAS = "0xbD75f629A22Dc1ceD33dDA0b68c546A1c035c458"; From 61f57bcc4ec762cc689983e3c6ea75e495666cbb Mon Sep 17 00:00:00 2001 From: "heronlancellot.eth" Date: Wed, 9 Oct 2024 14:28:52 -0300 Subject: [PATCH 18/55] Update styles/globals.css Co-authored-by: caco.eth <49823133+FrancoAguzzi@users.noreply.github.com> --- styles/globals.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/styles/globals.css b/styles/globals.css index e1265190..77a5dd4a 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -170,4 +170,5 @@ label { .no-scrollbar { -ms-overflow-style: none; /* IE and Edge */ scrollbar-width: none; /* Firefox */ - } \ No newline at end of file + } + \ No newline at end of file From 028abf06ae789566bf6cdb31e39ff90112022cce Mon Sep 17 00:00:00 2001 From: "heronlancellot.eth" Date: Wed, 9 Oct 2024 14:29:05 -0300 Subject: [PATCH 19/55] Update components/Pages/Project/Review/Skeleton.tsx Co-authored-by: caco.eth <49823133+FrancoAguzzi@users.noreply.github.com> --- components/Pages/Project/Review/Skeleton.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/Pages/Project/Review/Skeleton.tsx b/components/Pages/Project/Review/Skeleton.tsx index 9d5daf52..f08e6916 100644 --- a/components/Pages/Project/Review/Skeleton.tsx +++ b/components/Pages/Project/Review/Skeleton.tsx @@ -7,8 +7,8 @@ export const Skeleton = ({ roundedClass = "rounded-md", }: SkeletonProps) => { return ( -
-
+
+
); }; From d284e4884ec29d24d34bafbeea554a48c94bb9e2 Mon Sep 17 00:00:00 2001 From: "heronlancellot.eth" Date: Wed, 9 Oct 2024 14:29:19 -0300 Subject: [PATCH 20/55] Update components/Pages/Project/Review/NavbarReview.tsx Co-authored-by: caco.eth <49823133+FrancoAguzzi@users.noreply.github.com> --- components/Pages/Project/Review/NavbarReview.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/Pages/Project/Review/NavbarReview.tsx b/components/Pages/Project/Review/NavbarReview.tsx index 6643e3dd..6780e836 100644 --- a/components/Pages/Project/Review/NavbarReview.tsx +++ b/components/Pages/Project/Review/NavbarReview.tsx @@ -128,8 +128,7 @@ export const NavbarReview = () => { ) : (

- Be the first to share your thoughts! Reach out to the grantee and encourage them to - leave a review. + Be the first to share your thoughts! Sign-in and leave a review.

)} From d86312527d4c99f101aedc3491396cc301f73527 Mon Sep 17 00:00:00 2001 From: "heronlancellot.eth" Date: Wed, 9 Oct 2024 14:32:59 -0300 Subject: [PATCH 21/55] Update components/Pages/Project/Review/CardNewReview.tsx Co-authored-by: caco.eth <49823133+FrancoAguzzi@users.noreply.github.com> --- components/Pages/Project/Review/CardNewReview.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/components/Pages/Project/Review/CardNewReview.tsx b/components/Pages/Project/Review/CardNewReview.tsx index c3ffcaf5..210e1e5d 100644 --- a/components/Pages/Project/Review/CardNewReview.tsx +++ b/components/Pages/Project/Review/CardNewReview.tsx @@ -97,7 +97,6 @@ export const CardNewReview = () => { // return; // } - /** Creating Request to save label info into database */ const newPreReview: CreatePreReviewRequest = { connectedUserAddress: address, preReviewAnswers: { From bdbf6f1f65cfd944b1757ddc61371693bf42e06e Mon Sep 17 00:00:00 2001 From: "heronlancellot.eth" Date: Wed, 9 Oct 2024 14:33:14 -0300 Subject: [PATCH 22/55] Update components/Pages/Project/Review/CardNewReview.tsx Co-authored-by: caco.eth <49823133+FrancoAguzzi@users.noreply.github.com> --- components/Pages/Project/Review/CardNewReview.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/Pages/Project/Review/CardNewReview.tsx b/components/Pages/Project/Review/CardNewReview.tsx index 210e1e5d..d282c987 100644 --- a/components/Pages/Project/Review/CardNewReview.tsx +++ b/components/Pages/Project/Review/CardNewReview.tsx @@ -104,7 +104,7 @@ export const CardNewReview = () => { receivedGrant: didYouReceiveTheGrant, }, programId: 0x1dac0e2beeba6f3eec76117545f39f28e8ecc3d2c22731b6072b2d87e82fa35d, - // TODO: Get Category/ReceivedGrant/ProgramId dinamic + // TODO: Get Category/ReceivedGrant/ProgramId dynamically }; try { From b312d5210c0274309f6bd64cdb1a4a7d17cdb9f1 Mon Sep 17 00:00:00 2001 From: heronlancellot Date: Wed, 9 Oct 2024 14:51:42 -0300 Subject: [PATCH 23/55] fix: variable names --- .../Project/Review/ArrowNavigationBar.tsx | 2 +- .../Pages/Project/Review/CardNewReview.tsx | 36 +++++++++---------- utilities/review/constants/index.ts | 4 +-- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/components/Pages/Project/Review/ArrowNavigationBar.tsx b/components/Pages/Project/Review/ArrowNavigationBar.tsx index 6fb6ba64..3e96b518 100644 --- a/components/Pages/Project/Review/ArrowNavigationBar.tsx +++ b/components/Pages/Project/Review/ArrowNavigationBar.tsx @@ -27,7 +27,7 @@ export const ArrowNavigationBar = ({ centerID, skeletonMarkup, barContentMarkup, -}: ArrowNavigationBarProps) => { +}: HorizontalNavigationBarProps) => { const navigationBarWrapper = useRef(null); const { theme } = useTheme(); diff --git a/components/Pages/Project/Review/CardNewReview.tsx b/components/Pages/Project/Review/CardNewReview.tsx index d282c987..1f64880d 100644 --- a/components/Pages/Project/Review/CardNewReview.tsx +++ b/components/Pages/Project/Review/CardNewReview.tsx @@ -16,10 +16,10 @@ import { DynamicStarsReview } from "./DynamicStarsReview"; import { AbiCoder } from "ethers"; import { - Category, + CategoryOptions, CreatePreReviewRequest, KARMA_EAS_SCHEMA_UID, - ReceivedGrant, + ReceivedGrantOptions, } from "@/utilities/review/constants"; import { addPrefixToIPFSLink } from "@/utilities/review/constants/utilitary"; import { submitAttest } from "@/utilities/review/attest"; @@ -73,8 +73,8 @@ export const CardNewReview = () => { if (isValid && address) { const values = getValues(); - const whyDidYouApplyFor: Category = values.WhyDidYouApplyFor; - const didYouReceiveTheGrant: ReceivedGrant = values.DidYouReceiveTheGrant; + const whyDidYouApplyFor: CategoryOptions = values.WhyDidYouApplyFor; + const didYouReceiveTheGrant: ReceivedGrantOptions = values.DidYouReceiveTheGrant; if (whyDidYouApplyFor.length === 0 || didYouReceiveTheGrant.length === 0) { console.log("Você precisa selecionar uma opção em ambos os formulários."); @@ -101,10 +101,10 @@ export const CardNewReview = () => { connectedUserAddress: address, preReviewAnswers: { category: whyDidYouApplyFor, - receivedGrant: didYouReceiveTheGrant, + receivedGrantOptions: didYouReceiveTheGrant, }, programId: 0x1dac0e2beeba6f3eec76117545f39f28e8ecc3d2c22731b6072b2d87e82fa35d, - // TODO: Get Category/ReceivedGrant/ProgramId dynamically + // TODO: Get CategoryOptions/ReceivedGrantOptions/ProgramId dynamically }; try { @@ -185,21 +185,21 @@ export const CardNewReview = () => { }; const optionsWhyDidYouApplyFor = [ - { label: Category.DevTooling, value: Category.DevTooling }, - { label: Category.Education, value: Category.Education }, - { label: Category.MarketingAndGrowth, value: Category.MarketingAndGrowth }, - { label: Category.DeFi, value: Category.DeFi }, - { label: Category.DAOsAndGovernance, value: Category.DAOsAndGovernance }, - { label: Category.Community, value: Category.Community }, - { label: Category.PublicGoods, value: Category.PublicGoods }, - { label: Category.ZKAndPrivacy, value: Category.ZKAndPrivacy }, - { label: Category.Other, value: Category.Other }, + { label: CategoryOptions.DevTooling, value: CategoryOptions.DevTooling }, + { label: CategoryOptions.Education, value: CategoryOptions.Education }, + { label: CategoryOptions.MarketingAndGrowth, value: CategoryOptions.MarketingAndGrowth }, + { label: CategoryOptions.DeFi, value: CategoryOptions.DeFi }, + { label: CategoryOptions.DAOsAndGovernance, value: CategoryOptions.DAOsAndGovernance }, + { label: CategoryOptions.Community, value: CategoryOptions.Community }, + { label: CategoryOptions.PublicGoods, value: CategoryOptions.PublicGoods }, + { label: CategoryOptions.ZKAndPrivacy, value: CategoryOptions.ZKAndPrivacy }, + { label: CategoryOptions.Other, value: CategoryOptions.Other }, ]; const optionsDidYouReceiveTheGrant = [ - { label: ReceivedGrant.Yes, value: ReceivedGrant.Yes }, - { label: ReceivedGrant.No, value: ReceivedGrant.No }, - { label: ReceivedGrant.Pending, value: ReceivedGrant.Pending }, + { label: ReceivedGrantOptions.Yes, value: ReceivedGrantOptions.Yes }, + { label: ReceivedGrantOptions.No, value: ReceivedGrantOptions.No }, + { label: ReceivedGrantOptions.Pending, value: ReceivedGrantOptions.Pending }, ]; const onSubmit = (data: any) => { diff --git a/utilities/review/constants/index.ts b/utilities/review/constants/index.ts index c159e35b..ba449753 100644 --- a/utilities/review/constants/index.ts +++ b/utilities/review/constants/index.ts @@ -21,9 +21,9 @@ export const RESOLVER_TRUSTFUL = "0x44b17f32Be8Dde88a43A0A39F3801343f2d5D446"; /** Pre-review form interfaces to connect form to the API. */ export interface PreReviewAnswers { - category: Category; + category: CategoryOptions; otherCategoryDescriptions?: string; - receivedGrant: ReceivedGrant; + receivedGrantOptions: ReceivedGrantOptions; } export interface CreatePreReviewRequest { From 9d64f02664cc067abe3d7a6f81b5259719ed36c3 Mon Sep 17 00:00:00 2001 From: heronlancellot Date: Wed, 9 Oct 2024 14:58:48 -0300 Subject: [PATCH 24/55] fix: interface with dynamic data --- .../Pages/Project/Review/CardNewReview.tsx | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/components/Pages/Project/Review/CardNewReview.tsx b/components/Pages/Project/Review/CardNewReview.tsx index 1f64880d..deab40a6 100644 --- a/components/Pages/Project/Review/CardNewReview.tsx +++ b/components/Pages/Project/Review/CardNewReview.tsx @@ -184,23 +184,29 @@ export const CardNewReview = () => { setIsOpenReview(ReviewMode.READ); }; - const optionsWhyDidYouApplyFor = [ - { label: CategoryOptions.DevTooling, value: CategoryOptions.DevTooling }, - { label: CategoryOptions.Education, value: CategoryOptions.Education }, - { label: CategoryOptions.MarketingAndGrowth, value: CategoryOptions.MarketingAndGrowth }, - { label: CategoryOptions.DeFi, value: CategoryOptions.DeFi }, - { label: CategoryOptions.DAOsAndGovernance, value: CategoryOptions.DAOsAndGovernance }, - { label: CategoryOptions.Community, value: CategoryOptions.Community }, - { label: CategoryOptions.PublicGoods, value: CategoryOptions.PublicGoods }, - { label: CategoryOptions.ZKAndPrivacy, value: CategoryOptions.ZKAndPrivacy }, - { label: CategoryOptions.Other, value: CategoryOptions.Other }, - ]; + interface OptionsWhyDidYouApplyFor { + label: CategoryOptions; + value: CategoryOptions; + } - const optionsDidYouReceiveTheGrant = [ - { label: ReceivedGrantOptions.Yes, value: ReceivedGrantOptions.Yes }, - { label: ReceivedGrantOptions.No, value: ReceivedGrantOptions.No }, - { label: ReceivedGrantOptions.Pending, value: ReceivedGrantOptions.Pending }, - ]; + interface OptionsDidYouReceiveTheGrant { + label: ReceivedGrantOptions; + value: ReceivedGrantOptions; + } + + const optionsWhyDidYouApplyFor: OptionsWhyDidYouApplyFor[] = Object.values(CategoryOptions).map( + (category) => ({ + label: category, + value: category, + }), + ); + + const optionsDidYouReceiveTheGrant: OptionsDidYouReceiveTheGrant[] = Object.values( + ReceivedGrantOptions, + ).map((option) => ({ + label: option, + value: option, + })); const onSubmit = (data: any) => { console.log("data", data); From 222c50f8315cf87a81142ae43202069de916287d Mon Sep 17 00:00:00 2001 From: heronlancellot Date: Wed, 9 Oct 2024 15:02:43 -0300 Subject: [PATCH 25/55] fix: card-new-review unnused code & add toast --- .../Pages/Project/Review/CardNewReview.tsx | 22 +++---------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/components/Pages/Project/Review/CardNewReview.tsx b/components/Pages/Project/Review/CardNewReview.tsx index deab40a6..fc1cf74c 100644 --- a/components/Pages/Project/Review/CardNewReview.tsx +++ b/components/Pages/Project/Review/CardNewReview.tsx @@ -77,26 +77,10 @@ export const CardNewReview = () => { const didYouReceiveTheGrant: ReceivedGrantOptions = values.DidYouReceiveTheGrant; if (whyDidYouApplyFor.length === 0 || didYouReceiveTheGrant.length === 0) { + toast.error("Select a valid option in both forms."); + console.log("Você precisa selecionar uma opção em ambos os formulários."); } else { - console.log("Valores do formulário:", values); - - // const connectedUserAddressData = { - // connectedUserAddress: address, - // }; - - // try { - // const axiosPostBD = await axios.post( - // "http://localhost:3001/api/v1/users", - // connectedUserAddressData, - // ); - // console.log("axiosPostBD", axiosPostBD); - // } catch (error) { - // console.error("Error creating User:", error); - // toast.error("Error creating User. Try again."); - // return; - // } - const newPreReview: CreatePreReviewRequest = { connectedUserAddress: address, preReviewAnswers: { @@ -120,7 +104,7 @@ export const CardNewReview = () => { } } } else { - console.log("Validação falhou."); + toast.error("Validation failed."); } }; From 6ca0747225c60183fbedc475e875361b3c207b54 Mon Sep 17 00:00:00 2001 From: heronlancellot Date: Wed, 9 Oct 2024 15:06:49 -0300 Subject: [PATCH 26/55] fix: remove hardcoded date --- components/Pages/Project/Review/CardReview.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/Pages/Project/Review/CardReview.tsx b/components/Pages/Project/Review/CardReview.tsx index ae037a0c..a8c96977 100644 --- a/components/Pages/Project/Review/CardReview.tsx +++ b/components/Pages/Project/Review/CardReview.tsx @@ -9,6 +9,7 @@ import { getBadge } from "@/utilities/review/getBadge"; import { DynamicStarsReview } from "./DynamicStarsReview"; import { Hex } from "viem"; +import { formatDate } from "@/utilities/formatDate"; export const CardReview = ({ storie }: { storie: GrantStory }) => { const badges = useReviewStore((state: any) => state.badges); @@ -41,7 +42,7 @@ export const CardReview = ({ storie }: { storie: GrantStory }) => { /

- September 9, 2024 + {formatDate(new Date(Number(storie.timestamp) * 1000))}

{storie && From b6850aed8a86d8380dbed590e0e6eb3bddf01731 Mon Sep 17 00:00:00 2001 From: heronlancellot Date: Wed, 9 Oct 2024 17:07:13 -0300 Subject: [PATCH 27/55] update: api interface --- components/Pages/Project/Review/CardNewReview.tsx | 11 ++++------- utilities/review/constants/index.ts | 4 ++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/components/Pages/Project/Review/CardNewReview.tsx b/components/Pages/Project/Review/CardNewReview.tsx index fc1cf74c..a427f018 100644 --- a/components/Pages/Project/Review/CardNewReview.tsx +++ b/components/Pages/Project/Review/CardNewReview.tsx @@ -78,17 +78,14 @@ export const CardNewReview = () => { if (whyDidYouApplyFor.length === 0 || didYouReceiveTheGrant.length === 0) { toast.error("Select a valid option in both forms."); - - console.log("Você precisa selecionar uma opção em ambos os formulários."); } else { const newPreReview: CreatePreReviewRequest = { connectedUserAddress: address, preReviewAnswers: { category: whyDidYouApplyFor, - receivedGrantOptions: didYouReceiveTheGrant, + receivedGrant: didYouReceiveTheGrant, }, - programId: 0x1dac0e2beeba6f3eec76117545f39f28e8ecc3d2c22731b6072b2d87e82fa35d, - // TODO: Get CategoryOptions/ReceivedGrantOptions/ProgramId dynamically + grantId: grantUID, }; try { @@ -142,6 +139,8 @@ export const CardNewReview = () => { [grantUID, activeBadgeIds, badgeScores], ); + await handleSubmitAnswersReview(); + const response = await submitAttest( address, KARMA_EAS_SCHEMA_UID, @@ -153,8 +152,6 @@ export const CardNewReview = () => { walletClient, ); - handleSubmitAnswersReview(); - if (response instanceof Error) { toast.error("Error submitting review. Try again."); return; diff --git a/utilities/review/constants/index.ts b/utilities/review/constants/index.ts index ba449753..0b692d6c 100644 --- a/utilities/review/constants/index.ts +++ b/utilities/review/constants/index.ts @@ -23,13 +23,13 @@ export const RESOLVER_TRUSTFUL = "0x44b17f32Be8Dde88a43A0A39F3801343f2d5D446"; export interface PreReviewAnswers { category: CategoryOptions; otherCategoryDescriptions?: string; - receivedGrantOptions: ReceivedGrantOptions; + receivedGrant: ReceivedGrantOptions; } export interface CreatePreReviewRequest { preReviewAnswers: PreReviewAnswers; connectedUserAddress: Address; - programId: number; + grantId: string; } export enum CategoryOptions { From a3691897da6cbb32593db9e1e84c1a423ba4097d Mon Sep 17 00:00:00 2001 From: heronlancellot Date: Fri, 11 Oct 2024 15:04:24 -0300 Subject: [PATCH 28/55] feat: add card-new-review-railway-backend-constant --- components/Pages/Project/Review/CardNewReview.tsx | 11 ++++++----- utilities/review/constants/index.ts | 2 ++ 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/components/Pages/Project/Review/CardNewReview.tsx b/components/Pages/Project/Review/CardNewReview.tsx index a427f018..9c69b114 100644 --- a/components/Pages/Project/Review/CardNewReview.tsx +++ b/components/Pages/Project/Review/CardNewReview.tsx @@ -19,6 +19,7 @@ import { CategoryOptions, CreatePreReviewRequest, KARMA_EAS_SCHEMA_UID, + RAILWAY_BACKEND, ReceivedGrantOptions, } from "@/utilities/review/constants"; import { addPrefixToIPFSLink } from "@/utilities/review/constants/utilitary"; @@ -82,18 +83,18 @@ export const CardNewReview = () => { const newPreReview: CreatePreReviewRequest = { connectedUserAddress: address, preReviewAnswers: { - category: whyDidYouApplyFor, - receivedGrant: didYouReceiveTheGrant, + category: whyDidYouApplyFor[0] as CategoryOptions, + receivedGrant: didYouReceiveTheGrant[0] as ReceivedGrantOptions, }, grantId: grantUID, }; try { - const axiosPostBD = await axios.post( - "http://localhost:3001/api/v1/reviews", + const createPreReview = await axios.post( + `${RAILWAY_BACKEND}/api/v1/reviews`, newPreReview, ); - console.log("axiosPostBD", axiosPostBD); + console.log("createPreReview", createPreReview); } catch (error) { console.error("Error posting review:", error); toast.error("Error submitting review. Try again."); diff --git a/utilities/review/constants/index.ts b/utilities/review/constants/index.ts index 0b692d6c..b2b38cb3 100644 --- a/utilities/review/constants/index.ts +++ b/utilities/review/constants/index.ts @@ -19,6 +19,8 @@ export const TRUSTFUL_SCORER = "0x3B0C859cD18B836Df11bB7c45E22993a5AbA0069"; export const RESOLVER_EAS = "0x9533A8B883128412ed228e73292D5DE55fd7cAe9"; export const RESOLVER_TRUSTFUL = "0x44b17f32Be8Dde88a43A0A39F3801343f2d5D446"; +export const RAILWAY_BACKEND = "https://trustful-karma-gap-backend-staging.up.railway.app"; + /** Pre-review form interfaces to connect form to the API. */ export interface PreReviewAnswers { category: CategoryOptions; From 1ba7c3cbbf21a872430f6eb62e1f14319ae2185e Mon Sep 17 00:00:00 2001 From: heronlancellot Date: Fri, 11 Oct 2024 15:15:40 -0300 Subject: [PATCH 29/55] feat: add programId optionally into pre-review-request --- utilities/review/constants/index.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/utilities/review/constants/index.ts b/utilities/review/constants/index.ts index b2b38cb3..3a970d8d 100644 --- a/utilities/review/constants/index.ts +++ b/utilities/review/constants/index.ts @@ -32,6 +32,7 @@ export interface CreatePreReviewRequest { preReviewAnswers: PreReviewAnswers; connectedUserAddress: Address; grantId: string; + programId?: string; } export enum CategoryOptions { From 50a6709ee9358c5590919390f06397c7e587a4bf Mon Sep 17 00:00:00 2001 From: heronlancellot Date: Mon, 14 Oct 2024 17:20:12 -0300 Subject: [PATCH 30/55] update: grant-UID & program-UID retrieved by params --- .../Pages/Project/Review/CardNewReview.tsx | 18 ++++++++++++++++-- .../Pages/Project/Review/NavbarReview.tsx | 18 +++++++++++++----- components/Pages/Project/Review/index.tsx | 5 +++-- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/components/Pages/Project/Review/CardNewReview.tsx b/components/Pages/Project/Review/CardNewReview.tsx index 9c69b114..4c660604 100644 --- a/components/Pages/Project/Review/CardNewReview.tsx +++ b/components/Pages/Project/Review/CardNewReview.tsx @@ -29,8 +29,13 @@ import { config } from "@/utilities/wagmi/config"; import { useForm, Controller } from "react-hook-form"; import { CheckIcon } from "@heroicons/react/24/solid"; import axios from "axios"; +import { IGrantResponse } from "@show-karma/karma-gap-sdk/core/class/karma-indexer/api/types"; -export const CardNewReview = () => { +interface GrantAllReviewsProps { + grant: IGrantResponse | undefined; +} + +export const CardNewReview = ({ grant }: GrantAllReviewsProps) => { const { control, handleSubmit, getValues, trigger } = useForm(); const setIsOpenReview = useReviewStore((state: any) => state.setIsOpenReview); const setBadgeScores = useReviewStore((state: any) => state.setBadgeScores); @@ -47,13 +52,16 @@ export const CardNewReview = () => { const searchParams = useSearchParams(); const { data: walletClient } = useWalletClient({ config }); + const programId = grant?.details?.data.programId; useEffect(() => { // Fill the starts with a score of 1 when the badges render if (activeBadges) { setBadgeScores(Array(activeBadges.length).fill(1)); } const grantIdFromQueryParam = searchParams?.get("grantId"); - if (grantIdFromQueryParam) { + if (grant?.refUID) { + setGrantUID(grant.refUID); + } else if (grantIdFromQueryParam) { setGrantUID(grantIdFromQueryParam); } }, [activeBadges]); @@ -80,6 +88,11 @@ export const CardNewReview = () => { if (whyDidYouApplyFor.length === 0 || didYouReceiveTheGrant.length === 0) { toast.error("Select a valid option in both forms."); } else { + const programUID = programId ? programId.split("_").pop() : undefined; + + console.log("programUID", programUID); + console.log("grantUID", grantUID); + const newPreReview: CreatePreReviewRequest = { connectedUserAddress: address, preReviewAnswers: { @@ -87,6 +100,7 @@ export const CardNewReview = () => { receivedGrant: didYouReceiveTheGrant[0] as ReceivedGrantOptions, }, grantId: grantUID, + programId: programUID, }; try { diff --git a/components/Pages/Project/Review/NavbarReview.tsx b/components/Pages/Project/Review/NavbarReview.tsx index 6780e836..3f163d6a 100644 --- a/components/Pages/Project/Review/NavbarReview.tsx +++ b/components/Pages/Project/Review/NavbarReview.tsx @@ -12,8 +12,13 @@ import { ClockIcon } from "@/components/Icons/ClockIcon"; import { DynamicStarsReview } from "./DynamicStarsReview"; import { ArrowNavigationBar } from "./ArrowNavigationBar"; import { Skeleton } from "./Skeleton"; +import { IGrantResponse } from "@show-karma/karma-gap-sdk/core/class/karma-indexer/api/types"; -export const NavbarReview = () => { +interface GrantAllReviewsProps { + grant: IGrantResponse | undefined; +} + +export const NavbarReview = ({ grant }: GrantAllReviewsProps) => { const isStarSelected = useReviewStore((state: any) => state.isStarSelected); const stories = useReviewStore((state: any) => state.stories); const grantUID = useReviewStore((state: any) => state.grantUID); @@ -54,11 +59,16 @@ export const NavbarReview = () => { useEffect(() => { const grantIdFromQueryParam = searchParams?.get("grantId"); + if (grantIdFromQueryParam && grantUID !== grantIdFromQueryParam) { setBadges(null); setStories(null); setIsStarSelected(0); - setGrantUID(grantIdFromQueryParam); + if (grant?.refUID) { + setGrantUID(grant.refUID); + } else { + setGrantUID(grantIdFromQueryParam); + } } if (grantUID && !stories) { @@ -127,9 +137,7 @@ export const NavbarReview = () => { )) ) : (
-

- Be the first to share your thoughts! Sign-in and leave a review. -

+

Be the first to share your thoughts! Sign-in and leave a review.

)}
diff --git a/components/Pages/Project/Review/index.tsx b/components/Pages/Project/Review/index.tsx index 4bbf8148..34c5fdd4 100644 --- a/components/Pages/Project/Review/index.tsx +++ b/components/Pages/Project/Review/index.tsx @@ -21,6 +21,7 @@ export const ReviewSection = ({ grant }: GrantAllReviewsProps) => {
; } + const isOpenReview = useReviewStore((state: any) => state.isOpenReview); const setIsOpenReview = useReviewStore((state: any) => state.setIsOpenReview); @@ -41,13 +42,13 @@ export const ReviewSection = ({ grant }: GrantAllReviewsProps) => { Write a new review
- + ) : ( isOpenReview === ReviewMode.READ && ( <> - + ) )} From 6e81d81fa7f2bbb500ae1ac73d722ef672e2a417 Mon Sep 17 00:00:00 2001 From: heronlancellot Date: Mon, 14 Oct 2024 17:33:49 -0300 Subject: [PATCH 31/55] fix: interface to interface inline --- components/Pages/Project/Review/CardNewReview.tsx | 6 +----- components/Pages/Project/Review/NavbarReview.tsx | 6 +----- components/Pages/Project/Review/index.tsx | 6 +----- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/components/Pages/Project/Review/CardNewReview.tsx b/components/Pages/Project/Review/CardNewReview.tsx index 4c660604..0dee4cce 100644 --- a/components/Pages/Project/Review/CardNewReview.tsx +++ b/components/Pages/Project/Review/CardNewReview.tsx @@ -31,11 +31,7 @@ import { CheckIcon } from "@heroicons/react/24/solid"; import axios from "axios"; import { IGrantResponse } from "@show-karma/karma-gap-sdk/core/class/karma-indexer/api/types"; -interface GrantAllReviewsProps { - grant: IGrantResponse | undefined; -} - -export const CardNewReview = ({ grant }: GrantAllReviewsProps) => { +export const CardNewReview = ({ grant }: { grant: IGrantResponse | undefined }) => { const { control, handleSubmit, getValues, trigger } = useForm(); const setIsOpenReview = useReviewStore((state: any) => state.setIsOpenReview); const setBadgeScores = useReviewStore((state: any) => state.setBadgeScores); diff --git a/components/Pages/Project/Review/NavbarReview.tsx b/components/Pages/Project/Review/NavbarReview.tsx index 3f163d6a..71b22de0 100644 --- a/components/Pages/Project/Review/NavbarReview.tsx +++ b/components/Pages/Project/Review/NavbarReview.tsx @@ -14,11 +14,7 @@ import { ArrowNavigationBar } from "./ArrowNavigationBar"; import { Skeleton } from "./Skeleton"; import { IGrantResponse } from "@show-karma/karma-gap-sdk/core/class/karma-indexer/api/types"; -interface GrantAllReviewsProps { - grant: IGrantResponse | undefined; -} - -export const NavbarReview = ({ grant }: GrantAllReviewsProps) => { +export const NavbarReview = ({ grant }: { grant: IGrantResponse | undefined }) => { const isStarSelected = useReviewStore((state: any) => state.isStarSelected); const stories = useReviewStore((state: any) => state.stories); const grantUID = useReviewStore((state: any) => state.grantUID); diff --git a/components/Pages/Project/Review/index.tsx b/components/Pages/Project/Review/index.tsx index 34c5fdd4..0eed5e23 100644 --- a/components/Pages/Project/Review/index.tsx +++ b/components/Pages/Project/Review/index.tsx @@ -10,11 +10,7 @@ import { ChevronLeftIcon } from "@heroicons/react/24/solid"; import { CardNewReview } from "./CardNewReview"; import { CardReviewSummary } from "./CardReviewSummary"; -interface GrantAllReviewsProps { - grant: IGrantResponse | undefined; -} - -export const ReviewSection = ({ grant }: GrantAllReviewsProps) => { +export const ReviewSection = ({ grant }: { grant: IGrantResponse | undefined }) => { const isProjectLoading = useProjectStore((state: any) => state.loading); if (isProjectLoading || !grant) {
From a11ba4498697c282d9288a7cb6521c6233c3293d Mon Sep 17 00:00:00 2001 From: heronlancellot Date: Mon, 14 Oct 2024 17:54:28 -0300 Subject: [PATCH 32/55] update: contract-call --- components/Pages/Project/Review/CardNewReview.tsx | 9 +++++---- utilities/review/attest.ts | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/components/Pages/Project/Review/CardNewReview.tsx b/components/Pages/Project/Review/CardNewReview.tsx index 0dee4cce..ad4e923a 100644 --- a/components/Pages/Project/Review/CardNewReview.tsx +++ b/components/Pages/Project/Review/CardNewReview.tsx @@ -48,7 +48,10 @@ export const CardNewReview = ({ grant }: { grant: IGrantResponse | undefined }) const searchParams = useSearchParams(); const { data: walletClient } = useWalletClient({ config }); + console.log("grant", grant); const programId = grant?.details?.data.programId; + const programUID = programId ? programId.split("_")[0] : undefined; + useEffect(() => { // Fill the starts with a score of 1 when the badges render if (activeBadges) { @@ -84,8 +87,6 @@ export const CardNewReview = ({ grant }: { grant: IGrantResponse | undefined }) if (whyDidYouApplyFor.length === 0 || didYouReceiveTheGrant.length === 0) { toast.error("Select a valid option in both forms."); } else { - const programUID = programId ? programId.split("_").pop() : undefined; - console.log("programUID", programUID); console.log("grantUID", grantUID); @@ -146,8 +147,8 @@ export const CardNewReview = ({ grant }: { grant: IGrantResponse | undefined }) // Encode the data const abiCoder = new AbiCoder(); const encodedData = abiCoder.encode( - ["bytes32", "bytes32[]", "uint8[]"], - [grantUID, activeBadgeIds, badgeScores], + ["bytes32", "bytes32[]", "uint8[]", "uint8[]"], + [grantUID, activeBadgeIds, badgeScores, programUID], ); await handleSubmitAnswersReview(); diff --git a/utilities/review/attest.ts b/utilities/review/attest.ts index 4228aaa4..2e71f662 100644 --- a/utilities/review/attest.ts +++ b/utilities/review/attest.ts @@ -35,7 +35,7 @@ export async function submitAttest( recipient: Hex, expirationTime: bigint, revocable: boolean, - refUID: Hex, + refUID: Hex, // GrantUID data: Hex, walletClient: WalletClient, ): Promise { From 8931ec483027aafbc096bbae3fd329f10418a1b5 Mon Sep 17 00:00:00 2001 From: RafaDSan Date: Tue, 15 Oct 2024 12:10:32 -0300 Subject: [PATCH 33/55] feat: added new deployed contracts --- utilities/review/constants/index.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/utilities/review/constants/index.ts b/utilities/review/constants/index.ts index 3a970d8d..0c1db3fc 100644 --- a/utilities/review/constants/index.ts +++ b/utilities/review/constants/index.ts @@ -6,18 +6,18 @@ export const ARB_ONE_SCHEMA_REGISTRY = "0xA310da9c5B885E7fb3fbA9D66E9Ba6Df512b78 // The schema UID for EAS export const KARMA_EAS_SCHEMA_UID = - "0x02dc5a92e5634ce3d8dd933067df1b53f661b1a53bcf8f17110c7d1ff884621f"; + "0x7cf7c9d2dcff65ed9d3271c4b15efbe76a42bf36049f15ccf2b8153c89cc1366"; // The Karma-Gap scorer ID constant export const SCORER_ID = 1; // The Karma-Gap scorer decimals amount export const SCORER_DECIMALS = 18; // The Trustful-Karma contracts -export const GRANT_REGISTRY = "0x676FD4b8bC208460D9E438F7aAA5E95D580aBB8f"; -export const BADGE_REGISTRY = "0xF0d7f324521B6f93EA6b9B8DB934E1D01C0c75b0"; -export const TRUSTFUL_SCORER = "0x3B0C859cD18B836Df11bB7c45E22993a5AbA0069"; -export const RESOLVER_EAS = "0x9533A8B883128412ed228e73292D5DE55fd7cAe9"; -export const RESOLVER_TRUSTFUL = "0x44b17f32Be8Dde88a43A0A39F3801343f2d5D446"; +export const GRANT_REGISTRY = "0x2E6De0735b896dD248B08dcb9BA1f1f6Dd5bf1B7"; +export const BADGE_REGISTRY = "0x95d4123c5fA150B04dD56b0ab5141DEcB41725b0"; +export const TRUSTFUL_SCORER = "0xa402A493780AA7C40468336f6A5Afea5814891bF"; +export const RESOLVER_EAS = "0xbAc1B69837EB8d68294cBDF81acbfE57250264CF"; +export const RESOLVER_TRUSTFUL = "0x12Fe1E060B0B1c4Efc6d7A8dC9394ffC53842b78"; export const RAILWAY_BACKEND = "https://trustful-karma-gap-backend-staging.up.railway.app"; From 53fe8f9ff8acbfc9720135783f5944203128c1e0 Mon Sep 17 00:00:00 2001 From: RafaDSan Date: Tue, 15 Oct 2024 12:11:28 -0300 Subject: [PATCH 34/55] fix: checking storie before proceed --- components/Pages/Project/Review/NavbarReview.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/Pages/Project/Review/NavbarReview.tsx b/components/Pages/Project/Review/NavbarReview.tsx index 71b22de0..75562521 100644 --- a/components/Pages/Project/Review/NavbarReview.tsx +++ b/components/Pages/Project/Review/NavbarReview.tsx @@ -152,7 +152,9 @@ export const NavbarReview = ({ grant }: { grant: IGrantResponse | undefined }) =
- {isStarSelected !== null && stories && } + {isStarSelected !== null && stories && stories[isStarSelected] && ( + + )}
); From b5cf5992994c1e30c5eb373e2d58150009f82904 Mon Sep 17 00:00:00 2001 From: RafaDSan Date: Tue, 15 Oct 2024 12:11:41 -0300 Subject: [PATCH 35/55] fix: correct grantProgramId type in schema --- components/Pages/Project/Review/CardNewReview.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/Pages/Project/Review/CardNewReview.tsx b/components/Pages/Project/Review/CardNewReview.tsx index ad4e923a..a69c827d 100644 --- a/components/Pages/Project/Review/CardNewReview.tsx +++ b/components/Pages/Project/Review/CardNewReview.tsx @@ -147,7 +147,7 @@ export const CardNewReview = ({ grant }: { grant: IGrantResponse | undefined }) // Encode the data const abiCoder = new AbiCoder(); const encodedData = abiCoder.encode( - ["bytes32", "bytes32[]", "uint8[]", "uint8[]"], + ["bytes32", "bytes32[]", "uint8[]", "uint32"], [grantUID, activeBadgeIds, badgeScores, programUID], ); From 1358143f84cf4502630a1f8998b56d0123d78a7b Mon Sep 17 00:00:00 2001 From: RafaDSan Date: Tue, 15 Oct 2024 14:49:12 -0300 Subject: [PATCH 36/55] fix: fixed smart contracts updated --- utilities/review/constants/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utilities/review/constants/index.ts b/utilities/review/constants/index.ts index 0c1db3fc..01210a23 100644 --- a/utilities/review/constants/index.ts +++ b/utilities/review/constants/index.ts @@ -6,7 +6,7 @@ export const ARB_ONE_SCHEMA_REGISTRY = "0xA310da9c5B885E7fb3fbA9D66E9Ba6Df512b78 // The schema UID for EAS export const KARMA_EAS_SCHEMA_UID = - "0x7cf7c9d2dcff65ed9d3271c4b15efbe76a42bf36049f15ccf2b8153c89cc1366"; + "0x215ea84cc93b044073f5240366c1ee273727d6a18242b5f1918dbebd9c6e8a08"; // The Karma-Gap scorer ID constant export const SCORER_ID = 1; // The Karma-Gap scorer decimals amount @@ -15,9 +15,9 @@ export const SCORER_DECIMALS = 18; // The Trustful-Karma contracts export const GRANT_REGISTRY = "0x2E6De0735b896dD248B08dcb9BA1f1f6Dd5bf1B7"; export const BADGE_REGISTRY = "0x95d4123c5fA150B04dD56b0ab5141DEcB41725b0"; -export const TRUSTFUL_SCORER = "0xa402A493780AA7C40468336f6A5Afea5814891bF"; -export const RESOLVER_EAS = "0xbAc1B69837EB8d68294cBDF81acbfE57250264CF"; -export const RESOLVER_TRUSTFUL = "0x12Fe1E060B0B1c4Efc6d7A8dC9394ffC53842b78"; +export const TRUSTFUL_SCORER = "0x45921d3b90fBb9700F078d7887caa0e3D949C264"; +export const RESOLVER_EAS = "0xb054902Edf1cb8F8fBC4e442A222B936d981C6D3"; +export const RESOLVER_TRUSTFUL = "0xEE85D33c370d61321d2F932b0275F6C52E429C8e"; export const RAILWAY_BACKEND = "https://trustful-karma-gap-backend-staging.up.railway.app"; From d61bde4fb02d4131ef228cc479e8b13f2e0b9e92 Mon Sep 17 00:00:00 2001 From: RafaDSan Date: Tue, 15 Oct 2024 14:49:31 -0300 Subject: [PATCH 37/55] fix: fixed error when null badges --- components/Pages/Project/Review/CardReview.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/Pages/Project/Review/CardReview.tsx b/components/Pages/Project/Review/CardReview.tsx index a8c96977..edd1a6f1 100644 --- a/components/Pages/Project/Review/CardReview.tsx +++ b/components/Pages/Project/Review/CardReview.tsx @@ -23,12 +23,14 @@ export const CardReview = ({ storie }: { storie: GrantStory }) => { const handleBadges = async () => { const badgesIds = storie.badgeIds; - const badges = await Promise.all( + const fetchedBadges = await Promise.all( badgesIds.map(async (badgeId: Hex): Promise => { return await getBadge(badgeId); }), ); - setBadges(badges); + // Filter out null values + const validBadges = fetchedBadges.filter((badge): badge is Badge => badge !== null); + setBadges(validBadges); }; return ( From 07d1a59f96de46b6652577a231f17844297ec2a0 Mon Sep 17 00:00:00 2001 From: RafaDSan Date: Tue, 15 Oct 2024 14:50:01 -0300 Subject: [PATCH 38/55] fix: fixed error when undefined scores --- .../Pages/Project/Review/CardNewReview.tsx | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/components/Pages/Project/Review/CardNewReview.tsx b/components/Pages/Project/Review/CardNewReview.tsx index a69c827d..8e6e0c3f 100644 --- a/components/Pages/Project/Review/CardNewReview.tsx +++ b/components/Pages/Project/Review/CardNewReview.tsx @@ -55,7 +55,9 @@ export const CardNewReview = ({ grant }: { grant: IGrantResponse | undefined }) useEffect(() => { // Fill the starts with a score of 1 when the badges render if (activeBadges) { - setBadgeScores(Array(activeBadges.length).fill(1)); + const initialScores = Array(activeBadges.length).fill(1); + console.log("Initializing badge scores:", initialScores); + setBadgeScores(initialScores); } const grantIdFromQueryParam = searchParams?.get("grantId"); if (grant?.refUID) { @@ -67,11 +69,14 @@ export const CardNewReview = ({ grant }: { grant: IGrantResponse | undefined }) // Score of the new review const handleSetRating = (index: number, rating: number) => { - if (rating >= 1 || rating <= 5) { - const updatededBadges = [...badgeScores]; - updatededBadges[index] = rating; - setBadgeScores(updatededBadges); + console.log(`Attempting to set rating ${rating} for index ${index}`); + if (rating >= 1 && rating <= 5) { + const updatedBadges = [...badgeScores]; + updatedBadges[index] = Math.round(rating); + console.log("Updated badge scores:", updatedBadges); + setBadgeScores(updatedBadges); } else { + console.error(`Invalid rating: ${rating}. Must be between 1 and 5.`); toast.error("Invalid rating. Can only score between 1 and 5"); } }; @@ -144,12 +149,18 @@ export const CardNewReview = ({ grant }: { grant: IGrantResponse | undefined }) ); } + console.log("grantUID:", grantUID); + console.log("activeBadgeIds:", activeBadgeIds); + console.log("badgeScores:", badgeScores); + console.log("programUID:", programUID); // Encode the data const abiCoder = new AbiCoder(); + console.log("Badge scores being encoded:", badgeScores); const encodedData = abiCoder.encode( ["bytes32", "bytes32[]", "uint8[]", "uint32"], [grantUID, activeBadgeIds, badgeScores, programUID], ); + console.log("Encoded data:", encodedData); await handleSubmitAnswersReview(); From 8c1f73a01a4303f2063ad3b202f4ec460fb6453e Mon Sep 17 00:00:00 2001 From: FrancoAguzzi Date: Wed, 16 Oct 2024 18:12:44 -0300 Subject: [PATCH 39/55] fix: align grantUID and programUID usage in review forms --- .../Pages/Project/Review/CardNewReview.tsx | 48 ++++++++++++------- .../Project/Review/CardReviewSummary.tsx | 4 +- .../Pages/Project/Review/NavbarReview.tsx | 4 +- 3 files changed, 35 insertions(+), 21 deletions(-) diff --git a/components/Pages/Project/Review/CardNewReview.tsx b/components/Pages/Project/Review/CardNewReview.tsx index 8e6e0c3f..d78e090f 100644 --- a/components/Pages/Project/Review/CardNewReview.tsx +++ b/components/Pages/Project/Review/CardNewReview.tsx @@ -48,8 +48,7 @@ export const CardNewReview = ({ grant }: { grant: IGrantResponse | undefined }) const searchParams = useSearchParams(); const { data: walletClient } = useWalletClient({ config }); - console.log("grant", grant); - const programId = grant?.details?.data.programId; + const programId = grant?.refUID; const programUID = programId ? programId.split("_")[0] : undefined; useEffect(() => { @@ -60,8 +59,8 @@ export const CardNewReview = ({ grant }: { grant: IGrantResponse | undefined }) setBadgeScores(initialScores); } const grantIdFromQueryParam = searchParams?.get("grantId"); - if (grant?.refUID) { - setGrantUID(grant.refUID); + if (grant?.details?.refUID) { + setGrantUID(grant?.details?.refUID); } else if (grantIdFromQueryParam) { setGrantUID(grantIdFromQueryParam); } @@ -81,7 +80,7 @@ export const CardNewReview = ({ grant }: { grant: IGrantResponse | undefined }) } }; - const handleSubmitAnswersReview = async () => { + const handleSubmitAnswersReview = async (): Promise => { const isValid = await trigger(["WhyDidYouApplyFor", "DidYouReceiveTheGrant"]); if (isValid && address) { @@ -91,10 +90,9 @@ export const CardNewReview = ({ grant }: { grant: IGrantResponse | undefined }) if (whyDidYouApplyFor.length === 0 || didYouReceiveTheGrant.length === 0) { toast.error("Select a valid option in both forms."); - } else { - console.log("programUID", programUID); - console.log("grantUID", grantUID); + return false; + } else { const newPreReview: CreatePreReviewRequest = { connectedUserAddress: address, preReviewAnswers: { @@ -110,21 +108,23 @@ export const CardNewReview = ({ grant }: { grant: IGrantResponse | undefined }) `${RAILWAY_BACKEND}/api/v1/reviews`, newPreReview, ); - console.log("createPreReview", createPreReview); + + return true; } catch (error) { console.error("Error posting review:", error); toast.error("Error submitting review. Try again."); - return; + + return false; } } } else { toast.error("Validation failed."); + return false; } }; /** * Handles the submission of a review to submitAttest. - * */ const handleSubmitReview = async () => { if (!address) { @@ -156,13 +156,27 @@ export const CardNewReview = ({ grant }: { grant: IGrantResponse | undefined }) // Encode the data const abiCoder = new AbiCoder(); console.log("Badge scores being encoded:", badgeScores); - const encodedData = abiCoder.encode( - ["bytes32", "bytes32[]", "uint8[]", "uint32"], - [grantUID, activeBadgeIds, badgeScores, programUID], - ); - console.log("Encoded data:", encodedData); - await handleSubmitAnswersReview(); + let encodedData; + const programUIDisNumber = Number.isNaN(Number(programUID)); + + if (programUIDisNumber) { + encodedData = abiCoder.encode( + ["bytes32", "bytes32[]", "uint8[]", "uint32"], + [grantUID, activeBadgeIds, badgeScores, programUID], + ); + } else { + encodedData = abiCoder.encode( + ["bytes32", "bytes32[]", "uint8[]", "bytes32"], + [grantUID, activeBadgeIds, badgeScores, programUID], + ); + } + + const couldSubmitForms = await handleSubmitAnswersReview(); + + if (!couldSubmitForms) { + return; + } const response = await submitAttest( address, diff --git a/components/Pages/Project/Review/CardReviewSummary.tsx b/components/Pages/Project/Review/CardReviewSummary.tsx index 8289b49c..3afcbd3f 100644 --- a/components/Pages/Project/Review/CardReviewSummary.tsx +++ b/components/Pages/Project/Review/CardReviewSummary.tsx @@ -95,7 +95,7 @@ export const CardReviewSummary = () => { const grantIdFromQueryParam = searchParams?.get("grantId"); useEffect(() => { - if (stories) { + if (stories && stories.length) { getAverageReviewScore(score, stories.length); const timestamps = stories.map((story: GrantStory) => Number(story.timestamp)); getScoreRatingFilteredReviews(); @@ -230,7 +230,7 @@ export const CardReviewSummary = () => { )}

- {intervalMessage ? intervalMessage : "No reviewed yet"} + {intervalMessage ?? "Not reviewed yet"}

diff --git a/components/Pages/Project/Review/NavbarReview.tsx b/components/Pages/Project/Review/NavbarReview.tsx index 75562521..6b05cb61 100644 --- a/components/Pages/Project/Review/NavbarReview.tsx +++ b/components/Pages/Project/Review/NavbarReview.tsx @@ -60,8 +60,8 @@ export const NavbarReview = ({ grant }: { grant: IGrantResponse | undefined }) = setBadges(null); setStories(null); setIsStarSelected(0); - if (grant?.refUID) { - setGrantUID(grant.refUID); + if (grant?.details?.refUID) { + setGrantUID(grant.details.refUID); } else { setGrantUID(grantIdFromQueryParam); } From 601ba0301a86f579d7e23b01fd34c774411054c4 Mon Sep 17 00:00:00 2001 From: heronlancellot Date: Thu, 17 Oct 2024 15:28:38 -0300 Subject: [PATCH 40/55] feat: add card-new-review --- components/Pages/Project/Review/CardNewReview.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/Pages/Project/Review/CardNewReview.tsx b/components/Pages/Project/Review/CardNewReview.tsx index d78e090f..c7b502e3 100644 --- a/components/Pages/Project/Review/CardNewReview.tsx +++ b/components/Pages/Project/Review/CardNewReview.tsx @@ -30,6 +30,7 @@ import { useForm, Controller } from "react-hook-form"; import { CheckIcon } from "@heroicons/react/24/solid"; import axios from "axios"; import { IGrantResponse } from "@show-karma/karma-gap-sdk/core/class/karma-indexer/api/types"; +import { switchChain } from "@wagmi/core"; export const CardNewReview = ({ grant }: { grant: IGrantResponse | undefined }) => { const { control, handleSubmit, getValues, trigger } = useForm(); @@ -102,7 +103,6 @@ export const CardNewReview = ({ grant }: { grant: IGrantResponse | undefined }) grantId: grantUID, programId: programUID, }; - try { const createPreReview = await axios.post( `${RAILWAY_BACKEND}/api/v1/reviews`, @@ -139,7 +139,7 @@ export const CardNewReview = ({ grant }: { grant: IGrantResponse | undefined }) if (chainId != arbitrum.id) { toast.error("Must connect to Arbitrum to review"); - await walletClient.switchChain({ id: arbitrum.id }); + await switchChain(config, { chainId: arbitrum.id }); return; } From 85dea640498c8cf0bc3c30be2ba02f08c1450148 Mon Sep 17 00:00:00 2001 From: heronlancellot Date: Thu, 17 Oct 2024 16:48:38 -0300 Subject: [PATCH 41/55] update: card-review ratings without data --- .../Project/Review/CardReviewSummary.tsx | 36 +++++++++++++------ 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/components/Pages/Project/Review/CardReviewSummary.tsx b/components/Pages/Project/Review/CardReviewSummary.tsx index 3afcbd3f..bac0d1b7 100644 --- a/components/Pages/Project/Review/CardReviewSummary.tsx +++ b/components/Pages/Project/Review/CardReviewSummary.tsx @@ -266,17 +266,33 @@ export const CardReviewSummary = () => {
- {ratingData.map(({ countOfReviews, percentageComparedToAllTheReviews }, index) => ( -
-

- {index + 1} -

- -

- {countOfReviews ? percentageComparedToAllTheReviews.toFixed(0) : "0"}% -

+ {ratingData && ratingData.length ? ( + ratingData.map(({ countOfReviews, percentageComparedToAllTheReviews }, index) => ( +
+

+ {index + 1} +

+ +

+ {countOfReviews ? percentageComparedToAllTheReviews.toFixed(0) : "0"}% +

+
+ )) + ) : ( +
+ {Object.values(SupportedRatings).map((rating) => ( +
+

+ {rating} +

+ +

+ 0% +

+
+ ))}
- ))} + )}
From a351077ca378188c7c30f4142f9051bf9aef35c5 Mon Sep 17 00:00:00 2001 From: douglasjr97 Date: Thu, 31 Oct 2024 19:12:06 -0300 Subject: [PATCH 42/55] fix(reviews): fixed request payload for badgesScores and activeBadgeIds --- components/Pages/Project/Review/CardNewReview.tsx | 12 +++++++----- package.json | 4 ++-- utilities/review/constants/index.ts | 14 ++++++++------ yarn.lock | 7 ++++--- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/components/Pages/Project/Review/CardNewReview.tsx b/components/Pages/Project/Review/CardNewReview.tsx index c7b502e3..071416d5 100644 --- a/components/Pages/Project/Review/CardNewReview.tsx +++ b/components/Pages/Project/Review/CardNewReview.tsx @@ -100,6 +100,8 @@ export const CardNewReview = ({ grant }: { grant: IGrantResponse | undefined }) category: whyDidYouApplyFor[0] as CategoryOptions, receivedGrant: didYouReceiveTheGrant[0] as ReceivedGrantOptions, }, + badgesScores: badgeScores, + activeBadgeIds: activeBadgeIds, grantId: grantUID, programId: programUID, }; @@ -162,13 +164,13 @@ export const CardNewReview = ({ grant }: { grant: IGrantResponse | undefined }) if (programUIDisNumber) { encodedData = abiCoder.encode( - ["bytes32", "bytes32[]", "uint8[]", "uint32"], - [grantUID, activeBadgeIds, badgeScores, programUID], + ["bytes32", "bytes32[]", "uint8[]", "string"], + [grantUID, activeBadgeIds, badgeScores, programUID?.toString()], ); } else { encodedData = abiCoder.encode( - ["bytes32", "bytes32[]", "uint8[]", "bytes32"], - [grantUID, activeBadgeIds, badgeScores, programUID], + ["bytes32", "bytes32[]", "uint8[]", "string"], + [grantUID, activeBadgeIds, badgeScores, programUID?.toString()], ); } @@ -366,4 +368,4 @@ export const CardNewReview = ({ grant }: { grant: IGrantResponse | undefined })
); -}; +}; \ No newline at end of file diff --git a/package.json b/package.json index 9ae28204..71614f45 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "@react-pdf/renderer": "^3.4.4", "@semaphore-protocol/core": "^4.0.0-beta.6", "@sentry/nextjs": "7.105.0", - "@show-karma/karma-gap-sdk": "https://github.com/show-karma/karma-gap-sdk.git#6dc087ec0376c3b36f52ed8276322a1ec7f067d0", + "@show-karma/karma-gap-sdk": "0.4.0", "@tailwindcss/typography": "^0.5.10", "@tanstack/react-query": "^5.48.0", "@tanstack/react-table": "^8.17.3", @@ -101,4 +101,4 @@ "postcss": "^8.4.24", "tailwindcss": "^3.3.2" } -} +} \ No newline at end of file diff --git a/utilities/review/constants/index.ts b/utilities/review/constants/index.ts index 01210a23..970becb6 100644 --- a/utilities/review/constants/index.ts +++ b/utilities/review/constants/index.ts @@ -6,7 +6,7 @@ export const ARB_ONE_SCHEMA_REGISTRY = "0xA310da9c5B885E7fb3fbA9D66E9Ba6Df512b78 // The schema UID for EAS export const KARMA_EAS_SCHEMA_UID = - "0x215ea84cc93b044073f5240366c1ee273727d6a18242b5f1918dbebd9c6e8a08"; + "0x5b3884b77ebe533e556d6ea74b462a21852e321b4146d3121546e9d17bd974e1"; // The Karma-Gap scorer ID constant export const SCORER_ID = 1; // The Karma-Gap scorer decimals amount @@ -15,9 +15,9 @@ export const SCORER_DECIMALS = 18; // The Trustful-Karma contracts export const GRANT_REGISTRY = "0x2E6De0735b896dD248B08dcb9BA1f1f6Dd5bf1B7"; export const BADGE_REGISTRY = "0x95d4123c5fA150B04dD56b0ab5141DEcB41725b0"; -export const TRUSTFUL_SCORER = "0x45921d3b90fBb9700F078d7887caa0e3D949C264"; -export const RESOLVER_EAS = "0xb054902Edf1cb8F8fBC4e442A222B936d981C6D3"; -export const RESOLVER_TRUSTFUL = "0xEE85D33c370d61321d2F932b0275F6C52E429C8e"; +export const TRUSTFUL_SCORER = "0x73df629ddc79Bec3ecB50c0e6f337cb6D99abd62"; +export const RESOLVER_EAS = "0x202CD7Ef0a73cf1C541a40f274B2257580214476"; +export const RESOLVER_TRUSTFUL = "0x56f9cbAc701D2C546a15bcB152a4E789f2B4aADF"; export const RAILWAY_BACKEND = "https://trustful-karma-gap-backend-staging.up.railway.app"; @@ -29,10 +29,12 @@ export interface PreReviewAnswers { } export interface CreatePreReviewRequest { - preReviewAnswers: PreReviewAnswers; + preReviewAnswers?: PreReviewAnswers; connectedUserAddress: Address; grantId: string; programId?: string; + badgesScores: number[]; + activeBadgeIds: string[], } export enum CategoryOptions { @@ -52,4 +54,4 @@ export enum ReceivedGrantOptions { Yes = "Yes, I got approved", No = "No", Pending = "I don't have the answer yet", -} +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 56a676c1..1cc8e27d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2610,9 +2610,10 @@ "@sentry/cli" "^1.77.1" webpack-sources "^2.0.0 || ^3.0.0" -"@show-karma/karma-gap-sdk@https://github.com/show-karma/karma-gap-sdk.git#6dc087ec0376c3b36f52ed8276322a1ec7f067d0": - version "0.3.41" - resolved "https://github.com/show-karma/karma-gap-sdk.git#6dc087ec0376c3b36f52ed8276322a1ec7f067d0" +"@show-karma/karma-gap-sdk@0.4.0": + version "0.4.0" + resolved "https://registry.yarnpkg.com/@show-karma/karma-gap-sdk/-/karma-gap-sdk-0.4.0.tgz#d8f97a65a6a912395274adaf6b86bfa8d3836462" + integrity sha512-QI78eUs+ftIHgY0AYjI6J14I2qR2NAiHhUuptxV5VU7G1d3lDPBeolZQgOT4d5FFar1KEGKxPW55AoNtVLO9ww== dependencies: "@allo-team/allo-v2-sdk" "^1.0.63" "@ethereum-attestation-service/eas-sdk" "1.4.2" From 51e57825f5e8e7743ac9168f69ea0e22154d65f3 Mon Sep 17 00:00:00 2001 From: douglasjr97 Date: Fri, 1 Nov 2024 09:58:22 -0300 Subject: [PATCH 43/55] test commit --- utilities/review/constants/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/review/constants/index.ts b/utilities/review/constants/index.ts index 970becb6..a1b6e69c 100644 --- a/utilities/review/constants/index.ts +++ b/utilities/review/constants/index.ts @@ -4,7 +4,7 @@ import { Address } from "viem"; export const ARB_ONE_EAS = "0xbD75f629A22Dc1ceD33dDA0b68c546A1c035c458"; export const ARB_ONE_SCHEMA_REGISTRY = "0xA310da9c5B885E7fb3fbA9D66E9Ba6Df512b78eB"; -// The schema UID for EAS +// The schema UID for EAS export const KARMA_EAS_SCHEMA_UID = "0x5b3884b77ebe533e556d6ea74b462a21852e321b4146d3121546e9d17bd974e1"; // The Karma-Gap scorer ID constant From 2a64637dafecb7a38e1e460dd9c564ea849110c7 Mon Sep 17 00:00:00 2001 From: douglasjr97 Date: Fri, 1 Nov 2024 09:59:42 -0300 Subject: [PATCH 44/55] test commit --- utilities/review/constants/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/review/constants/index.ts b/utilities/review/constants/index.ts index a1b6e69c..970becb6 100644 --- a/utilities/review/constants/index.ts +++ b/utilities/review/constants/index.ts @@ -4,7 +4,7 @@ import { Address } from "viem"; export const ARB_ONE_EAS = "0xbD75f629A22Dc1ceD33dDA0b68c546A1c035c458"; export const ARB_ONE_SCHEMA_REGISTRY = "0xA310da9c5B885E7fb3fbA9D66E9Ba6Df512b78eB"; -// The schema UID for EAS +// The schema UID for EAS export const KARMA_EAS_SCHEMA_UID = "0x5b3884b77ebe533e556d6ea74b462a21852e321b4146d3121546e9d17bd974e1"; // The Karma-Gap scorer ID constant From cc4a3dd46465019efa9bedb4bdbe99b8f664a543 Mon Sep 17 00:00:00 2001 From: douglasjr97 Date: Mon, 4 Nov 2024 11:16:11 -0300 Subject: [PATCH 45/55] feat(reviews): implement review permission check for gap users only --- .../Project/Review/CardReviewSummary.tsx | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/components/Pages/Project/Review/CardReviewSummary.tsx b/components/Pages/Project/Review/CardReviewSummary.tsx index bac0d1b7..0834c5d5 100644 --- a/components/Pages/Project/Review/CardReviewSummary.tsx +++ b/components/Pages/Project/Review/CardReviewSummary.tsx @@ -47,6 +47,7 @@ export const CardReviewSummary = () => { const [averageScoreReview, setAverageScoreReview] = useState(null); const [intervalMessage, setIntervalMessage] = useState(undefined); const [ratingData, setRatingData] = useState([]); + const [isGapUser, setIsGapUser] = useState(null); const searchParams = useSearchParams(); const { openConnectModal } = useConnectModal(); @@ -125,9 +126,8 @@ export const CardReviewSummary = () => { const days = interval / (60 * 60 * 24); if (days <= 1) { - return `Typically reviewed ${stories.length} time${stories.length > 1 ? "s" : ""} ${ - IntervalMessage.PER_DAY - }`; + return `Typically reviewed ${stories.length} time${stories.length > 1 ? "s" : ""} ${IntervalMessage.PER_DAY + }`; } else if (days <= 7) { return `Typically reviewed ${Math.round(7 / days)} times ${IntervalMessage.PER_WEEK}`; } else if (days <= 30) { @@ -178,6 +178,15 @@ export const CardReviewSummary = () => { setRatingData(reviewsWithPercentualRelevance); }; + useEffect(() => { + const getGapUser = async () => { + const response = fetch(`https://gapapi.karmahq.xyz/grantees/${address}/is-gap-user`) + const data = await (await response).text() + setIsGapUser(data) + } + getGapUser() + }, []) + return (
@@ -185,7 +194,7 @@ export const CardReviewSummary = () => { {}} + setRating={() => { }} mode={ReviewMode.READ} />

@@ -193,9 +202,10 @@ export const CardReviewSummary = () => {

{isConnected && - project?.recipient && - address && - !isAddressEqual(project.recipient, address) ? ( // Check if the address is equal to the grant recipient address + project?.recipient && + address && + isGapUser === 'true' && + !isAddressEqual(project.recipient, address) ? ( // Check if the address is equal to the grant recipient address
From 5c2a75b9976f5ed59e00dec5f67a387dd81ea5f9 Mon Sep 17 00:00:00 2001 From: douglasjr97 Date: Mon, 4 Nov 2024 16:25:02 -0300 Subject: [PATCH 46/55] refactor: improve async fetch --- components/Pages/Project/Review/CardReviewSummary.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/Pages/Project/Review/CardReviewSummary.tsx b/components/Pages/Project/Review/CardReviewSummary.tsx index 0834c5d5..0973114d 100644 --- a/components/Pages/Project/Review/CardReviewSummary.tsx +++ b/components/Pages/Project/Review/CardReviewSummary.tsx @@ -180,8 +180,8 @@ export const CardReviewSummary = () => { useEffect(() => { const getGapUser = async () => { - const response = fetch(`https://gapapi.karmahq.xyz/grantees/${address}/is-gap-user`) - const data = await (await response).text() + const response = await fetch(`https://gapapi.karmahq.xyz/grantees/${address}/is-gap-user`) + const data = await response.text() setIsGapUser(data) } getGapUser() From 07c99947e636643c4b171ee4ddaecfbda919175b Mon Sep 17 00:00:00 2001 From: FrancoAguzzi Date: Wed, 6 Nov 2024 18:17:35 -0300 Subject: [PATCH 47/55] fix: set isGapUser as boolean --- .../Project/Review/CardReviewSummary.tsx | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/components/Pages/Project/Review/CardReviewSummary.tsx b/components/Pages/Project/Review/CardReviewSummary.tsx index 0973114d..98834918 100644 --- a/components/Pages/Project/Review/CardReviewSummary.tsx +++ b/components/Pages/Project/Review/CardReviewSummary.tsx @@ -47,7 +47,7 @@ export const CardReviewSummary = () => { const [averageScoreReview, setAverageScoreReview] = useState(null); const [intervalMessage, setIntervalMessage] = useState(undefined); const [ratingData, setRatingData] = useState([]); - const [isGapUser, setIsGapUser] = useState(null); + const [isGapUser, setIsGapUser] = useState(null); const searchParams = useSearchParams(); const { openConnectModal } = useConnectModal(); @@ -126,8 +126,9 @@ export const CardReviewSummary = () => { const days = interval / (60 * 60 * 24); if (days <= 1) { - return `Typically reviewed ${stories.length} time${stories.length > 1 ? "s" : ""} ${IntervalMessage.PER_DAY - }`; + return `Typically reviewed ${stories.length} time${stories.length > 1 ? "s" : ""} ${ + IntervalMessage.PER_DAY + }`; } else if (days <= 7) { return `Typically reviewed ${Math.round(7 / days)} times ${IntervalMessage.PER_WEEK}`; } else if (days <= 30) { @@ -180,12 +181,13 @@ export const CardReviewSummary = () => { useEffect(() => { const getGapUser = async () => { - const response = await fetch(`https://gapapi.karmahq.xyz/grantees/${address}/is-gap-user`) - const data = await response.text() - setIsGapUser(data) - } - getGapUser() - }, []) + const response = await fetch(`https://gapapi.karmahq.xyz/grantees/${address}/is-gap-user`); + const data = await response.json(); + + setIsGapUser(data); + }; + getGapUser(); + }, []); return (
@@ -194,7 +196,7 @@ export const CardReviewSummary = () => { { }} + setRating={() => {}} mode={ReviewMode.READ} />

@@ -202,10 +204,10 @@ export const CardReviewSummary = () => {

{isConnected && - project?.recipient && - address && - isGapUser === 'true' && - !isAddressEqual(project.recipient, address) ? ( // Check if the address is equal to the grant recipient address + project?.recipient && + address && + isGapUser && + !isAddressEqual(project.recipient, address) ? ( // Check if the address is equal to the grant recipient address
From 9dd9e65713cd544f3baa74fe5ccc5d206adfe9a6 Mon Sep 17 00:00:00 2001 From: "caco.eth" <49823133+FrancoAguzzi@users.noreply.github.com> Date: Wed, 6 Nov 2024 18:20:31 -0300 Subject: [PATCH 48/55] Update components/Pages/Project/Review/CardNewReview.tsx --- components/Pages/Project/Review/CardNewReview.tsx | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/components/Pages/Project/Review/CardNewReview.tsx b/components/Pages/Project/Review/CardNewReview.tsx index 071416d5..f55ae0cb 100644 --- a/components/Pages/Project/Review/CardNewReview.tsx +++ b/components/Pages/Project/Review/CardNewReview.tsx @@ -159,20 +159,10 @@ export const CardNewReview = ({ grant }: { grant: IGrantResponse | undefined }) const abiCoder = new AbiCoder(); console.log("Badge scores being encoded:", badgeScores); - let encodedData; - const programUIDisNumber = Number.isNaN(Number(programUID)); - - if (programUIDisNumber) { - encodedData = abiCoder.encode( - ["bytes32", "bytes32[]", "uint8[]", "string"], - [grantUID, activeBadgeIds, badgeScores, programUID?.toString()], - ); - } else { - encodedData = abiCoder.encode( + const encodedData = abiCoder.encode( ["bytes32", "bytes32[]", "uint8[]", "string"], [grantUID, activeBadgeIds, badgeScores, programUID?.toString()], ); - } const couldSubmitForms = await handleSubmitAnswersReview(); From 63e2d5b64a1f15059dc83cba13aa957c0d84f402 Mon Sep 17 00:00:00 2001 From: "caco.eth" <49823133+FrancoAguzzi@users.noreply.github.com> Date: Wed, 6 Nov 2024 18:20:42 -0300 Subject: [PATCH 49/55] Update components/Pages/Project/Review/ArrowNavigationBar.tsx --- components/Pages/Project/Review/ArrowNavigationBar.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/components/Pages/Project/Review/ArrowNavigationBar.tsx b/components/Pages/Project/Review/ArrowNavigationBar.tsx index 3e96b518..df532f39 100644 --- a/components/Pages/Project/Review/ArrowNavigationBar.tsx +++ b/components/Pages/Project/Review/ArrowNavigationBar.tsx @@ -24,7 +24,6 @@ const VISIBLE_SCROLLER_WIDTH_AFTER_NAVIGATOR_CLICK = 75; const DELAY_FOR_DOM_PROPERTY_UPDATE = 2000; export const ArrowNavigationBar = ({ - centerID, skeletonMarkup, barContentMarkup, }: HorizontalNavigationBarProps) => { From 05b20a735048e7db666788a3a9449c3c2b7d3fb3 Mon Sep 17 00:00:00 2001 From: "caco.eth" <49823133+FrancoAguzzi@users.noreply.github.com> Date: Wed, 6 Nov 2024 18:20:52 -0300 Subject: [PATCH 50/55] Update components/Pages/Project/Review/ArrowNavigationBar.tsx --- .../Pages/Project/Review/ArrowNavigationBar.tsx | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/components/Pages/Project/Review/ArrowNavigationBar.tsx b/components/Pages/Project/Review/ArrowNavigationBar.tsx index df532f39..4f693068 100644 --- a/components/Pages/Project/Review/ArrowNavigationBar.tsx +++ b/components/Pages/Project/Review/ArrowNavigationBar.tsx @@ -104,22 +104,6 @@ export const ArrowNavigationBar = ({ } }; - useEffect(() => { - if (centerID) { - const centerElement = document.querySelector( - '[data-navigation-item="' + centerID + '"]', - ) as HTMLElement; - - if (centerElement && navigationBarWrapper.current) { - navigationBarWrapper.current.scrollTo({ - behavior: "smooth", - left: centerElement.offsetLeft - 80, - }); - - setTimeout(setDisplayOfInfiniteShadowsAndNavigationButtons, DELAY_FOR_DOM_PROPERTY_UPDATE); - } - } - }, [centerID]); return (
From 4a707a860bbf80456d94e6f0466cbb86a04f456d Mon Sep 17 00:00:00 2001 From: "caco.eth" <49823133+FrancoAguzzi@users.noreply.github.com> Date: Wed, 6 Nov 2024 18:21:40 -0300 Subject: [PATCH 51/55] Update components/Pages/Project/Review/CardNewReview.tsx --- components/Pages/Project/Review/CardNewReview.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/Pages/Project/Review/CardNewReview.tsx b/components/Pages/Project/Review/CardNewReview.tsx index f55ae0cb..f3071959 100644 --- a/components/Pages/Project/Review/CardNewReview.tsx +++ b/components/Pages/Project/Review/CardNewReview.tsx @@ -358,4 +358,4 @@ export const CardNewReview = ({ grant }: { grant: IGrantResponse | undefined })
); -}; \ No newline at end of file +}; From 58e48ade703aabfaf6736f8bb7a4d34d6df619e6 Mon Sep 17 00:00:00 2001 From: "caco.eth" <49823133+FrancoAguzzi@users.noreply.github.com> Date: Wed, 6 Nov 2024 18:21:48 -0300 Subject: [PATCH 52/55] Update package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 71614f45..e409f1d1 100644 --- a/package.json +++ b/package.json @@ -101,4 +101,4 @@ "postcss": "^8.4.24", "tailwindcss": "^3.3.2" } -} \ No newline at end of file +} From 5384bae254ef831e7c5189ae11c00169f6ec589d Mon Sep 17 00:00:00 2001 From: "caco.eth" <49823133+FrancoAguzzi@users.noreply.github.com> Date: Wed, 6 Nov 2024 18:21:59 -0300 Subject: [PATCH 53/55] Update components/Pages/Project/Review/CardNewReview.tsx --- components/Pages/Project/Review/CardNewReview.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/components/Pages/Project/Review/CardNewReview.tsx b/components/Pages/Project/Review/CardNewReview.tsx index f3071959..b1135831 100644 --- a/components/Pages/Project/Review/CardNewReview.tsx +++ b/components/Pages/Project/Review/CardNewReview.tsx @@ -69,7 +69,6 @@ export const CardNewReview = ({ grant }: { grant: IGrantResponse | undefined }) // Score of the new review const handleSetRating = (index: number, rating: number) => { - console.log(`Attempting to set rating ${rating} for index ${index}`); if (rating >= 1 && rating <= 5) { const updatedBadges = [...badgeScores]; updatedBadges[index] = Math.round(rating); From 500f0c49dd7b3fd7325cb03c809c9b8c1d356274 Mon Sep 17 00:00:00 2001 From: "caco.eth" <49823133+FrancoAguzzi@users.noreply.github.com> Date: Wed, 6 Nov 2024 18:22:16 -0300 Subject: [PATCH 54/55] Update components/Pages/Project/Review/CardNewReview.tsx --- components/Pages/Project/Review/CardNewReview.tsx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/components/Pages/Project/Review/CardNewReview.tsx b/components/Pages/Project/Review/CardNewReview.tsx index b1135831..facfa102 100644 --- a/components/Pages/Project/Review/CardNewReview.tsx +++ b/components/Pages/Project/Review/CardNewReview.tsx @@ -150,10 +150,6 @@ export const CardNewReview = ({ grant }: { grant: IGrantResponse | undefined }) ); } - console.log("grantUID:", grantUID); - console.log("activeBadgeIds:", activeBadgeIds); - console.log("badgeScores:", badgeScores); - console.log("programUID:", programUID); // Encode the data const abiCoder = new AbiCoder(); console.log("Badge scores being encoded:", badgeScores); From b8484e30836bae189260c0d5ed4f1586201532a9 Mon Sep 17 00:00:00 2001 From: "caco.eth" <49823133+FrancoAguzzi@users.noreply.github.com> Date: Wed, 6 Nov 2024 18:22:31 -0300 Subject: [PATCH 55/55] Update components/Pages/Project/Review/ArrowNavigationBar.tsx --- components/Pages/Project/Review/ArrowNavigationBar.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/components/Pages/Project/Review/ArrowNavigationBar.tsx b/components/Pages/Project/Review/ArrowNavigationBar.tsx index 4f693068..80905ee5 100644 --- a/components/Pages/Project/Review/ArrowNavigationBar.tsx +++ b/components/Pages/Project/Review/ArrowNavigationBar.tsx @@ -5,7 +5,6 @@ import lodash from "lodash"; import { useTheme } from "next-themes"; interface HorizontalNavigationBarProps { - centerID?: string | null; skeletonMarkup: JSX.Element; barContentMarkup: JSX.Element; }