Skip to content

Commit

Permalink
Merge pull request #133 from MAGICGrants/membership-leaderboard-remove
Browse files Browse the repository at this point in the history
feat: remove leaderboard option from membership page
  • Loading branch information
Keeqler authored Jan 13, 2025
2 parents cf0e998 + c34ed86 commit eb1ef19
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 42 deletions.
35 changes: 0 additions & 35 deletions pages/[fund]/membership.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ function MembershipPage({ fund: fundSlug, project }: Props) {
taxDeductible: z.enum(['yes', 'no']),
recurring: z.enum(['yes', 'no']),
givePointsBack: z.enum(['yes', 'no']),
showDonorNameOnLeaderboard: z.enum(['yes', 'no']),
})

type FormInputs = z.infer<typeof schema>
Expand All @@ -57,7 +56,6 @@ function MembershipPage({ fund: fundSlug, project }: Props) {
taxDeductible: 'no',
recurring: 'no',
givePointsBack: 'no',
showDonorNameOnLeaderboard: 'no',
},
mode: 'all',
})
Expand All @@ -74,7 +72,6 @@ function MembershipPage({ fund: fundSlug, project }: Props) {
fundSlug,
taxDeductible: data.taxDeductible === 'yes',
givePointsBack: data.givePointsBack === 'yes',
showDonorNameOnLeaderboard: data.showDonorNameOnLeaderboard === 'yes',
})

window.location.assign(result.url)
Expand All @@ -93,7 +90,6 @@ function MembershipPage({ fund: fundSlug, project }: Props) {
recurring: data.recurring === 'yes',
taxDeductible: data.taxDeductible === 'yes',
givePointsBack: data.givePointsBack === 'yes',
showDonorNameOnLeaderboard: data.showDonorNameOnLeaderboard === 'yes',
})

if (!result.url) throw new Error()
Expand Down Expand Up @@ -211,37 +207,6 @@ function MembershipPage({ fund: fundSlug, project }: Props) {
)}
/>

<FormField
control={form.control}
name="showDonorNameOnLeaderboard"
render={({ field }) => (
<FormItem className="space-y-3">
<FormLabel>Do you want your name to be displayed on the leaderboard?</FormLabel>
<FormControl>
<RadioGroup
onValueChange={field.onChange}
defaultValue={field.value}
className="flex flex-row space-x-4 text-gray-700"
>
<FormItem className="flex items-center space-x-3 space-y-0">
<FormControl>
<RadioGroupItem value="no" />
</FormControl>
<FormLabel className="font-normal">No</FormLabel>
</FormItem>
<FormItem className="flex items-center space-x-3 space-y-0">
<FormControl>
<RadioGroupItem value="yes" />
</FormControl>
<FormLabel className="font-normal">Yes</FormLabel>
</FormItem>
</RadioGroup>
</FormControl>
<FormMessage />
</FormItem>
)}
/>

<FormField
control={form.control}
name="givePointsBack"
Expand Down
9 changes: 2 additions & 7 deletions server/routers/donation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { Stripe } from 'stripe'
import { TRPCError } from '@trpc/server'
import { Donation } from '@prisma/client'
import { z } from 'zod'
import crypto from 'crypto'
import * as ed from '@noble/ed25519'
import UserRepresentation from '@keycloak/keycloak-admin-client/lib/defs/userRepresentation'

import { protectedProcedure, publicProcedure, router } from '../trpc'
Expand All @@ -14,7 +12,6 @@ import { authenticateKeycloakClient } from '../utils/keycloak'
import { BtcPayCreateInvoiceRes, DonationMetadata } from '../types'
import { funds, fundSlugs } from '../../utils/funds'
import { fundSlugToCustomerIdAttr } from '../utils/funds'
import dayjs from 'dayjs'
import { getDonationAttestation, getMembershipAttestation } from '../utils/attestation'

export const donationRouter = router({
Expand Down Expand Up @@ -190,7 +187,6 @@ export const donationRouter = router({
recurring: z.boolean(),
taxDeductible: z.boolean(),
givePointsBack: z.boolean(),
showDonorNameOnLeaderboard: z.boolean(),
})
)
.mutation(async ({ input, ctx }) => {
Expand Down Expand Up @@ -249,7 +245,7 @@ export const donationRouter = router({
isTaxDeductible: input.taxDeductible ? 'true' : 'false',
staticGeneratedForApi: 'false',
givePointsBack: input.givePointsBack ? 'true' : 'false',
showDonorNameOnLeaderboard: input.showDonorNameOnLeaderboard ? 'true' : 'false',
showDonorNameOnLeaderboard: 'false',
}

const purchaseParams: Stripe.Checkout.SessionCreateParams = {
Expand Down Expand Up @@ -311,7 +307,6 @@ export const donationRouter = router({
fundSlug: z.enum(fundSlugs),
taxDeductible: z.boolean(),
givePointsBack: z.boolean(),
showDonorNameOnLeaderboard: z.boolean(),
})
)
.mutation(async ({ input, ctx }) => {
Expand Down Expand Up @@ -350,7 +345,7 @@ export const donationRouter = router({
isTaxDeductible: input.taxDeductible ? 'true' : 'false',
staticGeneratedForApi: 'false',
givePointsBack: input.givePointsBack ? 'true' : 'false',
showDonorNameOnLeaderboard: input.showDonorNameOnLeaderboard ? 'true' : 'false',
showDonorNameOnLeaderboard: 'false',
}

const { data: invoice } = await btcpayApi.post<BtcPayCreateInvoiceRes>(`/invoices`, {
Expand Down

0 comments on commit eb1ef19

Please sign in to comment.