Skip to content

Commit

Permalink
fix: campaign application (#1976)
Browse files Browse the repository at this point in the history
- fix order of fields (make the goal the last field on the 3-rd step)
- remove "Membership" from the list of campaign types (it's a system type)
  • Loading branch information
gparlakov authored Nov 22, 2024
1 parent 90d9973 commit 9dfbca6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default function CampaignApplicationBasic() {
/>
</Grid>
<Grid item xs={12}>
<CampaignTypeSelect name="applicationBasic.campaignType" />
<CampaignTypeSelect name="applicationBasic.campaignType" hideSystemTypes={true} />
</Grid>
<Grid item xs={12}>
<StyledFormTextField
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,6 @@ export default function CampaignApplicationDetails({ files, setFiles }: Props) {
<StyledStepHeading variant="h4">{t('steps.details.title')}</StyledStepHeading>
</Grid>
<Grid item container spacing={6} justifyContent="space-between" direction="row">
<Grid item xs={12}>
<FormTextField
type="text"
name="applicationDetails.cause"
label={t('steps.details.cause')}
multiline
rows={3}
/>
</Grid>
<Grid item xs={12}>
<FormTextField
type="text"
Expand All @@ -50,6 +41,15 @@ export default function CampaignApplicationDetails({ files, setFiles }: Props) {
rows={5}
/>
</Grid>
<Grid item xs={12}>
<FormTextField
type="text"
name="applicationDetails.cause"
label={t('steps.details.cause')}
multiline
rows={3}
/>
</Grid>
<Grid item xs={12}>
<FileUpload
buttonLabel={t('steps.details.documents')}
Expand Down
16 changes: 10 additions & 6 deletions src/components/client/campaigns/CampaignTypeSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import { useCampaignTypesList } from 'common/hooks/campaigns'
import { useField } from 'formik'
import { useTranslation } from 'next-i18next'

export default function CampaignTypeSelect({ name = 'campaignTypeId' }) {
const systemTypes = ['Membership']

export default function CampaignTypeSelect({ name = 'campaignTypeId', hideSystemTypes = false }) {
const { t } = useTranslation()
const { data } = useCampaignTypesList()
const [field, meta] = useField(name)
Expand All @@ -21,11 +23,13 @@ export default function CampaignTypeSelect({ name = 'campaignTypeId' }) {
<MenuItem value="" disabled>
{t('campaigns:campaign.type')}
</MenuItem>
{data?.map((campaignType, index) => (
<MenuItem key={index} value={campaignType.id}>
{campaignType.name}
</MenuItem>
))}
{data
?.filter((campaignType) => !hideSystemTypes || !systemTypes.includes(campaignType?.name))
?.map((campaignType, index) => (
<MenuItem key={index} value={campaignType.id}>
{campaignType.name}
</MenuItem>
))}
</Select>
{helperText && <FormHelperText error>{helperText}</FormHelperText>}
</FormControl>
Expand Down

0 comments on commit 9dfbca6

Please sign in to comment.