-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Campaign Applications (alpha) (#1930)
* feat: file upload and summary - handle file upload one by one to allow for handling errors individually (otherwise the server just returns response failed for any one file that fails and no information about the successful uploads) - add summary where the uploaded and failed (if any) files are top and center - add a short explanation of what to do about failed files * feat: validation of create campaign application * fix: send campaignTypeId + editing + visuals - send campaignTypeId instead of the category (which is a property of the campaign type and is not enough to uniquely distinguish the type) - allow for editing and re-editing - style the summary - fix linting errors * chore: test create application - moved the useCreateOrEditApplication hook to own file to reuse for the admin campaign edit - added campaign end date handling (if the user selects a date for the end it pops up an input and fills in the preselected by user date or today if none) - removed some unused props from the cam app details - added msw v1 https://v1.mswjs.io/docs/getting-started/mocks/rest-api to mock the server responses for testing (Mock Service Worker) - expanded the test setup to provide Session and QueryClient * chore: add tests for the createOrEdit application hook * feat: admin edit - it uses the same controls/steps as the organizer edit but adds the admin only props on top - adds a link and copy button for the link where organizer can edit so as to include it if sending a mail to the org (e.g. for more info) - deletes the admin types - using same as regular - adds the status dropdown for admin edit - allows the accept terms checkboxes to be disabled for admin * feat: actual list of campaign applications * fix: small fixes * fix: pre-mature validation on basic step * fix: missing method
- Loading branch information
Showing
35 changed files
with
1,991 additions
and
450 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 19 additions & 7 deletions
26
src/components/admin/campaign-applications/CampaignApplicationAdminPropsEdit.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,45 @@ | ||
import { useTranslation } from 'next-i18next' | ||
|
||
import { Grid } from '@mui/material' | ||
import { StatusSelector } from 'components/client/campaign-application/helpers/campaign-application-status' | ||
import { | ||
StyledFormTextField, | ||
StyledStepHeading, | ||
} from 'components/client/campaign-application/helpers/campaignApplication.styled' | ||
import { CamAppDetail } from 'components/client/campaign-application/steps/CampaignApplicationSummary' | ||
import CheckboxField from 'components/common/form/CheckboxField' | ||
import OrganizerCanEditAt from './CampaignApplicationOrganizerCanEditAt' | ||
|
||
export default function CampaignApplicationAdminPropsEdit() { | ||
export default function CampaignApplicationAdminPropsEdit({ id }: { id: string }) { | ||
const { t } = useTranslation('campaign-application') | ||
|
||
return ( | ||
<Grid container spacing={6} justifyContent="center" direction="column" alignContent="center"> | ||
<Grid item container justifyContent="center"> | ||
<StyledStepHeading variant="h4">{t('steps.admin.title')}</StyledStepHeading> | ||
</Grid> | ||
<Grid item container spacing={6} justifyContent="space-between" direction="row"> | ||
<Grid item xs={12}> | ||
<StyledFormTextField label={t('steps.admin.status')} type="text" name="status" /> | ||
<Grid item xs={6}> | ||
<StatusSelector name="admin.state" /> | ||
</Grid> | ||
<Grid item xs={6}> | ||
<CheckboxField label={t('steps.admin.archived')} name="admin.archived" /> | ||
</Grid> | ||
</Grid> | ||
<Grid item container spacing={6} justifyContent="space-between" direction="row"> | ||
<Grid container item xs={12} md={6}> | ||
<Grid container item xs={12}> | ||
<StyledFormTextField | ||
label={t('steps.admin.external-url')} | ||
type="phone" | ||
name="ticketUrl" | ||
type="text" | ||
name="admin.ticketURL" | ||
/> | ||
</Grid> | ||
</Grid> | ||
<Grid item container spacing={6} justifyContent="space-between" direction="row" mb="20px"> | ||
<CamAppDetail | ||
label={t('steps.admin.organizer-edit-link')} | ||
value={<OrganizerCanEditAt id={id} />} | ||
/> | ||
</Grid> | ||
</Grid> | ||
) | ||
} |
23 changes: 23 additions & 0 deletions
23
src/components/admin/campaign-applications/CampaignApplicationOrganizerCanEditAt.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { routes } from 'common/routes' | ||
import { CopyTextButton } from 'components/common/CopyTextButton' | ||
import getConfig from 'next/config' | ||
import Copy from '@mui/icons-material/CopyAll' | ||
import { Typography } from '@mui/material' | ||
export type Props = { | ||
id: string | ||
} | ||
const OrganizerCanEditAt = ({ id }: Props) => { | ||
const { publicRuntimeConfig } = getConfig() | ||
const url = `${publicRuntimeConfig?.APP_URL}${routes.campaigns.applicationEdit(id)}` | ||
|
||
return ( | ||
<> | ||
<Typography variant="subtitle1" component="span"> | ||
{url} | ||
</Typography> | ||
<CopyTextButton label="" startIcon={<Copy />} text={url} title={`Copy ${url}`} /> | ||
</> | ||
) | ||
} | ||
|
||
export default OrganizerCanEditAt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.