mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
fix(onboarding): no dead settings links before completion
Both Settings links on the confirm screen are page routes, and the onboarding cookie that sends every page route back into the flow is cleared by the completion this very screen calls. On a first run they could not go anywhere. They now render as plain text until the flow has been completed once. The words stay, because where a setting lives is true either way.
This commit is contained in:
1 parent
e9e4a4b44d
commit
a6dedffdb8
2 files changed
+59
-12
No files matched your search
@@ -1,6 +1,12 @@
|
||||
/**
|
||||
* v1.39 (Wave C) — what the confirm screen is allowed to claim.
|
||||
*
|
||||
* C5 (research M-l): both of the screen's own Settings links are page routes,
|
||||
* and `hl_onboarding=pending` is still set while this screen is on — the
|
||||
* completion is what clears it, and this screen is what calls the completion.
|
||||
* The proxy sends both straight back to the flow, so on a first run they are
|
||||
* dead links under a sentence that is not yet true.
|
||||
*
|
||||
* C4 (research I6): the screen listed what the answers switch ON and said
|
||||
* everything else "stays one click away under Settings, Modules" — true of
|
||||
* reachability, false of the navigation entry. A module the answers do not
|
||||
@@ -84,3 +90,20 @@ describe("<ConfirmScreen> — modules leaving the navigation (C4)", () => {
|
||||
expect(html).not.toContain('data-slot="onboarding-confirm-modules-off"');
|
||||
});
|
||||
});
|
||||
|
||||
describe("<ConfirmScreen> — Settings links on a first run (C5)", () => {
|
||||
it("renders both as plain text while the completion has not run", () => {
|
||||
const html = render(state());
|
||||
expect(html).not.toContain('href="/settings/modules"');
|
||||
expect(html).not.toContain('href="/settings/account"');
|
||||
// The words stay: they say where the thing lives, which is true.
|
||||
expect(html).toContain("Settings, Modules");
|
||||
expect(html).toContain("Settings, Account");
|
||||
});
|
||||
|
||||
it("renders them as links once the flow has been completed once", () => {
|
||||
const html = render(state({ completedAt: "2026-09-10T08:00:00.000Z" }), {});
|
||||
expect(html).toContain('href="/settings/modules"');
|
||||
expect(html).toContain('href="/settings/account"');
|
||||
});
|
||||
});
|
||||
@@ -27,6 +27,7 @@ import {
|
||||
|
||||
/** A step the confirm screen may pass on the ledger without an answer. */
|
||||
type PassableStepId = (typeof ONBOARDING_SKIPPABLE_STEP_IDS)[number];
|
||||
import { isOnboardingSettled } from "@/lib/onboarding/needs";
|
||||
import {
|
||||
firstResultApplies,
|
||||
nextScreen,
|
||||
@@ -111,6 +112,17 @@ export function ConfirmScreen({ state }: { state: OnboardingStateDto }) {
|
||||
const ledger = useRef(state);
|
||||
|
||||
const needs = state.needs;
|
||||
/**
|
||||
* v1.39 (Wave C, C5) — is `hl_onboarding=pending` still set? (research M-l)
|
||||
*
|
||||
* Both of this screen's Settings links are page routes, and the cookie is
|
||||
* cleared by the completion — which is what THIS screen calls. So on a
|
||||
* first run the proxy 307s both straight back into the flow: two links
|
||||
* that cannot go anywhere, under a sentence saying where things live. The
|
||||
* words are true, the links are not, so only the links go.
|
||||
*/
|
||||
const settingsReachable =
|
||||
isOnboardingSettled(state) || state.completedAt !== null;
|
||||
const forSomeoneElse = needs.recordTarget === "someone-else";
|
||||
// v1.39 (Wave C, C4) — `user.modules` is the map the navigation reads, so
|
||||
// the screen can only name a module the person actually has today.
|
||||
@@ -201,12 +213,18 @@ export function ConfirmScreen({ state }: { state: OnboardingStateDto }) {
|
||||
</p>
|
||||
<p className="text-sm">
|
||||
{t("onboarding.flow.confirm.everythingElse")}{" "}
|
||||
<Link
|
||||
href="/settings/modules"
|
||||
className="text-primary underline underline-offset-4"
|
||||
>
|
||||
{t("onboarding.flow.confirm.modulesLink")}
|
||||
</Link>
|
||||
{settingsReachable ? (
|
||||
<Link
|
||||
href="/settings/modules"
|
||||
className="text-primary underline underline-offset-4"
|
||||
>
|
||||
{t("onboarding.flow.confirm.modulesLink")}
|
||||
</Link>
|
||||
) : (
|
||||
<span className="font-medium">
|
||||
{t("onboarding.flow.confirm.modulesLink")}
|
||||
</span>
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -241,12 +259,18 @@ export function ConfirmScreen({ state }: { state: OnboardingStateDto }) {
|
||||
) : null}
|
||||
</dl>
|
||||
<p className="text-sm">
|
||||
<Link
|
||||
href="/settings/account"
|
||||
className="text-primary underline underline-offset-4"
|
||||
>
|
||||
{t("onboarding.flow.confirm.changeInSettings")}
|
||||
</Link>
|
||||
{settingsReachable ? (
|
||||
<Link
|
||||
href="/settings/account"
|
||||
className="text-primary underline underline-offset-4"
|
||||
>
|
||||
{t("onboarding.flow.confirm.changeInSettings")}
|
||||
</Link>
|
||||
) : (
|
||||
<span className="text-muted-foreground">
|
||||
{t("onboarding.flow.confirm.changeInSettings")}
|
||||
</span>
|
||||
)}
|
||||
</p>
|
||||
|
||||
{forSomeoneElse ? (
|
||||
|
||||
Reference in new issue
Block a user