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

fix: campaign application #1976

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
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
Loading