Skip to content

Commit

Permalink
feat: rename projectDetails classification to category
Browse files Browse the repository at this point in the history
mohitb35 committed Nov 13, 2024
1 parent 562fa92 commit 66552ec
Showing 5 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pages/index.tsx
Original file line number Diff line number Diff line change
@@ -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}`,
8 changes: 4 additions & 4 deletions src/Common/Types/index.tsx
Original file line number Diff line number Diff line change
@@ -127,25 +127,25 @@ export interface FetchedBaseProjectDetails {
ownerName: string | null;
image?: string | null;
purpose: ProjectPurpose;
classification: Nullable<ProjectClassification>;
category: Nullable<ProjectClassification>;
taxDeductionCountries?: Array<string>;
isApproved: boolean;
isTopProject: boolean;
}

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 =
8 changes: 3 additions & 5 deletions src/Donations/Components/DonationsForm.tsx
Original file line number Diff line number Diff line change
@@ -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 (
2 changes: 1 addition & 1 deletion src/Donations/Micros/GiftForm.tsx
Original file line number Diff line number Diff line change
@@ -115,7 +115,7 @@ export default function GiftForm(): ReactElement {
)}
</div>

{projectDetails?.classification !== "membership" && (
{projectDetails?.category !== "membership" && (
<>
{showEmail ? (
<div>
6 changes: 3 additions & 3 deletions src/Utils/createProjectDetails.ts
Original file line number Diff line number Diff line change
@@ -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,
};
}
};

0 comments on commit 66552ec

Please sign in to comment.