Skip to content

Commit

Permalink
Check for submissionsEnabled on Submit page (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
damianmarti authored Sep 17, 2024
1 parent f7eb7dc commit 693d592
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
12 changes: 3 additions & 9 deletions packages/nextjs/app/submit/_component/SubmitButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,17 @@
import { useFormStatus } from "react-dom";
import { useAccount } from "wagmi";
import { RainbowKitCustomConnectButton } from "~~/components/scaffold-eth";
import scaffoldConfig from "~~/scaffold.config";

const SubmitButton = () => {
const { pending } = useFormStatus();
const { isConnected } = useAccount();
const { submissionsEnabled } = scaffoldConfig;

return (
<div
className={`items-center flex flex-col ${!isConnected && submissionsEnabled && "tooltip tooltip-bottom"}`}
data-tip={`${!isConnected && submissionsEnabled ? "Please connect your wallet" : ""}`}
className={`items-center flex flex-col ${!isConnected && "tooltip tooltip-bottom"}`}
data-tip={`${!isConnected ? "Please connect your wallet" : ""}`}
>
{!submissionsEnabled ? (
<button className="btn border border-black px-6 text-lg h-10 min-h-10 font-medium" disabled>
Submissions Closed
</button>
) : isConnected ? (
{isConnected ? (
<button
className="btn border border-black px-6 text-lg h-10 min-h-10 font-medium"
disabled={pending}
Expand Down
7 changes: 7 additions & 0 deletions packages/nextjs/app/submit/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import Form from "./_component/Form";
import { NextPage } from "next";
import scaffoldConfig from "~~/scaffold.config";

const Submit: NextPage = () => {
const { submissionsEnabled } = scaffoldConfig;

if (!submissionsEnabled) {
return <div className="flex items-center text-xl flex-col flex-grow pt-10 space-y-4">Submissions Closed</div>;
}

return (
<div className="flex flex-col md:flex-row m-6 md:m-10 border border-black">
<div className="w-[100%] md:w-5/12 border-r border-black p-4 md:p-12">
Expand Down

0 comments on commit 693d592

Please sign in to comment.