Skip to content

Commit

Permalink
donations: Use companyName when donation is made from corporate profile
Browse files Browse the repository at this point in the history
  • Loading branch information
sashko9807 committed Oct 20, 2023
1 parent 2be70ff commit 76fa2b1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/components/client/campaigns/DonationWishes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@ export default function DonationWishes({ campaignId, pageSize = 5 }: Props) {
fontSize: theme.typography.pxToRem(16),
color: theme.palette.grey[800],
}}>
{person ? person.firstName + ' ' + person.lastName : t('donations.anonymous')}
{person
? person.company
? person.company.companyName
: person.firstName + ' ' + person.lastName
: t('donations.anonymous')}
</Typography>
<Stack direction="row">
{donation && (
Expand Down
4 changes: 3 additions & 1 deletion src/components/client/campaigns/DonorsAndDonations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ export default function DonorsAndDonations({
<Grid>
<Typography className={classes.donatorName}>
{person
? `${person.firstName} ${person.lastName}`
? person.company
? `${person.company.companyName}`
: `${person.firstName} ${person.lastName}`
: t('campaigns:donations.anonymous')}
</Typography>
<Grid className={classes.donationQuantityAndTimeWrapper}>
Expand Down
12 changes: 11 additions & 1 deletion src/gql/campaigns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,14 @@ export type CampaignResponse = BaseCampaignResponse & {
category: CampaignTypeCategory
slug: string
}
summary: { reachedAmount: number; donors?: number; guaranteedAmount: number }
summary: {
reachedAmount: number
donors?: number
guaranteedAmount: number
withdrawnAmount: number
blockedAmount: number
currentAmount: number
}
beneficiary: {
id: UUID
type: BeneficiaryType
Expand Down Expand Up @@ -185,6 +192,9 @@ export type CampaignDonation = {
person: {
firstName: string
lastName: string
company: {
companyName: string
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/gql/donationWish.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export type DonationWishResponse = {
campaignId: UUID
donationId?: UUID
personId?: UUID
person?: { firstName: string; lastName: string }
person?: { firstName: string; lastName: string; company: { companyName: string } }
donation?: { amount: number; currency: string }
createdAt: DateTime
}
Expand Down

0 comments on commit 76fa2b1

Please sign in to comment.