Skip to content

Commit

Permalink
feat: campaign application admin init (#1867)
Browse files Browse the repository at this point in the history
* feat: campaign application admin init

- issue #1842
- add a admin space for the campaign applications
- only skeleton - will be fleshed out iteratively
- add admin edit campaign application
  - it will show all the steps of the stepper (create campaign application) with addition of the admin-only editable stuff

* Update EditPage.tsx

* fix: linting for campaign application admin edit
  • Loading branch information
gparlakov authored Jul 5, 2024
1 parent 6b5d3e8 commit e39bab4
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 4 deletions.
11 changes: 7 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@ module.exports = {
endOfLine: 'auto',
},
],
'no-restricted-imports': ["error", {
"name": "react-i18next",
"message": "Please use next-i18next"
}]
'no-restricted-imports': [
'error',
{
name: 'react-i18next',
message: 'Please use next-i18next',
},
],
},
}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ Watch releases of this repository to be notified about future updates:
## Contributors ✨

<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->

[![All Contributors](https://img.shields.io/badge/all_contributors-82-orange.svg?style=flat-square)](#contributors-)

<!-- ALL-CONTRIBUTORS-BADGE:END -->

Please check [contributors guide](https://github.com/podkrepi-bg/frontend/blob/master/CONTRIBUTING.md) for:
Expand Down
4 changes: 4 additions & 0 deletions src/common/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ export const routes = {
viewCampaignBySlug: (slug: string) => `/admin/campaigns/${slug}`,
edit: (id: string) => `/admin/campaigns/edit/${id}`,
},
campaignApplications: {
index: '/admin/campaign-applications',
edit: (id: string) => `/admin/campaign-applications/edit/${id}`,
},
news: {
index: '/admin/campaign-news',
create: '/admin/campaign-news/create',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { useTranslation } from 'next-i18next'

import EditOutlinedIcon from '@mui/icons-material/EditOutlined'
import { IconButton } from '@mui/material'
import { routes } from 'common/routes'
import AdminContainer from 'components/common/navigation/AdminContainer'
import AdminLayout from 'components/common/navigation/AdminLayout'
import Link from 'next/link'

export default function CampaignApplicationsPage() {
const { t } = useTranslation('campaigns')

return (
<AdminLayout>
<AdminContainer title={t('Кандидат Кампании')}>
<div>Campaigns will appear here</div>
<Link href={routes.admin.campaignApplications.edit('mock-id')} passHref>
<IconButton size="small" color="primary">
<EditOutlinedIcon />
takes you to edit page
</IconButton>
</Link>
</AdminContainer>
</AdminLayout>
)
}
36 changes: 36 additions & 0 deletions src/components/admin/campaign-applications/EditPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { CampaignApplicationFormData } from 'components/client/campaign-application/helpers/campaignApplication.types'
import CampaignApplication from 'components/client/campaign-application/steps/CampaignApplication'
import CampaignApplicationDetails from 'components/client/campaign-application/steps/CampaignApplicationDetails'
import CampaignApplicationOrganizer from 'components/client/campaign-application/steps/CampaignApplicationOrganizer'
import GenericForm from 'components/common/form/GenericForm'
import AdminContainer from 'components/common/navigation/AdminContainer'
import AdminLayout from 'components/common/navigation/AdminLayout'

export default function EditPage() {
const initialValues = {
organizer: {
name: '',
phone: '',
email: '',
},
} as CampaignApplicationFormData

return (
<AdminLayout>
<AdminContainer title={'Кандидат Кампании'}>
Will layout all the steps from the stepper plus the admin step
<GenericForm<CampaignApplicationFormData>
onSubmit={(v) => console.log(v)}
initialValues={initialValues}>
<CampaignApplicationOrganizer />
</GenericForm>
<div>.</div>
<CampaignApplication />
<div>.</div>
<CampaignApplicationDetails />
<div>.</div>
Edit the status and ticket URL here
</AdminContainer>
</AdminLayout>
)
}
10 changes: 10 additions & 0 deletions src/components/common/navigation/adminMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ export const menuPeople = [
]
export const menuCampaings = [
{ label: 'Кампании', icon: AssignmentInd, href: routes.admin.campaigns.index },
{
label: 'Кандидат Кампании',
icon: AssignmentInd,
href: routes.admin.campaignApplications.index,
},
{ label: 'Новини', icon: ArticleOutlined, href: routes.admin.news.index },
{ label: 'Документи', icon: FolderShared, href: routes.admin.documents.index },
{ label: 'Злоупотреби', icon: ReportGmailerrorredIcon, href: routes.admin.irregularity.index },
Expand Down Expand Up @@ -73,6 +78,11 @@ export const items = [

export const adminCards = [
{ label: 'Кампании', icon: AssignmentInd, href: routes.admin.campaigns.index },
{
label: 'Кандидат Кампании',
icon: AssignmentInd,
href: routes.admin.campaignApplications.index,
},
{ label: 'Новини', icon: ArticleOutlined, href: routes.admin.news.index },
{ label: 'Плащания', icon: PaymentsIcon, href: routes.admin.payments.index },
{ label: 'Дарения', icon: VolunteerActivismOutlinedIcon, href: routes.admin.donations.index },
Expand Down
7 changes: 7 additions & 0 deletions src/pages/admin/campaign-applications/edit/[id].tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import EditPage from 'components/admin/campaign-applications/EditPage'

import { securedPropsWithTranslation } from 'middleware/auth/securedProps'

export const getServerSideProps = securedPropsWithTranslation()

export default EditPage
6 changes: 6 additions & 0 deletions src/pages/admin/campaign-applications/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import CampaignApplications from 'components/admin/campaign-applications/CampaignApplications'
import { securedPropsWithTranslation } from 'middleware/auth/securedProps'

export const getServerSideProps = securedPropsWithTranslation()

export default CampaignApplications

0 comments on commit e39bab4

Please sign in to comment.