diff --git a/autogpt_platform/frontend/src/app/(platform)/library/components/FavoritesSection/FavoritesSection.tsx b/autogpt_platform/frontend/src/app/(platform)/library/components/FavoritesSection/FavoritesSection.tsx index 922352292d..d1167cc747 100644 --- a/autogpt_platform/frontend/src/app/(platform)/library/components/FavoritesSection/FavoritesSection.tsx +++ b/autogpt_platform/frontend/src/app/(platform)/library/components/FavoritesSection/FavoritesSection.tsx @@ -1,15 +1,17 @@ "use client"; import { LibraryAgent } from "@/app/api/__generated__/models/libraryAgent"; -import { Skeleton } from "@/components/__legacy__/ui/skeleton"; +import { Text } from "@/components/atoms/Text/Text"; import { InfiniteScroll } from "@/components/contextual/InfiniteScroll/InfiniteScroll"; -import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag"; import { HeartIcon } from "@phosphor-icons/react"; import { useFavoriteAgents } from "../../hooks/useFavoriteAgents"; import { LibraryAgentCard } from "../LibraryAgentCard/LibraryAgentCard"; -export function FavoritesSection() { - const isAgentFavoritingEnabled = useGetFlag(Flag.AGENT_FAVORITING); +interface Props { + searchTerm: string; +} + +export function FavoritesSection({ searchTerm }: Props) { const { allAgents: favoriteAgents, agentLoading: isLoading, @@ -17,60 +19,50 @@ export function FavoritesSection() { hasNextPage, fetchNextPage, isFetchingNextPage, - } = useFavoriteAgents(); + } = useFavoriteAgents({ searchTerm }); - // Only show this section if the feature flag is enabled - if (!isAgentFavoritingEnabled) { - return null; - } - - // Don't show the section if there are no favorites - if (!isLoading && favoriteAgents.length === 0) { + if (isLoading || favoriteAgents.length === 0) { return null; } return ( -
-
- - - Favorites - - {!isLoading && ( - - {agentCount} {agentCount === 1 ? "agent" : "agents"} - - )} +
+
+ +
+ Favorites + {!isLoading && ( + + {agentCount} + + )} +
- {isLoading ? ( + +
+
+ } + >
- {[...Array(4)].map((_, i) => ( - + {favoriteAgents.map((agent: LibraryAgent) => ( + ))}
- ) : ( - -
-
- } - > -
- {favoriteAgents.map((agent: LibraryAgent) => ( - - ))} -
-
- )} +
- {favoriteAgents.length > 0 &&
} + {favoriteAgents.length > 0 &&
}
); } diff --git a/autogpt_platform/frontend/src/app/(platform)/library/components/LibraryAgentCard/LibraryAgentCard.tsx b/autogpt_platform/frontend/src/app/(platform)/library/components/LibraryAgentCard/LibraryAgentCard.tsx index 739eec9881..1327de5347 100644 --- a/autogpt_platform/frontend/src/app/(platform)/library/components/LibraryAgentCard/LibraryAgentCard.tsx +++ b/autogpt_platform/frontend/src/app/(platform)/library/components/LibraryAgentCard/LibraryAgentCard.tsx @@ -24,7 +24,6 @@ export function LibraryAgentCard({ agent }: Props) { const { isFromMarketplace, - isAgentFavoritingEnabled, isFavorite, profile, creator_image_url, @@ -37,9 +36,8 @@ export function LibraryAgentCard({ agent }: Props) { data-agent-id={id} className="group relative inline-flex h-[10.625rem] w-full max-w-[25rem] flex-col items-start justify-start gap-2.5 rounded-medium border border-zinc-100 bg-white transition-all duration-300 hover:shadow-md" > - - -
+ +
- {isAgentFavoritingEnabled && ( - - )}
+ +
void; + onClick: (e: MouseEvent) => void; + className?: string; } -export function FavoriteButton({ isFavorite, onClick }: FavoriteButtonProps) { +export function FavoriteButton({ + isFavorite, + onClick, + className, +}: FavoriteButtonProps) { return (