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

Allow gift query parameter for more project types #476

Merged
merged 3 commits into from
Dec 4, 2024
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
9 changes: 7 additions & 2 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,13 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
}
}

// Set gift details if gift = true in the query params (only for tree projects)
if (context.query.gift === "true" && projectDetails?.purpose === "trees") {
// Set gift details if gift = true in the query params
if (
giftDetails?.type !== "direct" &&
context.query.gift === "true" &&
projectDetails !== null &&
!NON_GIFTABLE_PROJECT_PURPOSES.includes(projectDetails.purpose)
) {
isGift = true;
giftDetails = {
type: "invitation",
Expand Down
6 changes: 3 additions & 3 deletions src/Common/Types/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import {
} from "@planet-sdk/common";

/** planet-donations only allows direct or invitation gifts */
export type DirectGiftDetails = SentDirectGift & {
export interface DirectGiftDetails extends SentDirectGift {
recipientName?: string;
recipientProfile?: string;
};
export type InvitationGiftDetails = SentInvitationGift;
}
export interface InvitationGiftDetails extends SentInvitationGift {}

export type SentGift = SentDirectGift | SentInvitationGift;

Expand Down
Loading