From a8e1a7b84ae99525f0b4066b089542286f278f57 Mon Sep 17 00:00:00 2001 From: "Shiv Bhonde | shivbhonde.eth" Date: Thu, 18 Apr 2024 20:04:11 +0530 Subject: [PATCH] Private notes (#117) --- .../app/admin/_components/EditGrantModal.tsx | 18 +++++++++++++-- .../app/admin/_components/GrantReview.tsx | 7 ++++-- .../nextjs/app/api/grants/[grantId]/route.ts | 8 +++---- packages/nextjs/services/database/grants.ts | 22 ++++++++++++++++--- packages/nextjs/services/database/schema.ts | 1 + packages/nextjs/utils/eip712.ts | 1 + 6 files changed, 46 insertions(+), 11 deletions(-) diff --git a/packages/nextjs/app/admin/_components/EditGrantModal.tsx b/packages/nextjs/app/admin/_components/EditGrantModal.tsx index 9a51274..df1d384 100644 --- a/packages/nextjs/app/admin/_components/EditGrantModal.tsx +++ b/packages/nextjs/app/admin/_components/EditGrantModal.tsx @@ -2,13 +2,13 @@ import { ChangeEvent, forwardRef, useState } from "react"; import { useSWRConfig } from "swr"; import useSWRMutation from "swr/mutation"; import { useAccount, useNetwork, useSignTypedData } from "wagmi"; -import { GrantDataWithBuilder } from "~~/services/database/schema"; +import { GrantDataWithPrivateNote } from "~~/services/database/schema"; import { EIP_712_DOMAIN, EIP_712_TYPES__EDIT_GRANT } from "~~/utils/eip712"; import { getParsedError, notification } from "~~/utils/scaffold-eth"; import { patchMutationFetcher } from "~~/utils/swr"; type EditGrantModalProps = { - grant: GrantDataWithBuilder; + grant: GrantDataWithPrivateNote; closeModal: () => void; }; @@ -18,6 +18,7 @@ type ReqBody = { askAmount?: number; signature?: `0x${string}`; signer?: string; + private_note?: string; }; export const EditGrantModal = forwardRef(({ grant, closeModal }, ref) => { @@ -25,6 +26,7 @@ export const EditGrantModal = forwardRef title: grant.title, description: grant.description, askAmount: grant.askAmount.toString(), + private_note: grant.private_note ?? "", }); const { address } = useAccount(); @@ -63,6 +65,7 @@ export const EditGrantModal = forwardRef // Converting this to number with parseFloat and again to string (similar to backend), // if not it generates different signature with .23 and 0.23 askAmount: parseFloat(formData.askAmount).toString(), + private_note: formData.private_note, }, }); notificationId = notification.loading("Updating grant"); @@ -132,6 +135,17 @@ export const EditGrantModal = forwardRef onChange={handleInputChange} /> +
+

Private Note (optional)

+