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): allow skipping expert job titles (#14709)
Ubbe56942a1fb48a
diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/__tests__/main.test.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/__tests__/main.test.tsxindex a5d498c4cd..a3ad7b5f7e 100644--- a/autogpt_platform/frontend/src/app/(platform)/raise/__tests__/main.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/raise/__tests__/main.test.tsx@@ -216,6 +216,25 @@ test("skips remaining kit steps, posts null budget and empty attachments, and op);});+test("posts null when the job title was skipped", async () => {+ let captured: unknown = null;+ server.use(+ getCreateRaisedExpertMockHandler(async (info) => {+ captured = await info.request.json();+ return raiseResult();+ }),+ );++ seedAtSkills();+ saveDraft({ ...loadDraft(), jobTitle: "" });+ renderRaise();+ await userEvent.click(+ await screen.findByRole("button", { name: /Bring Otto to life/ }),+ );++ await waitFor(() => expect(captured).toMatchObject({ job_title: null }));+});+test("posts a chosen weekly budget", async () => {let captured: unknown = null;server.use(@@ -411,6 +430,29 @@ test("typing a job title trims it and asks for a name", async () => {});});+test("skipping a job title records it and asks for a name", async () => {+ saveDraft({+ ...EMPTY_DRAFT,+ hasStarted: true,+ role: "marketer",+ step: "jobTitle",+ });+ renderRaise();+ await userEvent.click(+ await screen.findByRole("button", { name: "Skip" }, { timeout: 5000 }),+ );++ expect(await screen.findByText("Skipped")).toBeDefined();+ expect(+ await screen.findByRole(+ "group",+ { name: "Suggested names" },+ { timeout: 5000 },+ ),+ ).toBeDefined();+ expect(loadDraft()).toMatchObject({ jobTitle: "", step: "name" });+});+test("picking a weekly budget advances to marketplace workflows", async () => {seedAtBudget();renderRaise();diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/JobTitleStep/JobTitleStep.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/JobTitleStep/JobTitleStep.tsxindex d79915d60a..da33afd971 100644--- a/autogpt_platform/frontend/src/app/(platform)/raise/components/JobTitleStep/JobTitleStep.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/JobTitleStep/JobTitleStep.tsx@@ -1,8 +1,10 @@"use client";import { Button } from "@/components/atoms/Button/Button";+import { Icon } from "@/components/atoms/Icon/Icon";import { Input } from "@/components/atoms/Input/Input";import { cn } from "@/lib/utils";+import { Forward02Icon } from "@hugeicons/core-free-icons";import { bubbleClassFor } from "../ColorStep/helpers";import { JOB_TITLE_MAX_LENGTH, useJobTitleStep } from "./useJobTitleStep";@@ -11,6 +13,7 @@ interface Props {suggestions: string[];color: string | null;onSubmit: (jobTitle: string) => void;+ onSkip: () => void;}export function JobTitleStep({@@ -18,10 +21,27 @@ export function JobTitleStep({suggestions,color,onSubmit,+ onSkip,}: Props) {const { custom, setCustom, trimmed, submitCustom } = useJobTitleStep({onSubmit,});++ if (selectedTitle === "") {+ return (+ <div+ className={cn(+ "ml-auto rounded-2xl border px-4 py-3 text-[15px] leading-relaxed text-foreground",+ "flex w-fit items-center gap-2",+ bubbleClassFor(color) ?? "border-accent bg-accent/5",+ )}+ >+ <Icon icon={Forward02Icon} size={16} aria-hidden />+ Skipped+ </div>+ );+ }+const chips = selectedTitle ? [selectedTitle] : suggestions;return (@@ -60,7 +80,10 @@ export function JobTitleStep({</span>)}{selectedTitle ? null : (- <form onSubmit={submitCustom} className="flex items-center gap-2">+ <form+ onSubmit={submitCustom}+ className="flex flex-wrap items-center justify-end gap-2"+ ><Inputid="raise-job-title"label="Job title"@@ -81,6 +104,15 @@ export function JobTitleStep({>Add title</Button>+ <Button+ type="button"+ variant="ghost"+ size="small"+ onClick={onSkip}+ className="h-[2.625rem] rounded-xl py-3"+ >+ Skip+ </Button></form>)}</div>diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/components/RaiseFlow/components/BeatControl.tsx b/autogpt_platform/frontend/src/app/(platform)/raise/components/RaiseFlow/components/BeatControl.tsxindex 6283cbf83e..aeb0eb9870 100644--- a/autogpt_platform/frontend/src/app/(platform)/raise/components/RaiseFlow/components/BeatControl.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/raise/components/RaiseFlow/components/BeatControl.tsx@@ -44,6 +44,7 @@ export function BeatControl({ beat, flow }: Props) {suggestions={jobTitleSuggestionsFor(flow.role)}color={flow.color}onSubmit={flow.submitJobTitle}+ onSkip={flow.skipJobTitle}/>);case "name":diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/useRaisePage.ts b/autogpt_platform/frontend/src/app/(platform)/raise/useRaisePage.tsindex 885f6bb35e..01dca755a0 100644--- a/autogpt_platform/frontend/src/app/(platform)/raise/useRaisePage.ts+++ b/autogpt_platform/frontend/src/app/(platform)/raise/useRaisePage.ts@@ -69,6 +69,10 @@ export function useRaisePage() {update({ jobTitle: trimmed, step: "name" });}+ function skipJobTitle() {+ update({ jobTitle: "", step: "name" });+ }+function submitName(value: string) {const trimmed = value.trim();if (!trimmed) return;@@ -183,6 +187,7 @@ export function useRaisePage() {revealStep: (beat: BeatKey) => progress.revealStep(beat),pickRole,submitJobTitle,+ skipJobTitle,submitName,pickAvatar,submitAbout,diff --git a/autogpt_platform/frontend/src/app/(platform)/raise/useRaiseSubmission.ts b/autogpt_platform/frontend/src/app/(platform)/raise/useRaiseSubmission.tsindex 91450f0338..f728894e82 100644--- a/autogpt_platform/frontend/src/app/(platform)/raise/useRaiseSubmission.ts+++ b/autogpt_platform/frontend/src/app/(platform)/raise/useRaiseSubmission.ts@@ -34,7 +34,7 @@ export function useRaiseSubmission() {data: {name: draft.name,role: draft.role,- job_title: draft.jobTitle,+ job_title: draft.jobTitle || null,color: draft.color,avatar_url: draft.avatarUrl || null,about: draft.about || null,