Skip to content

Commit 7310075

Browse files
committed
AgentStore: Add publisher avatar
1 parent e798184 commit 7310075

File tree

6 files changed

+77
-3
lines changed

6 files changed

+77
-3
lines changed

bun.lock

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"@mdx-js/loader": "^3.1.0",
4242
"@mdx-js/react": "^3.1.0",
4343
"@next/mdx": "^15.2.4",
44+
"@radix-ui/react-avatar": "^1.1.10",
4445
"@radix-ui/react-collapsible": "^1.1.3",
4546
"@radix-ui/react-dialog": "^1.1.6",
4647
"@radix-ui/react-dropdown-menu": "^2.1.6",

web/src/app/api/agents/route.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export async function GET() {
2424
id: schema.publisher.id,
2525
name: schema.publisher.name,
2626
verified: schema.publisher.verified,
27+
avatar_url: schema.publisher.avatar_url,
2728
},
2829
})
2930
.from(schema.agentConfig)

web/src/app/publishers/[id]/agents/[agentId]/[version]/page.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { notFound } from 'next/navigation'
88
import { Badge } from '@/components/ui/badge'
99
import { Button } from '@/components/ui/button'
1010
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
11+
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'
1112
import { JsonViewer } from '@/components/agent/json-viewer'
1213
import { EnhancedCopyButton } from '@/components/ui/enhanced-copy-button'
1314
import { cn } from '@/lib/utils'
@@ -146,9 +147,17 @@ const AgentDetailPage = async ({ params }: AgentDetailPageProps) => {
146147
v{params.version}
147148
</Badge>
148149
</div>
149-
<p className="text-muted-foreground mb-2">
150-
by @{publisherData.id}
151-
</p>
150+
<div className="flex items-center gap-2 mb-2">
151+
<Avatar className="h-6 w-6">
152+
<AvatarImage src={publisherData.avatar_url || undefined} />
153+
<AvatarFallback className="text-xs">
154+
{publisherData.name[0]?.toUpperCase() || publisherData.id[0]?.toUpperCase()}
155+
</AvatarFallback>
156+
</Avatar>
157+
<span className="text-muted-foreground">
158+
@{publisherData.id}
159+
</span>
160+
</div>
152161
{agentData.description && (
153162
<p className="text-sm mb-4">{agentData.description}</p>
154163
)}

web/src/app/store/page.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { Badge } from '@/components/ui/badge'
2121
import { Skeleton } from '@/components/ui/skeleton'
2222
import { Input } from '@/components/ui/input'
2323
import { Button } from '@/components/ui/button'
24+
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'
2425
import {
2526
Select,
2627
SelectContent,
@@ -41,6 +42,7 @@ interface AgentData {
4142
id: string
4243
name: string
4344
verified: boolean
45+
avatar_url?: string | null
4446
}
4547
version: string
4648
created_at: string
@@ -242,6 +244,12 @@ const AgentStorePage = () => {
242244
</div>
243245
<div className="flex justify-between gap-2">
244246
<div className="flex items-center gap-2">
247+
<Avatar className="h-5 w-5 shrink-0">
248+
<AvatarImage src={agent.publisher.avatar_url || undefined} />
249+
<AvatarFallback className="text-xs">
250+
{agent.publisher.name[0]?.toUpperCase() || agent.publisher.id[0]?.toUpperCase()}
251+
</AvatarFallback>
252+
</Avatar>
245253
<span className="text-sm text-muted-foreground truncate">
246254
@{agent.publisher.id}
247255
</span>

web/src/components/ui/avatar.tsx

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
"use client"
2+
3+
import * as React from "react"
4+
import * as AvatarPrimitive from "@radix-ui/react-avatar"
5+
6+
import { cn } from "@/lib/utils"
7+
8+
const Avatar = React.forwardRef<
9+
React.ElementRef<typeof AvatarPrimitive.Root>,
10+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
11+
>(({ className, ...props }, ref) => (
12+
<AvatarPrimitive.Root
13+
ref={ref}
14+
className={cn(
15+
"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
16+
className
17+
)}
18+
{...props}
19+
/>
20+
))
21+
Avatar.displayName = AvatarPrimitive.Root.displayName
22+
23+
const AvatarImage = React.forwardRef<
24+
React.ElementRef<typeof AvatarPrimitive.Image>,
25+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
26+
>(({ className, ...props }, ref) => (
27+
<AvatarPrimitive.Image
28+
ref={ref}
29+
className={cn("aspect-square h-full w-full", className)}
30+
{...props}
31+
/>
32+
))
33+
AvatarImage.displayName = AvatarPrimitive.Image.displayName
34+
35+
const AvatarFallback = React.forwardRef<
36+
React.ElementRef<typeof AvatarPrimitive.Fallback>,
37+
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
38+
>(({ className, ...props }, ref) => (
39+
<AvatarPrimitive.Fallback
40+
ref={ref}
41+
className={cn(
42+
"flex h-full w-full items-center justify-center rounded-full bg-muted",
43+
className
44+
)}
45+
{...props}
46+
/>
47+
))
48+
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName
49+
50+
export { Avatar, AvatarImage, AvatarFallback }

0 commit comments

Comments
 (0)