From 099a7afc1fb7b982c9db861b678b85947a624473 Mon Sep 17 00:00:00 2001 From: Pablo Alayeto <55535804+Pabl0cks@users.noreply.github.com> Date: Tue, 3 Sep 2024 13:59:33 +0200 Subject: [PATCH] Close submissions (#72) --- packages/nextjs/app/api/submissions/route.ts | 5 +++++ .../app/submit/_component/SubmitButton.tsx | 12 ++++++++---- .../StickySubmissionInfo.tsx | 17 ++++++++++------- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/packages/nextjs/app/api/submissions/route.ts b/packages/nextjs/app/api/submissions/route.ts index b36b410..3ca8811 100644 --- a/packages/nextjs/app/api/submissions/route.ts +++ b/packages/nextjs/app/api/submissions/route.ts @@ -26,6 +26,11 @@ export type CreateNewSubmissionBody = SubmissionInsert & { signature: `0x${strin export async function POST(req: Request) { try { + const isSubmissionClosed = true; + if (isSubmissionClosed) { + return NextResponse.json({ error: "Submissions are closed" }, { status: 403 }); + } + const { title, description, telegram, linkToRepository, linkToVideo, feedback, signature, builder } = (await req.json()) as CreateNewSubmissionBody; diff --git a/packages/nextjs/app/submit/_component/SubmitButton.tsx b/packages/nextjs/app/submit/_component/SubmitButton.tsx index dc5adf2..81724f3 100644 --- a/packages/nextjs/app/submit/_component/SubmitButton.tsx +++ b/packages/nextjs/app/submit/_component/SubmitButton.tsx @@ -4,17 +4,21 @@ import { useFormStatus } from "react-dom"; import { useAccount } from "wagmi"; import { RainbowKitCustomConnectButton } from "~~/components/scaffold-eth"; -// To use useFormStatus we need to make sure button is child of form const SubmitButton = () => { const { pending } = useFormStatus(); const { isConnected } = useAccount(); + const isSubmissionClosed = true; return (