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): remove country selector from onboarding step 4 (#12996)
Toran Bruce Richardse227a6bd80a9
diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/SubscriptionStep.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/SubscriptionStep.tsxindex 00d574734f..a5bebfe782 100644--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/SubscriptionStep.tsx+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/SubscriptionStep.tsx@@ -4,7 +4,6 @@ import { AutoGPTLogo } from "@/components/atoms/AutoGPTLogo/AutoGPTLogo";import { FadeIn } from "@/components/atoms/FadeIn/FadeIn";import { Text } from "@/components/atoms/Text/Text";import { cn } from "@/lib/utils";-import { CountrySelector } from "./components/CountrySelector/CountrySelector";import { PlanCard } from "./components/PlanCard/PlanCard";import { PLAN_KEYS, PLANS } from "./helpers";import { useSubscriptionStep } from "./useSubscriptionStep";@@ -13,8 +12,6 @@ export function SubscriptionStep() {const {billing,setBilling,- countryIdx,- setCountryIdx,country,isYearly,handlePlanSelect,@@ -92,9 +89,6 @@ export function SubscriptionStep() {/>))}</div>- <div className="mt-4 flex justify-center px-[1rem] md:fixed md:right-6 md:top-[14px] md:z-50 md:mt-0 md:px-0">- <CountrySelector selected={countryIdx} onSelect={setCountryIdx} />- </div></div><Text variant="body" className="!text-zinc-500">diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/components/CountrySelector/CountrySelector.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/components/CountrySelector/CountrySelector.tsxdeleted file mode 100644index fc298f2a92..0000000000--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/components/CountrySelector/CountrySelector.tsx+++ /dev/null@@ -1,125 +0,0 @@-"use client";--import {- Popover,- PopoverContent,- PopoverTrigger,-} from "@/components/molecules/Popover/Popover";-import { useMountEffect } from "@/hooks/useMountEffect";-import { cn } from "@/lib/utils";-import { MagnifyingGlass } from "@phosphor-icons/react";-import { useRef, useState } from "react";-import { COUNTRIES } from "../../countries";--interface Props {- selected: number;- onSelect: (idx: number) => void;-}--export function CountrySelector({ selected, onSelect }: Props) {- const [open, setOpen] = useState(false);- const country = COUNTRIES[selected];-- function handleOpenChange(next: boolean) {- setOpen(next);- }-- return (- <Popover open={open} onOpenChange={handleOpenChange}>- <PopoverTrigger asChild>- <button- type="button"- className="flex min-w-[150px] items-center gap-1.5 px-2.5 py-1.5 text-sm text-zinc-600 transition-colors hover:text-zinc-900"- >- <span className="text-base">{country.flag}</span>- <span>{country.name}</span>- <span>({country.symbol.trim()})</span>- <span className="ml-auto text-[10px] text-zinc-400">▾</span>- </button>- </PopoverTrigger>- <PopoverContent- side="top"- align="end"- sideOffset={8}- collisionPadding={16}- className="flex max-h-[340px] w-[260px] max-w-[calc(100vw-2rem)] flex-col overflow-hidden rounded-xl border-0 bg-zinc-900 p-0 text-white shadow-xl"- >- <CountryList- selected={selected}- onSelect={(idx) => {- onSelect(idx);- handleOpenChange(false);- }}- />- </PopoverContent>- </Popover>- );-}--interface ListProps {- selected: number;- onSelect: (idx: number) => void;-}--function CountryList({ selected, onSelect }: ListProps) {- const [search, setSearch] = useState("");- const inputRef = useRef<HTMLInputElement>(null);-- useMountEffect(() => {- inputRef.current?.focus();- });-- const query = search.toLowerCase();- const filtered = COUNTRIES.map((c, idx) => ({ c, idx })).filter(- ({ c }) =>- c.name.toLowerCase().includes(query) ||- c.countryCode.toLowerCase().includes(query) ||- c.currencyCode.toLowerCase().includes(query),- );-- return (- <>- <div className="px-3 pb-1.5 pt-2.5">- <div className="flex items-center gap-2 rounded-lg border border-white/10 bg-white/5 px-2.5 py-1.5">- <MagnifyingGlass- size={12}- className="shrink-0 text-white/40"- weight="bold"- />- <input- ref={inputRef}- value={search}- onChange={(e) => setSearch(e.target.value)}- placeholder="Search country…"- aria-label="Search country"- className="w-full bg-transparent text-xs text-white outline-none placeholder:text-white/35"- />- </div>- </div>-- <div className="max-h-[270px] overflow-y-auto px-0 py-1">- {filtered.length === 0 && (- <div className="px-3.5 py-3 text-xs text-white/40">- No matching countries- </div>- )}- {filtered.map(({ c, idx }) => (- <button- key={c.countryCode}- type="button"- onClick={() => onSelect(idx)}- className={cn(- "flex w-full items-center justify-between px-3.5 py-2 text-xs text-white transition-colors",- idx === selected ? "bg-purple-500/15" : "hover:bg-white/[0.08]",- )}- >- <span>- {c.flag} {c.name}- </span>- <span className="text-[10px] text-white/35">{c.currencyCode}</span>- </button>- ))}- </div>- </>- );-}diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/useSubscriptionStep.ts b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/useSubscriptionStep.tsindex e98258324f..33f0699936 100644--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/useSubscriptionStep.ts+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/SubscriptionStep/useSubscriptionStep.ts@@ -29,9 +29,6 @@ export function useSubscriptionStep() {const selectedCountryCode = useOnboardingWizardStore((s) => s.selectedCountryCode,);- const setSelectedCountryCode = useOnboardingWizardStore(- (s) => s.setSelectedCountryCode,- );const setSelectedPlan = useOnboardingWizardStore((s) => s.setSelectedPlan);const nextStep = useOnboardingWizardStore((s) => s.nextStep);const selectedPlan = useOnboardingWizardStore((s) => s.selectedPlan);@@ -51,12 +48,6 @@ export function useSubscriptionStep() {const country = COUNTRIES[countryIdx];const isYearly = billing === "yearly";- function setCountryIdx(idx: number) {- const next = COUNTRIES[idx];- if (!next) return;- setSelectedCountryCode(next.countryCode);- }-async function handlePlanSelect(planKey: PlanKey) {if (planKey === PLAN_KEYS.TEAM) {window.open(TEAM_INTAKE_FORM_URL, "_blank", "noopener,noreferrer");@@ -129,8 +120,6 @@ export function useSubscriptionStep() {return {billing,setBilling: setSelectedBilling,- countryIdx,- setCountryIdx,country,isYearly,handlePlanSelect,diff --git a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/SubscriptionStep.test.tsx b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/SubscriptionStep.test.tsxindex d065e00009..3d292aaaf7 100644--- a/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/SubscriptionStep.test.tsx+++ b/autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/SubscriptionStep.test.tsx@@ -145,13 +145,6 @@ describe("SubscriptionStep", () => {}});- test("changing country persists the country code", () => {- render(<SubscriptionStep />);- fireEvent.click(screen.getByRole("button", { name: /United States/i }));- fireEvent.click(screen.getByRole("button", { name: /European Union/i }));- expect(useOnboardingWizardStore.getState().selectedCountryCode).toBe("EU");- });-test("local dev: clicking Pro skips Stripe and advances to the next step", async () => {vi.spyOn(environment, "isLocal").mockReturnValue(true);