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

New campaign statuses #1956

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
14 changes: 5 additions & 9 deletions public/locales/bg/campaigns.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,17 +182,13 @@
"corporate-donor": "Корпоративен дарител"
},
"campaign-status": {
"initial": "В начален етап",
"draft": "Чернова",
"pending-validation": "Чакаща валидация",
"approved": "Одобрена",
"rejected": "Отхвърлена",
"active": "Активна",
"active-pending-validation": "Активна чака валидиране",
"suspended": "Спряна",
"complete": "Завършена",
"disabled": "Деактивирана",
"error": "Грешна",
"paused": "На пауза",
"suspended": "Спряна от организатор",
"partially_financed": "Частично финансирана",
"blocked": "Спряна",
"complete": "Успешнa",
"deleted": "Изтрита"
},
"campaignTypesFields": {
Expand Down
14 changes: 5 additions & 9 deletions public/locales/en/campaigns.json
Original file line number Diff line number Diff line change
Expand Up @@ -182,17 +182,13 @@
"corporate-donor": "Corporate Donor"
},
"campaign-status": {
"initial": "Initial",
"draft": "Draft",
"pending-validation": "Pending validation",
"approved": "Approved",
"rejected": "Rejected",
"active": "Active",
"active-pending-validation": "Active pending validation",
"suspended": "Suspended",
"complete": "Complete",
"disabled": "Disabled",
"error": "Error",
"suspended": "Suspended by organizer",
"complete": "Succeeded",
"paused": "Paused",
"partially_financed": "Partially financed",
"blocked": "Suspended",
"deleted": "Deleted"
},
"campaignTypesFields": {
Expand Down
3 changes: 0 additions & 3 deletions src/components/admin/campaigns/grid/EditForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,8 @@ const validationSchema: yup.SchemaOf<Omit<CampaignEditFormData, 'campaignFiles'>
})

const statesForDisableCurrencySelect = [
CampaignState.rejected,
CampaignState.suspended,
CampaignState.complete,
CampaignState.disabled,
CampaignState.error,
CampaignState.deleted,
CampaignState.active,
]
Expand Down
5 changes: 3 additions & 2 deletions src/components/client/campaigns/CampaignCard/CampaignCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -92,7 +92,8 @@ export default function ActiveCampaignCard({ campaign, index }: Props) {
</StyledContent>
</Link>
<StyledCardActions disableSpacing>
{(campaignState === CampaignState.complete && !allowDonationOnComplete) || (
{(campaignState === CampaignState.active ||
(canAcceptDonationState.has(campaignState) && allowDonationOnComplete)) && (
<DonateButton
href={routes.campaigns.oneTimeDonation(slug)}
variant="contained"
Expand Down
15 changes: 8 additions & 7 deletions src/components/client/campaigns/helpers/campaign.enums.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
export enum CampaignState {
initial = 'initial',
draft = 'draft',
pendingvalidation = 'pending_validation',
approved = 'approved',
rejected = 'rejected',
active = 'active',
activependingvalidation = 'active_pending_validation',
partially_financed = 'partially_financed',
suspended = 'suspended',
complete = 'complete',
disabled = 'disabled',
error = 'error',
blocked = 'blocked',
paused = 'paused',
deleted = 'deleted',
}

export const canAcceptDonationState = new Set([
CampaignState.partially_financed,
CampaignState.complete,
])

export enum StatisticsGroupBy {
DAY = 'day',
WEEK = 'week',
Expand Down
Loading