Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 5 additions & 16 deletions apps/web/src/components/configurator/IdleCourseSetup.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { fireEvent, render, screen, within } from "@testing-library/react";
import { MemoryRouter } from "react-router";
import { afterEach, describe, expect, it, vi } from "vitest";

import { makeBriefResponse, makeRun } from "../../test/fixtures";
Expand Down Expand Up @@ -44,16 +43,7 @@ function renderSetup(overrides: Partial<React.ComponentProps<typeof IdleCourseSe
onOpenSettings: vi.fn(),
...overrides,
};
// RecentBuildsTable links to a course, which is real navigation and correctly a <Link>, so the
// harness supplies router context rather than the component avoiding it.
return {
props,
...render(
<MemoryRouter>
<IdleCourseSetup {...props} />
</MemoryRouter>,
),
};
return { props, ...render(<IdleCourseSetup {...props} />) };
}

afterEach(() => vi.unstubAllGlobals());
Expand Down Expand Up @@ -149,15 +139,15 @@ describe("IdleCourseSetup", () => {
).toBeInTheDocument();
});

it("drops the explainer once there are builds, and shows them instead", () => {
// Someone with completed courses does not need to be told what a build does; that space is
// better spent on the thing they came back for.
it("drops the explainer once there are builds", () => {
// Someone with completed courses does not need to be told what a build does. The composer is
// then just the composer: nothing below it, so it can sit centred on the page.
renderSetup({ runsLoaded: true, runs: [makeRun()] });

expect(
screen.queryByRole("list", { name: /what a lunaris studio build does/i }),
).not.toBeInTheDocument();
expect(screen.getByRole("heading", { name: /recent builds/i })).toBeInTheDocument();
expect(screen.getByLabelText("Topic")).toBeInTheDocument();
});

it("shows neither while the build history is still loading", () => {
Expand All @@ -168,7 +158,6 @@ describe("IdleCourseSetup", () => {
expect(
screen.queryByRole("list", { name: /what a lunaris studio build does/i }),
).not.toBeInTheDocument();
expect(screen.queryByRole("heading", { name: /recent builds/i })).not.toBeInTheDocument();
});

it("does not offer to personalize before there is a topic to read", () => {
Expand Down
5 changes: 2 additions & 3 deletions apps/web/src/components/configurator/IdleCourseSetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { LiveToggle } from "../gateway/LiveToggle";
import { PersonalizeMenu } from "./PersonalizeMenu";
import { ComposerFeatures } from "./ComposerFeatures";
import { ComposerOptions } from "./ComposerOptions";
import { RecentBuildsTable } from "./RecentBuildsTable";
import styles from "./IdleCourseSetup.module.css";

interface IdleCourseSetupProps {
Expand All @@ -27,7 +26,8 @@ interface IdleCourseSetupProps {
onStartLive?: ((topic: string) => void) | undefined;
/** Open the operator/admin Settings panel (the rail only points there). */
onOpenSettings: () => void;
/** The run history (from the shell's useRuns), which drives the recent-builds table. */
/** The run history (from the shell's useRuns). Read only to tell a first-time visitor from a
* returning one; the composer no longer lists builds. */
runs?: CourseRun[];
/** Whether that history has actually loaded. The parent collapses an unloaded history to an empty
* array, so without this the first-run explainer would flash up and vanish for every returning
Expand Down Expand Up @@ -169,7 +169,6 @@ export function IdleCourseSetup({
{/* What a build does is first-run material: someone with completed courses does not need to
be told, and the space is better spent on what they came back for. */}
{runsLoaded && runs.length === 0 && <ComposerFeatures mode={mode} />}
<RecentBuildsTable runs={runs} />
</div>
);
}
79 changes: 0 additions & 79 deletions apps/web/src/components/configurator/RecentBuildsTable.module.css

This file was deleted.

53 changes: 0 additions & 53 deletions apps/web/src/components/configurator/RecentBuildsTable.test.tsx

This file was deleted.

75 changes: 0 additions & 75 deletions apps/web/src/components/configurator/RecentBuildsTable.tsx

This file was deleted.

Loading