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.

feat(frontend): dynamic search terms (#11156)

Ubbe5f2d4643f8ce
diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/HeroSection/HeroSection.tsx b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/HeroSection/HeroSection.tsx
index f5551c8ece..363c106209 100644
--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/HeroSection/HeroSection.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/HeroSection/HeroSection.tsx
@@ -5,7 +5,7 @@ import { SearchBar } from "../SearchBar/SearchBar";
import { useHeroSection } from "./useHeroSection";
export const HeroSection = () => {
- const { onFilterChange } = useHeroSection();
+ const { onFilterChange, searchTerms } = useHeroSection();
return (
<div className="mb-2 mt-8 flex flex-col items-center justify-center px-4 sm:mb-4 sm:mt-12 sm:px-6 md:mb-6 md:mt-16 lg:my-24 lg:px-8 xl:my-16">
<div className="w-full max-w-3xl lg:max-w-4xl xl:max-w-5xl">
@@ -35,13 +35,7 @@ export const HeroSection = () => {
<div>
<div className="flex justify-center">
<FilterChips
- badges={[
- "Marketing",
- "SEO",
- "Content Creation",
- "Automation",
- "Fun",
- ]}
+ badges={searchTerms}
onFilterChange={onFilterChange}
multiSelect={false}
/>
diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/HeroSection/helpers.ts b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/HeroSection/helpers.ts
new file mode 100644
index 0000000000..ac4d17131d
--- /dev/null
+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/HeroSection/helpers.ts
@@ -0,0 +1,7 @@
+export const DEFAULT_SEARCH_TERMS = [
+ "Marketing",
+ "SEO",
+ "Content Creation",
+ "Automation",
+ "Fun",
+];
diff --git a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/HeroSection/useHeroSection.ts b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/HeroSection/useHeroSection.ts
index 03798efd8e..378f8481c5 100644
--- a/autogpt_platform/frontend/src/app/(platform)/marketplace/components/HeroSection/useHeroSection.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/marketplace/components/HeroSection/useHeroSection.ts
@@ -1,10 +1,13 @@
import { useOnboarding } from "@/providers/onboarding/onboarding-provider";
+import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";
import { useRouter } from "next/navigation";
import { useEffect } from "react";
+import { DEFAULT_SEARCH_TERMS } from "./helpers";
export const useHeroSection = () => {
const router = useRouter();
const { completeStep } = useOnboarding();
+ const searchTerms = useGetFlag(Flag.MARKETPLACE_SEARCH_TERMS);
// Mark marketplace visit task as completed
useEffect(() => {
@@ -18,5 +21,6 @@ export const useHeroSection = () => {
return {
onFilterChange,
+ searchTerms: searchTerms || DEFAULT_SEARCH_TERMS,
};
};
diff --git a/autogpt_platform/frontend/src/components/atoms/Avatar/Avatar.tsx b/autogpt_platform/frontend/src/components/atoms/Avatar/Avatar.tsx
index 78318dca8e..56131af7df 100644
--- a/autogpt_platform/frontend/src/components/atoms/Avatar/Avatar.tsx
+++ b/autogpt_platform/frontend/src/components/atoms/Avatar/Avatar.tsx
@@ -156,7 +156,7 @@ export function AvatarImage({
sizes={sizes}
priority={priority}
unoptimized={unoptimized}
- onLoadingComplete={handleLoadingComplete}
+ onLoad={handleLoadingComplete}
onError={handleErrorNext as ImageProps["onError"]}
/>
);
diff --git a/autogpt_platform/frontend/src/services/feature-flags/use-get-flag.ts b/autogpt_platform/frontend/src/services/feature-flags/use-get-flag.ts
index c117c9f7a5..d5a3c0e4f0 100644
--- a/autogpt_platform/frontend/src/services/feature-flags/use-get-flag.ts
+++ b/autogpt_platform/frontend/src/services/feature-flags/use-get-flag.ts
@@ -1,5 +1,6 @@
"use client";
+import { DEFAULT_SEARCH_TERMS } from "@/app/(platform)/marketplace/components/HeroSection/helpers";
import { BehaveAs, getBehaveAs } from "@/lib/utils";
import { useFlags } from "launchdarkly-react-client-sdk";
@@ -13,6 +14,7 @@ export enum Flag {
BUILDER_VIEW_SWITCH = "builder-view-switch",
SHARE_EXECUTION_RESULTS = "share-execution-results",
AGENT_FAVORITING = "agent-favoriting",
+ MARKETPLACE_SEARCH_TERMS = "marketplace-search-terms",
}
export type FlagValues = {
@@ -25,6 +27,7 @@ export type FlagValues = {
[Flag.BUILDER_VIEW_SWITCH]: boolean;
[Flag.SHARE_EXECUTION_RESULTS]: boolean;
[Flag.AGENT_FAVORITING]: boolean;
+ [Flag.MARKETPLACE_SEARCH_TERMS]: string[];
};
const isPwMockEnabled = process.env.NEXT_PUBLIC_PW_TEST === "true";
@@ -39,6 +42,7 @@ const mockFlags = {
[Flag.BUILDER_VIEW_SWITCH]: false,
[Flag.SHARE_EXECUTION_RESULTS]: false,
[Flag.AGENT_FAVORITING]: false,
+ [Flag.MARKETPLACE_SEARCH_TERMS]: DEFAULT_SEARCH_TERMS,
};
export function useGetFlag<T extends Flag>(flag: T): FlagValues[T] | null {