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.

853 B
Raw Blame
"use client";

import { useCopilotUIStore } from "@/app/(platform)/copilot/store";
import { useTourStore } from "./tourStore";

/** Switching scenarios always closes the previous run's artifact panel —
 * shared by the end card and the nudge chip. */
export function useTourScenarioSelection() {
  const setActiveScenario = useTourStore((s) => s.setActiveScenario);
  const closeArtifactPanel = useCopilotUIStore((s) => s.closeArtifactPanel);

  return function selectScenario(id: string) {
    // 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);
  };
}