From 66552ecd81b607ed18475d4d4146751e99e04bcf Mon Sep 17 00:00:00 2001 From: mohitb35 <44917347+mohitb35@users.noreply.github.com> Date: Wed, 13 Nov 2024 10:55:36 +0530 Subject: [PATCH] feat: rename projectDetails `classification` to `category` --- pages/index.tsx | 2 +- src/Common/Types/index.tsx | 8 ++++---- src/Donations/Components/DonationsForm.tsx | 8 +++----- src/Donations/Micros/GiftForm.tsx | 2 +- src/Utils/createProjectDetails.ts | 6 +++--- 5 files changed, 12 insertions(+), 14 deletions(-) diff --git a/pages/index.tsx b/pages/index.tsx index ba7c560b..597d2eec 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -409,7 +409,7 @@ export const getServerSideProps: GetServerSideProps = async (context) => { utmSource = context.query.utm_source; // Set gift details if there is s (support link) in the query params - if (projectDetails?.classification !== "membership" && context.query.s) { + if (projectDetails?.category !== "membership" && context.query.s) { try { const requestParams = { url: `/app/profiles/${context.query.s}`, diff --git a/src/Common/Types/index.tsx b/src/Common/Types/index.tsx index 704002d7..2007d186 100644 --- a/src/Common/Types/index.tsx +++ b/src/Common/Types/index.tsx @@ -127,7 +127,7 @@ export interface FetchedBaseProjectDetails { ownerName: string | null; image?: string | null; purpose: ProjectPurpose; - classification: Nullable; + category: Nullable; taxDeductionCountries?: Array; isApproved: boolean; isTopProject: boolean; @@ -135,17 +135,17 @@ export interface FetchedBaseProjectDetails { export interface FetchedTreeProjectDetails extends FetchedBaseProjectDetails { purpose: "trees"; - classification: TreeProjectClassification; + category: TreeProjectClassification; } export interface FetchedFundsProjectDetails extends FetchedBaseProjectDetails { purpose: "funds"; - classification: FundsProjectClassification; + category: FundsProjectClassification; } export interface FetchedOtherProjectDetails extends FetchedBaseProjectDetails { purpose: "conservation" | "reforestation" | "bouquet" | "planet-cash"; - classification: null; + category: null; } export type FetchedProjectDetails = diff --git a/src/Donations/Components/DonationsForm.tsx b/src/Donations/Components/DonationsForm.tsx index 34315458..63798c29 100644 --- a/src/Donations/Components/DonationsForm.tsx +++ b/src/Donations/Components/DonationsForm.tsx @@ -130,14 +130,12 @@ function DonationsForm(): ReactElement { !(isGift && giftDetails.recipientName === "") && !(onBehalf && onBehalfDonor.firstName === ""); - const canSendDirectGift = projectDetails?.classification !== "membership"; + const canSendDirectGift = projectDetails?.category !== "membership"; const hasDirectGift = giftDetails.type === "direct"; const canSendInvitationGift = !hasDirectGift && - ((projectDetails?.classification !== "membership" && - frequency === "once") || - (projectDetails?.classification === "membership" && - frequency !== "once")); + ((projectDetails?.category !== "membership" && frequency === "once") || + (projectDetails?.category === "membership" && frequency !== "once")); //Only used for native pay. Is this still applicable, or should this be removed? const onPaymentFunction = async ( diff --git a/src/Donations/Micros/GiftForm.tsx b/src/Donations/Micros/GiftForm.tsx index 05819242..21cec0e7 100644 --- a/src/Donations/Micros/GiftForm.tsx +++ b/src/Donations/Micros/GiftForm.tsx @@ -115,7 +115,7 @@ export default function GiftForm(): ReactElement { )} - {projectDetails?.classification !== "membership" && ( + {projectDetails?.category !== "membership" && ( <> {showEmail ? (
diff --git a/src/Utils/createProjectDetails.ts b/src/Utils/createProjectDetails.ts index 64ad6df2..bb491b72 100644 --- a/src/Utils/createProjectDetails.ts +++ b/src/Utils/createProjectDetails.ts @@ -20,19 +20,19 @@ export const createProjectDetails = ( return { ...baseDetails, purpose: "trees", - classification: paymentOptions.classification, + category: paymentOptions.category, }; case "funds": return { ...baseDetails, purpose: "funds", - classification: paymentOptions.classification, + category: paymentOptions.category, }; default: return { ...baseDetails, purpose: paymentOptions.purpose, - classification: null, + category: null, }; } };