feat(builder): not tested step logging

This commit is contained in:
Nicholas Tindle
2024-09-10 12:31:14 -05:00
parent 7154f80927
commit e27f5bb2e5
2 changed files with 24 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
"use server";
import { TutorialStepData } from "@/lib/autogpt-server-api/types";
import AutoGPTServerAPI from "@/lib/autogpt-server-api/client";
export const sendTutorialStep = async (data: TutorialStepData) => {
console.log("sendTutorialStep", data);
const api = new AutoGPTServerAPI();
await api.logTutorialStep(data);
};

View File

@@ -1,5 +1,6 @@
import Shepherd from "shepherd.js";
import "shepherd.js/dist/css/shepherd.css";
import { sendTutorialStep } from "./build/actions";
export const startTutorial = (
setPinBlocksPopover: (value: boolean) => void,
@@ -493,6 +494,18 @@ export const startTutorial = (
localStorage.setItem("shepherd-tour", "completed"); // Optionally mark the tutorial as completed
});
for (let index = 0; index < tour.steps.length; index++) {
const step = tour.steps[index];
step.on("complete", () => {
console.log("sendTutorialStep");
sendTutorialStep({
step: index,
data: {},
});
});
}
tour.on("cancel", () => {
setPinBlocksPopover(false);
localStorage.setItem("shepherd-tour", "canceled"); // Optionally mark the tutorial as canceled