Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update(frontend) Featured agents cards #9482

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

Bentlybro
Copy link
Member

Changes 🏗️

right now the featured agents cards dont have a set width/height, so they change depending on the content, and the description is duplicated. also, the "by {creator username}" was removed. currently it looks like this:

chrome_SBwRrkEN28

with my changes, i set a fixed width and height so they dont change, the description now only shows on hover and is truncated to 11 lines, and i added back the "by {creator username}"

chrome_qujRVF4LsX

@Bentlybro Bentlybro requested a review from a team as a code owner February 14, 2025 15:59
@Bentlybro Bentlybro requested review from kcze and majdyz and removed request for a team February 14, 2025 15:59
@github-actions github-actions bot added platform/frontend AutoGPT Platform - Front end platform/backend AutoGPT Platform - Back end labels Feb 14, 2025
Copy link

deepsource-io bot commented Feb 14, 2025

Here's the code health analysis summary for commits e550846..9cb96ce. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource JavaScript LogoJavaScript✅ SuccessView Check ↗
DeepSource Python LogoPython✅ SuccessView Check ↗

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

Copy link

netlify bot commented Feb 14, 2025

Deploy Preview for auto-gpt-docs-dev canceled.

Name Link
🔨 Latest commit 9cb96ce
🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs-dev/deploys/67b05c0e5711ef00082cd8d5

Copy link

netlify bot commented Feb 14, 2025

Deploy Preview for auto-gpt-docs canceled.

Name Link
🔨 Latest commit 9cb96ce
🔍 Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/67b05c0e241398000841c2fe

@Bentlybro Bentlybro removed the platform/backend AutoGPT Platform - Back end label Feb 14, 2025
@Bentlybro Bentlybro changed the title Update(Frontend) Featured agents cards update(frontend) Featured agents cards Feb 14, 2025
@Bentlybro Bentlybro enabled auto-merge February 14, 2025 16:20
@github-actions github-actions bot added the platform/backend AutoGPT Platform - Back end label Feb 15, 2025
Copy link
Contributor

@andrewhooker2 andrewhooker2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job on this component I like where this is headed.

I have a few suggestions to help make this more maintainable and mobile-friendly:

  1. I notice you're adding quite a few styles to control the card heights and layout. Instead of managing this at the card level, we should try to handle consistency through the carousel layout. This will make our components more reusable.

  2. Some helpful things to consider:

    • The FeaturedAgentCard should be as clean as possible, with minimal style overrides
    • Let try using aspect ratios instead of fixed heights for responsive images

Feel free to reach out to me if you would like to sync up at all.
I'd be happy to show you how we can achieve the same layout consistency while keeping our base components clean and reusable.

<CardHeader>
<CardTitle>{agent.agent_name}</CardTitle>
<CardDescription>{agent.description}</CardDescription>
<CardHeader className="flex-none space-y-3 pb-2">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep the base CardHeader clean it already has good default spacing.

Adding flex-none and custom spacing here makes the component less reusable. If we need consistent heights, we can handle that at the carousel layout level.

<CardContent>
<div className="relative h-[397px] w-full overflow-hidden rounded-xl">
<CardContent className="relative flex-1 p-4">
<div className="absolute inset-0 m-4 overflow-hidden rounded-xl">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets consider using aspect ratios instead of absolute positioning its easier to predict how it will change with a responsive design.

I'd suggest trying something more towards:

Suggested change
<div className="absolute inset-0 m-4 overflow-hidden rounded-xl">
<div className="relative aspect-[16/9] sm:aspect-[4/3] overflow-hidden rounded-xl">

@@ -27,16 +27,20 @@ export const FeaturedAgentCard: React.FC<FeaturedStoreCardProps> = ({
data-testid="featured-store-card"
onMouseEnter={() => setIsHovered(true)}
onMouseLeave={() => setIsHovered(false)}
className={backgroundColor}
className={`flex h-[482px] w-[440px] flex-col ${backgroundColor}`}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should avoid hardcoding dimensions on the Card component.

The card should flow naturally based on its content, with layout constraints handled by its parent container (the CarouselItem from the FeatureAgentSection in this case).

<CardTitle>{agent.agent_name}</CardTitle>
<CardDescription>{agent.description}</CardDescription>
<CardHeader className="flex-none space-y-3 pb-2">
<CardTitle className="text-xl leading-tight">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have a good approach on adding a lineclamp for the description.

Since we are not too sure on how long these titles can be lets add a line-clamp-2 here as well to be safe.

Suggested change
<CardTitle className="text-xl leading-tight">
<CardTitle className="line-clamp-2 text-base sm:text-xl">

>
<p className="text-base text-neutral-800 dark:text-neutral-200">
<CardDescription className="line-clamp-[11] text-sm leading-relaxed text-muted-foreground">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will want to keep mobile in mind when building out specialized components like this.
It would be good to add a something similar to this:

Suggested change
<CardDescription className="line-clamp-[11] text-sm leading-relaxed text-muted-foreground">
<CardDescription className="line-clamp-[6] sm:line-clamp-[8] text-xs sm:text-sm">
{agent.description}
</CardDescription>

</div>
</div>
</CardContent>
<CardFooter className="flex items-center justify-between">
<CardFooter className="flex h-[60px] flex-none items-center justify-between">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CardFooter component already provides good spacing and alignment. We can remove the custom height and let it flow naturally:

Suggested change
<CardFooter className="flex h-[60px] flex-none items-center justify-between">
<CardFooter className="flex justify-between">

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform/backend AutoGPT Platform - Back end platform/frontend AutoGPT Platform - Front end size/m
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants