From b5dafcc9d217b104a2183c3b3a4e01751d43c8eb Mon Sep 17 00:00:00 2001 From: Aleksandar Date: Wed, 9 Oct 2024 17:24:01 +0300 Subject: [PATCH] chore: Add donation button for complete and partially_finances if checkeed --- .../campaigns/CampaignCard/CampaignCard.tsx | 19 ++++++++++--------- .../campaigns/helpers/campaign.enums.ts | 5 +++++ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/components/client/campaigns/CampaignCard/CampaignCard.tsx b/src/components/client/campaigns/CampaignCard/CampaignCard.tsx index d5c7b81ef..e03031270 100644 --- a/src/components/client/campaigns/CampaignCard/CampaignCard.tsx +++ b/src/components/client/campaigns/CampaignCard/CampaignCard.tsx @@ -10,7 +10,7 @@ import theme from 'common/theme' import Link from 'components/common/Link' import CampaignProgress from 'components/client/campaigns/CampaignProgress' import SuccessfullCampaignTag from '../SuccessfullCampaignTag' -import { CampaignState } from '../helpers/campaign.enums' +import { CampaignState, canAcceptDonationState } from '../helpers/campaign.enums' import { Root } from './CampaignCard.styled' import { @@ -92,14 +92,15 @@ export default function ActiveCampaignCard({ campaign, index }: Props) { - {(campaignState === CampaignState.complete && !allowDonationOnComplete) || ( - - {t('cta.support')} - - )} + {campaignState === CampaignState.active || + (canAcceptDonationState.has(campaignState) && !allowDonationOnComplete) || ( + + {t('cta.support')} + + )} ) diff --git a/src/components/client/campaigns/helpers/campaign.enums.ts b/src/components/client/campaigns/helpers/campaign.enums.ts index 6b916d131..d407b5ebf 100644 --- a/src/components/client/campaigns/helpers/campaign.enums.ts +++ b/src/components/client/campaigns/helpers/campaign.enums.ts @@ -9,6 +9,11 @@ export enum CampaignState { deleted = 'deleted', } +export const canAcceptDonationState = new Set([ + CampaignState.partially_financed, + CampaignState.complete, +]) + export enum StatisticsGroupBy { DAY = 'day', WEEK = 'week',