Skip to content

Commit

Permalink
feat: Allow users to complete S&R on offline flows
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed May 30, 2024
1 parent ff0119b commit f31edd1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
7 changes: 6 additions & 1 deletion editor.planx.uk/src/pages/OfflinePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import React from "react";
export const OfflinePage: React.FC = () => (
<StatusPage bannerHeading="Offline">
<Typography variant="body2">
This service is not currently available. Please check back later.
This service is not currently available to new applicants. Please check
back later.
</Typography>
<Typography variant="body2">
If you're resuming an application you previously started, please use the
link sent to you via email.
</Typography>
</StatusPage>
);
12 changes: 8 additions & 4 deletions editor.planx.uk/src/routes/published.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,21 @@ const routes = compose(
}),

mount({
"/": route({
"/": route((req) => ({
view: () => {
const isOnline = useStore.getState().flowStatus === "online";
const isFlowOnline = useStore.getState().flowStatus === "online";
const isUserResuming = Boolean(req.params.sessionId);

return isOnline ? (
// Allow users to complete Save & Return journeys, even if a flow is offline
const isFlowAccessible = isFlowOnline || isUserResuming;

return isFlowAccessible ? (
<Questions previewEnvironment="standalone" />
) : (
<OfflinePage />
);
},
}),
})),
"/pages/:page": map((req) => {
return route({
view: () => <ContentPage page={req.params.page} />,
Expand Down

0 comments on commit f31edd1

Please sign in to comment.