Module

FPO.Data.Route

This module defines the routing for the application.

#GroupSubRoute

data GroupSubRoute

Sub-routes for group management under /administration/groups/:groupID

Constructors

Instances

#EditorParams

type EditorParams = { paragraph :: Maybe Int, revision :: Maybe Int, splitview :: Maybe String }

Query parameters for the editor route, controlling which paragraph, revision, and view mode are active.

#defaultEditorParams

defaultEditorParams :: EditorParams

Default (empty) editor params — no paragraph selected, no revision pinned, no split view.

#LoginParams

type LoginParams = { redirect :: Maybe String }

Query parameters for the login route, optionally carrying a redirect URI so that the user is returned to the page they were on before being logged out.

#groupSubRouteCodec

groupSubRouteCodec :: RouteDuplex' GroupSubRoute

Codec for group sub-routes

#routeCodec

routeCodec :: RouteDuplex' Route

The codec for the routes. It defines how to parse and serialize the routes.

The Editor route uses a path segment for the document ID and query parameters for revision, paragraph, and splitview: /documents/:id?revision=...&paragraph=...&splitview=...

The Login route uses an optional redirect query parameter that stores the URI the user should be sent to after a successful login: /login?redirect=...

#routeToString

routeToString :: Route -> String

Converts a route to a string representation (for debugging / Show).

#showEditorParams

#showSubRoute

#urlToRoute

#parseRoute

parseRoute :: String -> Route

Parse a URL to a Route, falling back to Page404 for unknown paths. Unlike urlToRoute, this always returns a Route and never fails.

#currentPath

currentPath :: Effect String

Read the current browser path (pathname + search) as an Effect String. This is the path-based equivalent of the old Routing.Hash.getHash.

#routeToUri

routeToUri :: Route -> String

Print a route as a URI string (the path portion of the URL). Useful for encoding routes as redirect parameters, etc.

#isAdminRoute

isAdminRoute :: Route -> Boolean

Helper: is this an administration sub-route?

#isUnauthorizedRoute

#isLoginRoute

isLoginRoute :: Route -> Boolean

Helper: is this a Login route (regardless of params)?

#editorRoute

editorRoute :: DocumentID -> Route

Convenience constructor for the Editor route with default (empty) params.

#loginRoute

loginRoute :: Route

Convenience constructor for the Login route without a redirect.

#loginRouteWithRedirect

loginRouteWithRedirect :: Route -> Route

Convenience constructor for the Login route with a redirect to the given route.

Modules