Skip to content

Commit

Permalink
Close submissions (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pabl0cks authored Sep 3, 2024
1 parent 7437862 commit 099a7af
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
5 changes: 5 additions & 0 deletions packages/nextjs/app/api/submissions/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
12 changes: 8 additions & 4 deletions packages/nextjs/app/submit/_component/SubmitButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<div
className={`items-center flex flex-col ${!isConnected && "tooltip tooltip-bottom"}`}
data-tip={`${!isConnected ? "Please connect your wallet" : ""}`}
className={`items-center flex flex-col ${!isConnected && !isSubmissionClosed && "tooltip tooltip-bottom"}`}
data-tip={`${!isConnected && !isSubmissionClosed ? "Please connect your wallet" : ""}`}
>
{isConnected ? (
{isSubmissionClosed ? (
<button className="btn border border-black px-6 text-lg h-10 min-h-10 font-medium" disabled>
Submissions Closed
</button>
) : isConnected ? (
<button
className="btn border border-black px-6 text-lg h-10 min-h-10 font-medium"
disabled={pending}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Link from "next/link";

export const StickySubmissionInfo = () => {
const [isVisible, setIsVisible] = useState(true);
const isSubmissionClosed = true;

if (!isVisible) {
return (
Expand All @@ -26,16 +27,18 @@ export const StickySubmissionInfo = () => {
</button>
<h2 className="text-2xl underline mb-0 md:mb-4 2xl:text-3xl 2xl:mb-6">
Submissions <br className="hidden md:inline" /> open
{isSubmissionClosed ? "Submissions closed" : "Submissions open"}
</h2>
<p className="md:mb-10 mt-2 2xl:text-xl 2xl:mb-12 2xl:mt-4">AUG 20 - SEP 2</p>
<div className="flex md:block space-x-2 2xl:space-x-4">
<Link
href="/submit"
className="bg-[#B7EBEC] py-2 px-2 sm:px-4 border border-1 border-black text-center flex-1 2xl:py-3 2xl:px-6 text-sm sm:text-base 2xl:text-xl"
>
Apply
</Link>
{!isSubmissionClosed && (
<Link
href="/submit"
className="bg-[#B7EBEC] py-2 px-2 sm:px-4 border border-1 border-black text-center flex-1 2xl:py-3 2xl:px-6 text-sm sm:text-base 2xl:text-xl"
>
Apply
</Link>
)}
<a
href="https://t.me/+jgKFHjb9B_cyNmMx"
target="_blank"
Expand Down

0 comments on commit 099a7af

Please sign in to comment.