Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add age verification and terms agreement checkboxes to partner application form #2088

Merged
merged 7 commits into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,17 @@ type FormData = {
website?: string;
proposal: string;
comments?: string;
ageVerification: boolean;
termsAgreement: boolean;
};

export function ProgramApplicationForm({
program,
}: {
program: Pick<Program, "id" | "slug" | "name">;
program: Pick<
Program,
"id" | "slug" | "name" | "termsUrl" | "ageVerification"
>;
}) {
const { isMobile } = useMediaQuery();
const router = useRouter();
Expand Down Expand Up @@ -178,6 +183,50 @@ export function ProgramApplicationForm({
/>
</label>

{program.ageVerification && (
<div className="flex items-center gap-2">
<input
type="checkbox"
id="ageVerification"
className={cn(
"h-4 w-4 rounded border-neutral-300 text-[var(--brand)] focus:ring-[var(--brand)]",
errors.ageVerification && "border-red-400 focus:ring-red-500",
)}
{...register("ageVerification", {
required: true,
})}
/>
<label htmlFor="ageVerification" className="text-sm text-neutral-800">
I'm {program.ageVerification} years or older
</label>
</div>
)}

{program.termsUrl && (
<div className="flex items-center gap-2">
<input
type="checkbox"
id="termsAgreement"
className={cn(
"h-4 w-4 rounded border-neutral-300 text-[var(--brand)] focus:ring-[var(--brand)]",
errors.termsAgreement && "border-red-400 focus:ring-red-500",
)}
{...register("termsAgreement", { required: true })}
/>
<label htmlFor="termsAgreement" className="text-sm text-neutral-800">
I agree to the{" "}
<a
href={program.termsUrl}
target="_blank"
rel="noopener noreferrer"
className="text-[var(--brand)] underline hover:opacity-80"
>
{program.name} Partner Program Terms ↗
</a>
</label>
</div>
)}

<Button
text="Submit application"
className="mt-4 enabled:border-[var(--brand)] enabled:bg-[var(--brand)] enabled:hover:bg-[var(--brand)] enabled:hover:ring-[var(--brand-ring)]"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ export default async function ApplicationPage({

{/* Application form */}
<div className="mt-10">
<ProgramApplicationForm
program={{ id: program.id, name: program.name, slug: program.slug }}
/>
<ProgramApplicationForm program={program} />
</div>
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions packages/prisma/schema/program.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ model Program {
holdingPeriodDays Int @default(0) // number of days to wait before earnings are added to a payout
defaultRewardId String? // default reward for the program
landerData Json? @db.Json
termsUrl String? @db.LongText
ageVerification Int?

createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
Expand Down