diff --git a/packages/nextjs/app/api/grants/new/route.ts b/packages/nextjs/app/api/grants/new/route.ts index 3cdd18f..9cf4dfc 100644 --- a/packages/nextjs/app/api/grants/new/route.ts +++ b/packages/nextjs/app/api/grants/new/route.ts @@ -19,14 +19,14 @@ export async function POST(req: Request) { try { const { title, description, signature, signer } = (await req.json()) as ReqBody; - if (!title || !description || !signature || !signer) { - return NextResponse.json({ error: "Invalid form details submited" }, { status: 400 }); + if (!title || !description || !signature || !signer || description.length > 750 || title.length > 75) { + return NextResponse.json({ error: "Invalid form details submitted" }, { status: 400 }); } // Verif if the builder is present const builder = await findUserByAddress(signer); if (!builder.exists) { - return NextResponse.json({ error: "Only buidlguild builders can submit for grants" }, { status: 401 }); + return NextResponse.json({ error: "Only Buidlguidl builders can submit for grants" }, { status: 401 }); } const recoveredAddress = await recoverTypedDataAddress({ diff --git a/packages/nextjs/app/apply/_component/Form.tsx b/packages/nextjs/app/apply/_component/Form.tsx index 2205abf..0ac9c4d 100644 --- a/packages/nextjs/app/apply/_component/Form.tsx +++ b/packages/nextjs/app/apply/_component/Form.tsx @@ -1,5 +1,6 @@ "use client"; +import React, { useState } from "react"; import { useRouter } from "next/navigation"; import SubmitButton from "./SubmitButton"; import useSWRMutation from "swr/mutation"; @@ -16,8 +17,11 @@ type ReqBody = { signer?: string; }; +const MAX_DESCRIPTION_LENGTH = 750; + const Form = () => { const { address: connectedAddress } = useAccount(); + const [descriptionLength, setDescriptionLength] = useState(0); const { signTypedDataAsync } = useSignTypedData(); const router = useRouter(); const { trigger: postNewGrant } = useSWRMutation("/api/grants/new", postMutationFetcher); @@ -60,7 +64,7 @@ const Form = () => { }; return ( -
+

Submit Proposal

@@ -68,22 +72,28 @@ const Form = () => {

Description

-
+