Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

fix(frontend): reset tour chat dim when switching scenarios (#13550)

Ubbe8257de896e9f
diff --git a/autogpt_platform/frontend/src/app/(public)/tour/chat/__tests__/main.test.tsx b/autogpt_platform/frontend/src/app/(public)/tour/chat/__tests__/main.test.tsx
index c096f6df17..f6287a33b2 100644
--- a/autogpt_platform/frontend/src/app/(public)/tour/chat/__tests__/main.test.tsx
+++ b/autogpt_platform/frontend/src/app/(public)/tour/chat/__tests__/main.test.tsx
@@ -13,6 +13,7 @@ vi.mock("@/components/ui/dot-distortion-shader", () => ({
DotDistortionShader: () => null,
}));
+import { useCopilotUIStore } from "@/app/(platform)/copilot/store";
import TourChatPage from "../page";
import { DEFAULT_SCENARIO_ID } from "../script/tourScenarios";
import { useTourStore } from "../tourStore";
@@ -59,6 +60,9 @@ describe("Tour chat scripted demo", () => {
activeScenarioId: DEFAULT_SCENARIO_ID,
isDemoComplete: false,
});
+ // The artifact panel lives in the shared copilot UI store (also
+ // module-level) — a completed demo leaves it open across tests.
+ useCopilotUIStore.getState().closeArtifactPanel({ persist: false });
});
afterEach(() => {
@@ -158,6 +162,30 @@ describe("Tour chat scripted demo", () => {
expect(useTourStore.getState().isDemoComplete).toBe(true);
});
+ test("switching scenario after a completed demo un-dims the chat column", async () => {
+ render(<TourChatPage />);
+
+ // Play the default demo through both turns so it completes and opens
+ // the payoff artifact panel — which dims the chat column behind it.
+ await advanceThroughTurn();
+ await pressEnterToSend();
+
+ expect(useTourStore.getState().isDemoComplete).toBe(true);
+ expect(document.querySelector(".transition-opacity.opacity-50")).not.toBe(
+ null,
+ );
+
+ // Picking another chat example from the sidebar must reset the dim —
+ // the artifact panel belongs to the finished demo, not the new one.
+ fireEvent.click(screen.getByRole("button", { name: "Daily brief" }));
+ await act(async () => {
+ await vi.advanceTimersByTimeAsync(0);
+ });
+
+ expect(document.querySelector(".transition-opacity.opacity-50")).toBe(null);
+ expect(useCopilotUIStore.getState().artifactPanel.isOpen).toBe(false);
+ });
+
test("scenario chips switch the demo path", async () => {
render(<TourChatPage />);
diff --git a/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourSidebar/TourSidebar.tsx b/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourSidebar/TourSidebar.tsx
index 87672414ba..dd1104118c 100644
--- a/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourSidebar/TourSidebar.tsx
+++ b/autogpt_platform/frontend/src/app/(public)/tour/chat/components/TourSidebar/TourSidebar.tsx
@@ -70,10 +70,14 @@ function TourSessionsMenu({ variant }: { variant: TourSidebarVariant }) {
const router = useRouter();
const activeScenarioId = useTourStore((s) => s.activeScenarioId);
const setActiveScenario = useTourStore((s) => s.setActiveScenario);
- const clearArtifactPreview = useCopilotUIStore((s) => s.clearArtifactPreview);
+ const closeArtifactPanel = useCopilotUIStore((s) => s.closeArtifactPanel);
function selectScenario(id: string) {
- clearArtifactPreview();
+ // Close (not just clear) the panel: a completed demo leaves
+ // artifactPanel.isOpen=true, which keeps the chat column dimmed at
+ // opacity-50 behind it. persist:false keeps the tour from leaking
+ // panel state into the real /copilot, same as TourCopilot's cleanup.
+ closeArtifactPanel({ persist: false });
setActiveScenario(id);
if (variant === "marketplace") router.push("/tour/chat");
}