diff --git a/components/BitcoinLogo.tsx b/components/BitcoinLogo.tsx index a183906..5fe3f85 100644 --- a/components/BitcoinLogo.tsx +++ b/components/BitcoinLogo.tsx @@ -8,11 +8,11 @@ function BitcoinLogo(props: SVGProps) { width="100%" height="100%" version="1.1" - shape-rendering="geometricPrecision" - text-rendering="geometricPrecision" - image-rendering="optimizeQuality" - fill-rule="evenodd" - clip-rule="evenodd" + shapeRendering="geometricPrecision" + textRendering="geometricPrecision" + imageRendering="optimizeQuality" + fillRule="evenodd" + clipRule="evenodd" viewBox="0 0 4091.27 4091.73" xmlnsXlink="http://www.w3.org/1999/xlink" {...props} @@ -22,12 +22,12 @@ function BitcoinLogo(props: SVGProps) { diff --git a/components/EvmIcon.tsx b/components/EvmIcon.tsx index 99935ab..b03a240 100644 --- a/components/EvmIcon.tsx +++ b/components/EvmIcon.tsx @@ -30,37 +30,37 @@ function EvmIcon(props: SVGProps) { diff --git a/pages/[fund]/membership.tsx b/pages/[fund]/membership.tsx index d4f5648..e43489f 100644 --- a/pages/[fund]/membership.tsx +++ b/pages/[fund]/membership.tsx @@ -56,45 +56,46 @@ const paymentMethodOptions = [ { label: 'EVMs', icon: EvmIcon, value: 'evm' }, ] as const +const schema = z + .object({ + amount: z.coerce.number(), + paymentMethod: z.enum(['card', 'btc', 'xmr', 'ltc', 'evm']), + term: z.enum(['monthly', 'annually']), + taxDeductible: z.enum(['yes', 'no']), + recurring: z.enum(['yes', 'no']), + givePointsBack: z.enum(['yes', 'no']), + }) + .superRefine((data, ctx) => { + if (data.term === 'monthly' && data.amount < MONTHLY_MEMBERSHIP_MIN_PRICE_USD) { + ctx.addIssue({ + path: ['amount'], + code: 'custom', + message: `Min. amount is $${MONTHLY_MEMBERSHIP_MIN_PRICE_USD}.`, + }) + } + + if (data.term === 'annually' && data.amount < ANNUALLY_MEMBERSHIP_MIN_PRICE_USD) { + ctx.addIssue({ + path: ['amount'], + code: 'custom', + message: `Min. amount is $${ANNUALLY_MEMBERSHIP_MIN_PRICE_USD}.`, + }) + } + }) + +type FormInputs = z.infer + function MembershipPage({ fund: fundSlug, project }: Props) { const session = useSession() const router = useRouter() - const schema = z - .object({ - amount: z.coerce.number(), - paymentMethod: z.enum(['card', 'btc', 'xmr', 'ltc', 'evm']), - term: z.enum(['monthly', 'annually']), - taxDeductible: z.enum(['yes', 'no']), - recurring: z.enum(['yes', 'no']), - givePointsBack: z.enum(['yes', 'no']), - }) - .superRefine((data, ctx) => { - if (data.term === 'monthly' && data.amount < MONTHLY_MEMBERSHIP_MIN_PRICE_USD) { - ctx.addIssue({ - path: ['amount'], - code: 'custom', - message: `Min. amount is $${MONTHLY_MEMBERSHIP_MIN_PRICE_USD}.`, - }) - } - - if (data.term === 'annually' && data.amount < ANNUALLY_MEMBERSHIP_MIN_PRICE_USD) { - ctx.addIssue({ - path: ['amount'], - code: 'custom', - message: `Min. amount is $${ANNUALLY_MEMBERSHIP_MIN_PRICE_USD}.`, - }) - } - }) - - type FormInputs = z.infer - const { toast } = useToast() const form = useForm({ resolver: zodResolver(schema), defaultValues: { amount: 10, + paymentMethod: 'xmr', term: 'monthly', taxDeductible: 'no', recurring: 'no', @@ -228,7 +229,7 @@ function MembershipPage({ fund: fundSlug, project }: Props) { {!form.formState.errors.amount?.message && ( -

+

)} )} @@ -252,11 +253,15 @@ function MembershipPage({ fund: fundSlug, project }: Props) { - {annualTermSavePerc > 0 && ( - - Save {annualTermSavePerc}% with annual - - )} + + {annualTermSavePerc > 0 ? ( + <> + Save {annualTermSavePerc}% with annual + + ) : ( + <>  + )} + )} />