import { defineModuleGetter , defineRouterData , defineViewToPath } from "common/utils" ; import { defRouteData as appDefRouteData } from "modules/app/facade" ; import { defRouteData as commentsDefRouteData } from "modules/comments/facade" ; import { defRouteData as messagesDefRouteData } from "modules/messages/facade" ; import { defRouteData as photosDefRouteData } from "modules/photos/facade" ; import { defRouteData as videosDefRouteData } from "modules/videos/facade" ; import { RootState as BaseState , RouterState } from "react-coat" ; export const moduleGetter = defineModuleGetter ( { app : ( ) => { return import ( "modules/app" ) ; } , photos : ( ) => { return import ( "modules/photos" ) ; } , videos : ( ) => { return import ( "modules/videos" ) ; } , messages : ( ) => { return import ( "modules/messages" ) ; } , comments : ( ) => { return import ( "modules/comments" ) ; } , } ) ; export type ModuleGetter = typeof moduleGetter ; export const routerData = defineRouterData ( { app : appDefRouteData , photos : photosDefRouteData , videos : videosDefRouteData , messages : messagesDefRouteData , comments : commentsDefRouteData , } ) ; export type RootRouter = RouterState & typeof routerData & { views : RootState [ "views" ] ; } ; export type RootState = BaseState < ModuleGetter , RootRouter > ; export const viewToPath = defineViewToPath ( { app : { Main : "/" } , photos : { Main : "/photos" , Details : "/photos/:itemId" , List : null } , videos : { Main : "/videos" , Details : "/videos/:itemId" , List : null } , messages : { Main : "/messages" , List : null } , comments : { Main : "/:type/:typeId/comments" , Details : "/:type/:typeId/comments/:itemId" , List : null } , } ) ;