Skip to content

Commit

Permalink
router: export paths
Browse files Browse the repository at this point in the history
  • Loading branch information
ddecrulle committed Jun 7, 2024
1 parent 56f62ba commit 755e195
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 9 deletions.
4 changes: 3 additions & 1 deletion src/pages/Accessibility/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import { createRoute } from '@tanstack/react-router'
import { rootRoute } from 'router/router'
import { AccessibilityPage } from './AccessibilityPage'

export const accessibilityPath = '/accessibilite'

export const accessibilityRoute = createRoute({
getParentRoute: () => rootRoute,
path: 'accessibilite',
path: accessibilityPath,
component: AccessibilityPage,
loader: () => {
//TODO get name (Filière d'Enquête) in metadata
Expand Down
1 change: 1 addition & 0 deletions src/pages/Collect/CollectPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { useDocumentTitle } from 'shared/hooks/useDocumentTitle'
import { useSetLogoutQuestionnaire } from 'shared/hooks/useLogoutUrl'
import { collectRoute } from './route'


export function CollectPage() {
const { surveyUnitId, questionnaireId } = collectRoute.useParams()
const queryClient = useQueryClient()
Expand Down
12 changes: 11 additions & 1 deletion src/pages/Collect/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,23 @@ import type { SurveyUnitData } from 'model/SurveyUnitData'
import { rootRoute } from 'router/router'
import { ErrorComponent } from 'shared/components/Error/ErrorComponent'
import { protectedRouteLoader } from 'shared/loader/protectedLoader'
import { z } from 'zod'
import { CollectPage } from './CollectPage'

const collectSearchParams = z.object({
pathLogout: z.string(),
pathAssistance: z.string(),
})

export const collectPath =
'/questionnaire/$questionnaireId/unite-enquetee/$surveyUnitId'

export const collectRoute = createRoute({
getParentRoute: () => rootRoute,
path: '/questionnaire/$questionnaireId/unite-enquetee/$surveyUnitId',
path: collectPath,
component: CollectPage,
beforeLoad: protectedRouteLoader,
validateSearch: collectSearchParams,
loader: ({
params: { questionnaireId, surveyUnitId },
context: { queryClient },
Expand Down
4 changes: 3 additions & 1 deletion src/pages/Legals/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import { createRoute } from '@tanstack/react-router'
import { rootRoute } from 'router/router'
import { LegalPage } from './LegalsPage'

export const legalsPath = '/mentions-legales'

export const legalsRoute = createRoute({
getParentRoute: () => rootRoute,
path: 'mentions-legales',
path: legalsPath,
component: LegalPage,
loader: () => {
//TODO get name (Filière d'Enquête) in metadata
Expand Down
4 changes: 3 additions & 1 deletion src/pages/NavigationAssistance/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import { createRoute } from '@tanstack/react-router'
import { rootRoute } from 'router/router'
import { NavigationAssistancePage } from './NavigationAssistancePage'

export const navigationPath = '/aide-a-la-navigation'

export const navigationAssistanceRoute = createRoute({
getParentRoute: () => rootRoute,
path: 'aide-a-la-navigation',
path: navigationPath,
component: NavigationAssistancePage,
loader: () => {
//TODO get name (Filière d'Enquête) in metadata
Expand Down
5 changes: 4 additions & 1 deletion src/pages/Review/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ import { ErrorComponent } from 'shared/components/Error/ErrorComponent'
import { protectedRouteLoader } from 'shared/loader/protectedLoader'
import { ReviewPage } from './ReviewPage'

export const reviewPath =
'/questionnaire/readonly/$questionnaireId/unite-enquetee/$surveyUnitId'

export const reviewRoute = createRoute({
getParentRoute: () => rootRoute,
path: '/questionnaire/readonly/$questionnaireId/unite-enquetee/$surveyUnitId',
path: reviewPath,
component: ReviewPage,
beforeLoad: protectedRouteLoader,
loader: ({
Expand Down
3 changes: 2 additions & 1 deletion src/pages/Security/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import { createRoute } from '@tanstack/react-router'
import { rootRoute } from 'router/router'
import { SecurityPage } from './SecurityPage'

export const securitePath = '/securite'
export const securityRoute = createRoute({
getParentRoute: () => rootRoute,
path: 'securite',
path: securitePath,
component: SecurityPage,
loader: () => {
//TODO get name (Filière d'Enquête) in metadata
Expand Down
3 changes: 2 additions & 1 deletion src/pages/SiteMap/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import { createRoute } from '@tanstack/react-router'
import { rootRoute } from 'router/router'
import { SiteMapPage } from './SiteMapPage'

export const siteMapPath = '/plan-du-site'
export const siteMapRoute = createRoute({
getParentRoute: () => rootRoute,
path: 'plan-du-site',
path: siteMapPath,
component: SiteMapPage,
loader: () => {
//TODO get name (Filière d'Enquête) in metadata
Expand Down
3 changes: 2 additions & 1 deletion src/pages/Visualize/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ const visualizeSearchSchema = z
})
.optional()

export const visualizePath = '/visualize'
export const visualizeRoute = createRoute({
getParentRoute: () => rootRoute,
path: 'visualize',
path: visualizePath,
component: VisualizePage,
validateSearch: visualizeSearchSchema,
loaderDeps: ({ search }) => ({
Expand Down
1 change: 0 additions & 1 deletion src/shared/components/Orchestrator/Orchestrator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ export function Orchestrator(props: OrchestratorProps) {
{ components: [], bottomComponents: [] }
)

console.log({ components, bottomComponents })
return (
<div className={fr.cx('fr-container--fluid')}>
<Provider>
Expand Down

0 comments on commit 755e195

Please sign in to comment.