mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-01-09 23:28:07 -05:00
This PR adds backend to make Onboarding UI added in https://github.com/Significant-Gravitas/AutoGPT/pull/9485 functional and adds missing confetti screen at the end of Onboarding. *Make sure to have at least any 2 agents in store when testing locally.* Otherwise the onboarding will finish without showing agents. Visit `/onboarding/reset` to reset onboarding state, otherwise it'll always redirect to `/library` once finished. ### Changes 🏗️ - Onboarding opens automatically on sign up and login (if unfinished) for all users - Update db schema to add `UserOnboarding` and add migration - Add GET and PATCH `/onboarding` endpoints and logic to retrieve and update data Onboarding for a user - Update `POST /library/agents` endpoint (`addMarketplaceAgentToLibrary`), so it includes input and output nodes; these are needed to know input schema for the Onboarding - Use new endpoints during onboarding to fetch and update data - Use agents from the marketplace and their input schema for the onboarding - Add algorithm to choose store agents based on user answers and related endpoint `GET /onboarding/agents` - Redirect outside onboarding if finished and resume on proper page - Add `canvas-confetti` and `@types/canvas-confetti` frontend packages - Add and show congrats confetti screen when user runs and agent and before opening library - Minor design updates and onboarding fixes ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: - [x] Redirect to `/onboarding/*` on sign up and sign in (if onboarding unfinished) - [x] Onboarding works and can be finished - [x] Agent runs on finish - [x] Onboarding state is saved and logging out or refreshing page restores correct state (user choices) - [x] When onboarding finished, trying to go into `/onboarding` redirects to `/library` --------- Co-authored-by: Nicholas Tindle <nicholas.tindle@agpt.co> Co-authored-by: Reinier van der Leer <pwuts@agpt.co>
67 lines
1.9 KiB
TypeScript
67 lines
1.9 KiB
TypeScript
"use client";
|
|
import { ReactNode } from "react";
|
|
import OnboardingBackButton from "./OnboardingBackButton";
|
|
import { cn } from "@/lib/utils";
|
|
import OnboardingProgress from "./OnboardingProgress";
|
|
import { useOnboarding } from "@/app/onboarding/layout";
|
|
|
|
export function OnboardingStep({
|
|
dotted,
|
|
children,
|
|
}: {
|
|
dotted?: boolean;
|
|
children: ReactNode;
|
|
}) {
|
|
return (
|
|
<div className="relative flex min-h-screen w-full flex-col">
|
|
{dotted && (
|
|
<div className="absolute left-1/2 h-full w-1/2 bg-white bg-[radial-gradient(#e5e7eb77_1px,transparent_1px)] [background-size:10px_10px]"></div>
|
|
)}
|
|
<div className="z-10 flex flex-col items-center">{children}</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
interface OnboardingHeaderProps {
|
|
backHref: string;
|
|
transparent?: boolean;
|
|
children?: ReactNode;
|
|
}
|
|
|
|
export function OnboardingHeader({
|
|
backHref,
|
|
transparent,
|
|
children,
|
|
}: OnboardingHeaderProps) {
|
|
const { state } = useOnboarding();
|
|
|
|
return (
|
|
<div className="sticky top-0 z-10 w-full">
|
|
<div
|
|
className={cn(transparent ? "bg-transparent" : "bg-gray-100", "pb-5")}
|
|
>
|
|
<div className="flex w-full items-center justify-between px-5 py-4">
|
|
<OnboardingBackButton href={backHref} />
|
|
<OnboardingProgress totalSteps={5} toStep={(state?.step || 1) - 1} />
|
|
</div>
|
|
{children}
|
|
</div>
|
|
|
|
{!transparent && (
|
|
<div className="h-4 w-full bg-gradient-to-b from-gray-100 via-gray-100/50 to-transparent" />
|
|
)}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export function OnboardingFooter({ children }: { children?: ReactNode }) {
|
|
return (
|
|
<div className="sticky bottom-0 z-10 w-full">
|
|
<div className="h-4 w-full bg-gradient-to-t from-gray-100 via-gray-100/50 to-transparent" />
|
|
<div className="flex justify-center bg-gray-100">
|
|
<div className="px-5 py-5">{children}</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|