diff --git a/packages/client/src/v2-events/GLOSSARY.md b/packages/client/src/v2-events/GLOSSARY.md new file mode 100644 index 0000000000..b7bb411365 --- /dev/null +++ b/packages/client/src/v2-events/GLOSSARY.md @@ -0,0 +1,11 @@ +| Entity | Description | +| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| Event | A life event (e.g., dog adoption). An entry in the database describing a past life event and all steps (actions) involved in the process. | +| EventConfig | Description of event features defined by the country. Includes configuration for process steps (`Action`) and forms (`ActionConfig`) involved. | +| EventInput | A subset of an event. Describes fields that can be sent to the system with the intention of either creating or mutating a an event | +| EventIndex | A subset of an event. Describes how the event is stored in the search index. Contains static fields shared by all event types and custom fields defined by event configuration | +| User | User in the system. Might be a practitioner or an admin or something else. | +| Location | Describes a physical location. Can be a admin structure, an office or something else. Cannot be anyone's personal home address | +| Action | Event contains one or more actions. Action is a system event which triggers a status change. See `ActionConfig` | +| ActionConfig | Each action defines a form, which needs to be filled in order for the status to change. Configuration can have multiple forms, out of which **only one can be active**. | +| FormConfig |  Form config defines separate read (`review`) and write (`pages`) configurations for itself. | diff --git a/packages/client/src/v2-events/README.md b/packages/client/src/v2-events/README.md index f0782cc26b..e7c2846926 100644 --- a/packages/client/src/v2-events/README.md +++ b/packages/client/src/v2-events/README.md @@ -9,6 +9,14 @@ Client for managing custom events. /components # Features used by routes /features + /events + # Each action has 'review' and 'pages' definitions to match configuration + /actions + [Action]/ + Pages.tsx + Review.tsx + # exports Pages and Review + index.ts # Reusable layouts used between features /layouts # Route definitions and application structure @@ -24,6 +32,6 @@ We will be iterating over the structure during the project. Treat it as a starti ## Development practices - Do not import components outside v2-events. If you need a component, copy it in and refactor it. -- When building new features, aim to have a separate component that handles interaction with router and data fetching when it makes sense. Features should be route independent, and necessary information (ids and such) should be passed in as props or similar. See (`features/events/actions/register/Register.tsx`) +- When building new features, aim to have a separate component that handles interaction with router and data fetching when it makes sense. Features should be route independent, and necessary information (ids and such) should be passed in as props or similar. See (`features/events/actions/register` or `features/events/actions/declare`) - Use constants through object pattern. e.g.`ActionType.CREATE` over `'CREATE'`. In most situations, it does not matter. However, changing the names will get much easier. - When building new features, prefer to import them through `index.ts`. Managing imports will be cleaner and easier that way. See (`/layouts`) diff --git a/packages/client/src/v2-events/features/events/actions/declare/Declare.tsx b/packages/client/src/v2-events/features/events/actions/declare/Declare.tsx deleted file mode 100644 index 663c2ead40..0000000000 --- a/packages/client/src/v2-events/features/events/actions/declare/Declare.tsx +++ /dev/null @@ -1,149 +0,0 @@ -/* - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at https://mozilla.org/MPL/2.0/. - * - * OpenCRVS is also distributed under the terms of the Civil Registration - * & Healthcare Disclaimer located at http://opencrvs.org/license. - * - * Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS. - */ - -import React, { useEffect } from 'react' -import { useIntl } from 'react-intl' -import { useLocation, useNavigate, useParams } from 'react-router-dom' -import { FormWizard, Spinner } from '@opencrvs/components' -import { FormFieldGenerator } from '@client/v2-events/components/forms/FormFieldGenerator' -import { usePagination } from '@client/v2-events/hooks/usePagination' - -import { useEventConfiguration } from '@client/v2-events//features/events/useEventConfiguration' -import { useEventFormData } from '@client/v2-events//features/events/useEventFormData' -import { useEventFormNavigation } from '@client/v2-events//features/events/useEventFormNavigation' -import { useEvents } from '@client/v2-events//features/events/useEvents/useEvents' -import { ROUTES } from '@client/v2-events/routes' -export function DeclareIndex() { - return ( - }> - - - ) -} - -function Declare() { - const { eventId, pageId } = useParams<{ - eventId: string - pageId?: string - }>() - - const location = useLocation() - const searchParams = new URLSearchParams(location.search) - const fromPage = searchParams.get('from') || 'unknown' - const navigate = useNavigate() - const events = useEvents() - - if (!eventId) { - throw new Error('Event ID is required') - } - - // @TODO: Fix types - const [event] = events.getEvent(eventId) - - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - if (!event) { - throw new Error('Event not found') - } - const { eventConfiguration: configuration } = useEventConfiguration( - event.type - ) - - if (!configuration) { - throw new Error('Event configuration not found with type: ' + event.type) - } - const getFormValues = useEventFormData((state) => state.getFormValues) - const formValues = getFormValues(eventId) - const setFormValues = useEventFormData((state) => state.setFormValues) - - useEffect(() => { - const hasTemporaryId = event.id === event.transactionId - - if (eventId !== event.id && !hasTemporaryId) { - navigate( - ROUTES.V2.EVENTS.DECLARE.buildPath({ - eventId: event.id - }) - ) - } - }, [event.id, event.transactionId, eventId, navigate]) - - const pages = configuration.actions[0].forms[0].pages - const { - page: currentPage, - next, - previous, - total - } = usePagination( - pages.length, - pageId ? pages.findIndex((p) => p.id === pageId) : 0 - ) - - useEffect(() => { - if (!pageId) { - navigate( - ROUTES.V2.EVENTS.DECLARE.PAGE.buildPath({ - eventId: event.id, - pageId: pages[0].id - }) - ) - } - - const reviewPage = !pages.find((p) => p.id === pageId) - if (reviewPage) { - return - } - - const pageChanged = pages[currentPage].id !== pageId - if (pageChanged) { - navigate( - ROUTES.V2.EVENTS.DECLARE.PAGE.buildPath({ - eventId: event.id, - pageId: pages[currentPage].id - }) - ) - } - }, [event.id, navigate, pageId, pages, currentPage]) - - const intl = useIntl() - - const { modal, goToReview } = useEventFormNavigation() - - const page = pages[currentPage] - - return ( - <> - {modal} - { - goToReview(event.id) - }} - > - { - setFormValues(eventId, values) - }} - /> - - - ) -} diff --git a/packages/client/src/v2-events/features/events/actions/declare/Pages.tsx b/packages/client/src/v2-events/features/events/actions/declare/Pages.tsx new file mode 100644 index 0000000000..f05ac4107e --- /dev/null +++ b/packages/client/src/v2-events/features/events/actions/declare/Pages.tsx @@ -0,0 +1,86 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * OpenCRVS is also distributed under the terms of the Civil Registration + * & Healthcare Disclaimer located at http://opencrvs.org/license. + * + * Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS. + */ + +import React, { useEffect } from 'react' +import { useNavigate } from 'react-router-dom' +import { + useTypedParams, + useTypedSearchParams +} from 'react-router-typesafe-routes/dom' +import { ActionType } from '@opencrvs/commons/client' +import { useEventConfiguration } from '@client/v2-events/features/events/useEventConfiguration' +import { useEventFormNavigation } from '@client/v2-events/features/events/useEventFormNavigation' +import { useEvents } from '@client/v2-events//features/events/useEvents/useEvents' +import { ROUTES } from '@client/v2-events/routes' +import { Pages as PagesComponent } from '@client/v2-events/features/events/components/Pages' + +export function Pages() { + const { eventId, pageId } = useTypedParams(ROUTES.V2.EVENTS.DECLARE.PAGES) + const [searchParams] = useTypedSearchParams(ROUTES.V2.EVENTS.DECLARE.PAGES) + const navigate = useNavigate() + const events = useEvents() + const { modal } = useEventFormNavigation() + + const [event] = events.getEvent(eventId) + + const { eventConfiguration: configuration } = useEventConfiguration( + event.type + ) + const formPages = configuration?.actions + .find((action) => action.type === ActionType.DECLARE) + ?.forms.find((form) => form.active)?.pages + + if (!formPages) { + throw new Error('Form configuration not found for type: ' + event.type) + } + + const currentPageId = + formPages.find((p) => p.id === pageId)?.id || formPages[0]?.id + + if (!currentPageId) { + throw new Error('Form does not have any pages') + } + + useEffect(() => { + if (pageId !== currentPageId) { + navigate( + ROUTES.V2.EVENTS.DECLARE.PAGES.buildPath({ + eventId, + pageId: currentPageId + }), + { replace: true } + ) + } + }, [pageId, currentPageId, navigate, eventId]) + + return ( + <> + {modal} + + navigate( + ROUTES.V2.EVENTS.DECLARE.PAGES.buildPath({ + eventId, + pageId: nextPageId + }) + ) + } + onSubmit={() => + navigate(ROUTES.V2.EVENTS.DECLARE.REVIEW.buildPath({ eventId })) + } + /> + + ) +} diff --git a/packages/client/src/v2-events/features/events/actions/declare/Review.tsx b/packages/client/src/v2-events/features/events/actions/declare/Review.tsx index f65cc95866..81b8bcca93 100644 --- a/packages/client/src/v2-events/features/events/actions/declare/Review.tsx +++ b/packages/client/src/v2-events/features/events/actions/declare/Review.tsx @@ -28,7 +28,7 @@ import { useEventFormNavigation } from '@client/v2-events/features/events/useEve import { useEvents } from '@client/v2-events/features/events/useEvents/useEvents' import { useModal } from '@client/v2-events/hooks/useModal' import { ROUTES } from '@client/v2-events/routes' -import { Preview } from '@client/v2-events/features/events/components/Preview' +import { Review as ReviewComponent } from '@client/v2-events/features/events/components/Review' const messages = defineMessages({ reviewActionTitle: { @@ -97,7 +97,7 @@ interface RejectionState { isDuplicate: boolean } -export function ReviewSection() { +export function Review() { const { eventId } = useTypedParams(ROUTES.V2.EVENTS.DECLARE.REVIEW) const events = useEvents() const navigate = useNavigate() @@ -129,12 +129,12 @@ export function ReviewSection() { fieldId?: string }) { const confirmedEdit = await openModal((close) => ( - + )) if (confirmedEdit) { navigate( - ROUTES.V2.EVENTS.DECLARE.PAGE.buildPath( + ROUTES.V2.EVENTS.DECLARE.PAGES.buildPath( { pageId, eventId }, { from: 'review' @@ -149,7 +149,7 @@ export function ReviewSection() { async function handleDeclaration() { const confirmedDeclaration = await openModal((close) => ( - + )) if (confirmedDeclaration) { declareMutation.mutate({ @@ -184,7 +184,7 @@ export function ReviewSection() { return ( <> - - - + {modal} ) diff --git a/packages/client/src/v2-events/features/events/actions/declare/index.tsx b/packages/client/src/v2-events/features/events/actions/declare/index.tsx new file mode 100644 index 0000000000..9fa680c000 --- /dev/null +++ b/packages/client/src/v2-events/features/events/actions/declare/index.tsx @@ -0,0 +1,15 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * OpenCRVS is also distributed under the terms of the Civil Registration + * & Healthcare Disclaimer located at http://opencrvs.org/license. + * + * Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS. + */ + +import { Pages } from './Pages' +import { Review } from './Review' + +export { Pages, Review } diff --git a/packages/client/src/v2-events/features/events/actions/register/Pages.tsx b/packages/client/src/v2-events/features/events/actions/register/Pages.tsx new file mode 100644 index 0000000000..6254b88b33 --- /dev/null +++ b/packages/client/src/v2-events/features/events/actions/register/Pages.tsx @@ -0,0 +1,87 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * OpenCRVS is also distributed under the terms of the Civil Registration + * & Healthcare Disclaimer located at http://opencrvs.org/license. + * + * Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS. + */ + +import React, { useEffect } from 'react' +import { useNavigate } from 'react-router-dom' +import { + useTypedParams, + useTypedSearchParams +} from 'react-router-typesafe-routes/dom' +import { current } from '@reduxjs/toolkit' +import { ActionType } from '@opencrvs/commons/client' +import { useEventConfiguration } from '@client/v2-events/features/events/useEventConfiguration' +import { useEventFormNavigation } from '@client/v2-events/features/events/useEventFormNavigation' +import { useEvents } from '@client/v2-events//features/events/useEvents/useEvents' +import { ROUTES } from '@client/v2-events/routes' +import { Pages as PagesComponent } from '@client/v2-events/features/events/components/Pages' + +export function Pages() { + const { eventId, pageId } = useTypedParams(ROUTES.V2.EVENTS.REGISTER.PAGES) + const [searchParams] = useTypedSearchParams(ROUTES.V2.EVENTS.REGISTER.PAGES) + const navigate = useNavigate() + const events = useEvents() + const { modal } = useEventFormNavigation() + + const [event] = events.getEvent(eventId) + + const { eventConfiguration: configuration } = useEventConfiguration( + event.type + ) + const formPages = configuration?.actions + .find((action) => action.type === ActionType.REGISTER) + ?.forms.find((form) => form.active)?.pages + + if (!formPages) { + throw new Error('Form configuration not found for type: ' + event.type) + } + + const currentPageId = + formPages.find((p) => p.id === pageId)?.id || formPages[0]?.id + + if (!currentPageId) { + throw new Error('Form does not have any pages') + } + + useEffect(() => { + if (pageId !== currentPageId) { + navigate( + ROUTES.V2.EVENTS.REGISTER.PAGES.buildPath({ + eventId, + pageId: currentPageId + }), + { replace: true } + ) + } + }, [pageId, currentPageId, navigate, eventId]) + + return ( + <> + {modal} + + navigate( + ROUTES.V2.EVENTS.REGISTER.PAGES.buildPath({ + eventId, + pageId: nextPageId + }) + ) + } + onSubmit={() => + navigate(ROUTES.V2.EVENTS.REGISTER.REVIEW.buildPath({ eventId })) + } + /> + + ) +} diff --git a/packages/client/src/v2-events/features/events/actions/register/Register.tsx b/packages/client/src/v2-events/features/events/actions/register/Review.tsx similarity index 87% rename from packages/client/src/v2-events/features/events/actions/register/Register.tsx rename to packages/client/src/v2-events/features/events/actions/register/Review.tsx index 9f61a08099..bbe407b44d 100644 --- a/packages/client/src/v2-events/features/events/actions/register/Register.tsx +++ b/packages/client/src/v2-events/features/events/actions/register/Review.tsx @@ -14,10 +14,10 @@ import { defineMessages } from 'react-intl' import { useNavigate } from 'react-router-dom' import { v4 as uuid } from 'uuid' import { useTypedParams } from 'react-router-typesafe-routes/dom' -import { getCurrentEventState } from '@opencrvs/commons/client' +import { getCurrentEventState, ActionType } from '@opencrvs/commons/client' import { ROUTES } from '@client/v2-events/routes' import { useEvents } from '@client/v2-events/features/events/useEvents/useEvents' -import { Preview } from '@client/v2-events/features/events/components/Preview' +import { Review as ReviewComponent } from '@client/v2-events/features/events/components/Review' import { useModal } from '@client/v2-events/hooks/useModal' import { useEventFormNavigation } from '@client/v2-events/features/events/useEventFormNavigation' import { useEventConfiguration } from '@client/v2-events/features/events/useEventConfiguration' @@ -46,7 +46,7 @@ const messages = defineMessages({ * * Preview of event to be registered. */ -export function RegisterIndex() { +export function Review() { const { eventId } = useTypedParams(ROUTES.V2.EVENTS.REGISTER) const events = useEvents() const [modal, openModal] = useModal() @@ -63,7 +63,7 @@ export function RegisterIndex() { } const { forms: formConfigs } = config.actions.filter( - (action) => action.type === 'REGISTER' + (action) => action.type === ActionType.REGISTER )[0] const setFormValues = useEventFormData((state) => state.setFormValues) @@ -83,15 +83,15 @@ export function RegisterIndex() { fieldId?: string }) { const confirmedEdit = await openModal((close) => ( - + )) if (confirmedEdit) { navigate( - ROUTES.V2.EVENTS.DECLARE.PAGE.buildPath( + ROUTES.V2.EVENTS.REGISTER.PAGES.buildPath( { pageId, eventId }, { - from: 'register' + from: 'review' }, fieldId ) @@ -102,7 +102,7 @@ export function RegisterIndex() { async function handleRegistration() { const confirmedRegistration = await openModal((close) => ( - + )) if (confirmedRegistration) { registerMutation.mutate({ @@ -116,14 +116,14 @@ export function RegisterIndex() { } return ( - - {modal} - + ) } diff --git a/packages/client/src/v2-events/features/events/actions/register/index.ts b/packages/client/src/v2-events/features/events/actions/register/index.ts new file mode 100644 index 0000000000..8d964f211e --- /dev/null +++ b/packages/client/src/v2-events/features/events/actions/register/index.ts @@ -0,0 +1,15 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * OpenCRVS is also distributed under the terms of the Civil Registration + * & Healthcare Disclaimer located at http://opencrvs.org/license. + * + * Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS. + */ + +import { Review } from './Review' +import { Pages } from './Pages' + +export { Review, Pages } diff --git a/packages/client/src/v2-events/features/events/components/Pages.tsx b/packages/client/src/v2-events/features/events/components/Pages.tsx new file mode 100644 index 0000000000..a1b85f2644 --- /dev/null +++ b/packages/client/src/v2-events/features/events/components/Pages.tsx @@ -0,0 +1,85 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + * + * OpenCRVS is also distributed under the terms of the Civil Registration + * & Healthcare Disclaimer located at http://opencrvs.org/license. + * + * Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS. + */ + +import React, { useEffect } from 'react' +import { useIntl } from 'react-intl' +import { FormWizard } from '@opencrvs/components' +import { FormPage } from '@opencrvs/commons' +import { FormFieldGenerator } from '@client/v2-events/components/forms/FormFieldGenerator' +import { usePagination } from '@client/v2-events/hooks/usePagination' +import { useEventFormData } from '@client/v2-events/features/events/useEventFormData' + +/** + * + * Reusable component for rendering a form with pagination. Used by different action forms + */ +export function Pages({ + eventId, + pageId, + showReviewButton, + formPages, + onFormPageChange, + onSubmit +}: { + eventId: string + pageId: string + showReviewButton?: boolean + formPages: FormPage[] + onFormPageChange: (nextPageId: string) => void + onSubmit: () => void +}) { + const intl = useIntl() + + const getFormValues = useEventFormData((state) => state.getFormValues) + const formValues = getFormValues(eventId) + const setFormValues = useEventFormData((state) => state.setFormValues) + + const pageIdx = formPages.findIndex((p) => p.id === pageId) + + const { + page: currentPage, + next, + previous, + total + } = usePagination(formPages.length, Math.max(pageIdx, 0)) + const page = formPages[currentPage] + + useEffect(() => { + const pageChanged = formPages[currentPage].id !== pageId + + if (pageChanged) { + onFormPageChange(formPages[currentPage].id) + } + }, [pageId, currentPage, formPages, onFormPageChange]) + + return ( + + { + setFormValues(eventId, values) + }} + /> + + ) +} diff --git a/packages/client/src/v2-events/features/events/components/Preview.tsx b/packages/client/src/v2-events/features/events/components/Review.tsx similarity index 92% rename from packages/client/src/v2-events/features/events/components/Preview.tsx rename to packages/client/src/v2-events/features/events/components/Review.tsx index 539960743a..5d79739be5 100644 --- a/packages/client/src/v2-events/features/events/components/Preview.tsx +++ b/packages/client/src/v2-events/features/events/components/Review.tsx @@ -105,7 +105,7 @@ const ReviewContainter = styled.div` ` const DeclarationDataContainer = styled.div`` -const previewMessages = defineMessages({ +const reviewMessages = defineMessages({ changeButton: { id: 'buttons.change', defaultMessage: 'Change', @@ -156,10 +156,10 @@ const previewMessages = defineMessages({ }) /** - * Preview component, used to display the "read-only" version of the form. + * Review component, used to display the "read" version of the form. * User can review the data and take actions like declare, reject or edit the data. */ -function PreviewComponent({ +function ReviewComponent({ eventConfig, formConfig, form, @@ -212,7 +212,7 @@ function PreviewComponent({ onEdit({ pageId: page.id }) }} > - {intl.formatMessage(previewMessages.changeButton)} + {intl.formatMessage(reviewMessages.changeButton)} } expand={true} @@ -237,7 +237,7 @@ function PreviewComponent({ }} > {intl.formatMessage( - previewMessages.changeButton + reviewMessages.changeButton )} } @@ -366,7 +366,7 @@ function EditModal({ close }: { close: (result: boolean | null) => void }) { close(null) }} > - {intl.formatMessage(previewMessages.changeModalCancel)} + {intl.formatMessage(reviewMessages.changeModalCancel)} , ]} handleClose={() => close(null)} responsive={false} show={true} - title={intl.formatMessage(previewMessages.changeModalTitle)} + title={intl.formatMessage(reviewMessages.changeModalTitle)} > - {intl.formatMessage(previewMessages.changeModalDescription)} + {intl.formatMessage(reviewMessages.changeModalDescription)} @@ -413,7 +413,7 @@ function ActionModal({ close(null) }} > - {intl.formatMessage(previewMessages.actionModalCancel)} + {intl.formatMessage(reviewMessages.actionModalCancel)} , @@ -431,19 +431,19 @@ function ActionModal({ handleClose={() => close(null)} responsive={false} show={true} - title={intl.formatMessage(previewMessages.actionModalTitle, { action })} + title={intl.formatMessage(reviewMessages.actionModalTitle, { action })} > - {intl.formatMessage(previewMessages.actionModalDescription)} + {intl.formatMessage(reviewMessages.actionModalDescription)} ) } -export const Preview = { - Body: PreviewComponent, +export const Review = { + Body: ReviewComponent, Actions: PreviewActionComponent, EditModal: EditModal, ActionModal: ActionModal diff --git a/packages/client/src/v2-events/features/workqueues/EventOverview/EventOverview.tsx b/packages/client/src/v2-events/features/workqueues/EventOverview/EventOverview.tsx index 280c88b7f0..57e73e59e3 100644 --- a/packages/client/src/v2-events/features/workqueues/EventOverview/EventOverview.tsx +++ b/packages/client/src/v2-events/features/workqueues/EventOverview/EventOverview.tsx @@ -41,7 +41,6 @@ export function EventOverviewIndex() { const { getEvents, getEventById } = useEvents() const user = useSelector(getUserDetails) - // @TODO: double check whether this indeed returns always non falsy value const [config] = useEventConfigurations() const { data: fullEvent } = getEventById.useQuery(params.eventId) @@ -49,8 +48,7 @@ export function EventOverviewIndex() { const { data: events } = getEvents.useQuery() const event = events?.find((e) => e.id === params.eventId) - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - if (!event || !config || !fullEvent?.actions) { + if (!event || !fullEvent?.actions) { return null } diff --git a/packages/client/src/v2-events/routes/config.tsx b/packages/client/src/v2-events/routes/config.tsx index ae5a7dd0f7..096c73edc6 100644 --- a/packages/client/src/v2-events/routes/config.tsx +++ b/packages/client/src/v2-events/routes/config.tsx @@ -11,14 +11,12 @@ import React from 'react' import { Outlet } from 'react-router-dom' -import { DeclareIndex } from '@client/v2-events//features/events/actions/declare/Declare' import { EventSelection } from '@client/v2-events/features/events/EventSelection' - import { EventOverviewIndex } from '@client/v2-events/features/workqueues/EventOverview/EventOverview' import { WorkqueueIndex } from '@client/v2-events/features/workqueues/Workqueue' import { TRPCProvider } from '@client/v2-events/trpc' -import { ReviewSection } from '@client/v2-events/features/events/actions/declare/Review' -import { RegisterIndex } from '@client/v2-events/features/events/actions/register/Register' +import * as Declare from '@client/v2-events/features/events/actions/declare' +import * as Register from '@client/v2-events/features/events/actions/register' import { WorkqueueLayout, FormLayout } from '@client/v2-events/layouts' import { ROUTES } from './routes' @@ -73,15 +71,15 @@ export const routesConfig = { children: [ { index: true, - element: + element: }, { - path: ROUTES.V2.EVENTS.DECLARE.PAGE.path, - element: + path: ROUTES.V2.EVENTS.DECLARE.PAGES.path, + element: }, { path: ROUTES.V2.EVENTS.DECLARE.REVIEW.path, - element: + element: } ] }, @@ -95,7 +93,15 @@ export const routesConfig = { children: [ { index: true, - element: + element: + }, + { + path: ROUTES.V2.EVENTS.REGISTER.PAGES.path, + element: + }, + { + path: ROUTES.V2.EVENTS.REGISTER.REVIEW.path, + element: } ] } diff --git a/packages/client/src/v2-events/routes/routes.ts b/packages/client/src/v2-events/routes/routes.ts index 52401de47e..b71f625039 100644 --- a/packages/client/src/v2-events/routes/routes.ts +++ b/packages/client/src/v2-events/routes/routes.ts @@ -33,8 +33,8 @@ export const ROUTES = { }, { REVIEW: route('review'), - PAGE: route('page/:pageId', { - params: { pageId: string().defined() }, + PAGES: route('pages/:pageId', { + params: { pageId: string() }, searchParams: { from: string() }, @@ -49,8 +49,8 @@ export const ROUTES = { }, { REVIEW: route('review'), - PAGE: route('page/:pageId', { - params: { pageId: string().defined() }, + PAGES: route('pages/:pageId', { + params: { pageId: string() }, searchParams: { from: string() }, diff --git a/packages/events/src/tests/global-setup.ts b/packages/events/src/tests/global-setup.ts index 74e63e7019..bc5adfec26 100644 --- a/packages/events/src/tests/global-setup.ts +++ b/packages/events/src/tests/global-setup.ts @@ -10,7 +10,6 @@ */ import { MongoMemoryServer } from 'mongodb-memory-server' - export type { ProvidedContext } from 'vitest' declare module 'vitest' {