Skip to content

Commit 32aeef0

Browse files
committed
Agent Store: Improve back button ux, add to publisher page too
1 parent 49b770a commit 32aeef0

File tree

3 files changed

+39
-15
lines changed

3 files changed

+39
-15
lines changed

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

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ import Link from 'next/link'
66
import { notFound } from 'next/navigation'
77

88
import { Badge } from '@/components/ui/badge'
9-
import { Button } from '@/components/ui/button'
109
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
1110
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'
11+
import { BackButton } from '@/components/ui/back-button'
1212
import { JsonViewer } from '@/components/agent/json-viewer'
1313
import { EnhancedCopyButton } from '@/components/ui/enhanced-copy-button'
1414
import { cn } from '@/lib/utils'
1515
import { AgentUsageMetrics } from './agent-usage-metrics'
16+
import { Button } from '@/components/ui/button'
1617

1718
interface AgentDetailPageProps {
1819
params: {
@@ -125,15 +126,9 @@ const AgentDetailPage = async ({ params }: AgentDetailPageProps) => {
125126

126127
return (
127128
<div className="container mx-auto py-6 px-4">
128-
<div className="max-w-4xl mx-auto">
129-
{/* Navigation */}
129+
<div className="max-w-4xl mx-auto"> {/* Navigation */}
130130
<div className="mb-6">
131-
<Link href={`/publishers/${params.id}`}>
132-
<Button variant="ghost" className="mb-4">
133-
<ArrowLeft className="h-4 w-4 mr-2" />
134-
Back to {publisherData.name}
135-
</Button>
136-
</Link>
131+
<BackButton />
137132
</div>
138133

139134
{/* Agent Header */}
@@ -148,11 +143,17 @@ const AgentDetailPage = async ({ params }: AgentDetailPageProps) => {
148143
</Badge>
149144
</div>
150145
<div className="mb-2">
151-
<Link href={`/publishers/${publisherData.id}`} className="flex items-center gap-2 hover:opacity-80 transition-opacity">
146+
<Link
147+
href={`/publishers/${publisherData.id}`}
148+
className="flex items-center gap-2 hover:opacity-80 transition-opacity"
149+
>
152150
<Avatar className="h-6 w-6">
153-
<AvatarImage src={publisherData.avatar_url || undefined} />
151+
<AvatarImage
152+
src={publisherData.avatar_url || undefined}
153+
/>
154154
<AvatarFallback className="text-xs">
155-
{publisherData.name[0]?.toUpperCase() || publisherData.id[0]?.toUpperCase()}
155+
{publisherData.name[0]?.toUpperCase() ||
156+
publisherData.id[0]?.toUpperCase()}
156157
</AvatarFallback>
157158
</Avatar>
158159
<span className="text-muted-foreground">

web/src/app/publishers/[id]/page.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { notFound } from 'next/navigation'
88

99
import { Badge } from '@/components/ui/badge'
1010
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'
11-
import { Button } from '@/components/ui/button'
11+
import { BackButton } from '@/components/ui/back-button'
1212

1313
interface PublisherPageProps {
1414
params: {
@@ -127,6 +127,11 @@ const PublisherPage = async ({ params }: PublisherPageProps) => {
127127
return (
128128
<div className="container mx-auto py-6 px-4">
129129
<div className="max-w-4xl mx-auto">
130+
{' '}
131+
{/* Navigation */}
132+
<div className="mb-6">
133+
<BackButton />
134+
</div>
130135
{/* Publisher Header */}
131136
<Card className="mb-8">
132137
<CardHeader>
@@ -191,7 +196,6 @@ const PublisherPage = async ({ params }: PublisherPageProps) => {
191196
</div>
192197
</CardHeader>
193198
</Card>
194-
195199
{/* Stats */}
196200
<div className="grid grid-cols-1 md:grid-cols-3 gap-4 mb-8">
197201
<Card>
@@ -217,7 +221,6 @@ const PublisherPage = async ({ params }: PublisherPageProps) => {
217221
</CardContent>
218222
</Card>
219223
</div>
220-
221224
{/* Published Agents - Grouped */}
222225
<Card>
223226
<CardHeader>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
'use client'
2+
3+
import { useRouter } from 'next/navigation'
4+
import { Button } from '@/components/ui/button'
5+
import { ArrowLeft } from 'lucide-react'
6+
7+
export const BackButton = () => {
8+
const router = useRouter()
9+
10+
return (
11+
<Button
12+
variant="ghost"
13+
className="mb-4"
14+
onClick={() => router.back()}
15+
>
16+
<ArrowLeft className="h-4 w-4 mr-2" />
17+
Back
18+
</Button>
19+
)
20+
}

0 commit comments

Comments
 (0)