| 1 | /** |
| 2 | * AgentAssetsHeader - AI 生成素材页顶部组件 |
| 3 | * 包含返回按钮、标题(只读模式,无上传按钮) |
| 4 | */ |
| 5 | |
| 6 | 'use client' |
| 7 | |
| 8 | import { ArrowLeft, Bot } from 'lucide-react' |
| 9 | import { useRouter } from 'next/navigation' |
| 10 | import { useCallback } from 'react' |
| 11 | import { useTransClient } from '@/app/i18n/client' |
| 12 | import { Button } from '@/components/ui/button' |
| 13 | |
| 14 | interface AgentAssetsHeaderProps { |
| 15 | /** 总数量 */ |
| 16 | total: number |
| 17 | } |
| 18 | |
| 19 | export function AgentAssetsHeader({ total }: AgentAssetsHeaderProps) { |
| 20 | const { t } = useTransClient('material') |
| 21 | const router = useRouter() |
| 22 | |
| 23 | // 返回内容管理 |
| 24 | const handleBack = useCallback(() => { |
| 25 | router.push('/draft-box') |
| 26 | }, [router]) |
| 27 | |
| 28 | return ( |
| 29 | <header className="sticky top-0 z-10 flex items-center justify-between px-4 py-3 bg-card border-b border-border"> |
| 30 | <div className="flex items-center gap-3"> |
| 31 | <Button variant="ghost" size="icon" onClick={handleBack} className="w-8 h-8 cursor-pointer"> |
| 32 | <ArrowLeft className="w-5 h-5" /> |
| 33 | </Button> |
| 34 | |
| 35 | <div className="flex items-center gap-2"> |
| 36 | <div className="w-8 h-8 rounded-lg bg-gradient-back text-gradient-foreground flex items-center justify-center shadow-sm shadow-primary/20"> |
| 37 | <Bot className="w-4 h-4" /> |
| 38 | </div> |
| 39 | <h1 className="text-lg font-semibold text-foreground">{t('agentAssets.title')}</h1> |
| 40 | </div> |
| 41 | |
| 42 | {total > 0 && ( |
| 43 | <span className="text-sm text-muted-foreground"> |
| 44 | ( |
| 45 | {total} |
| 46 | ) |
| 47 | </span> |
| 48 | )} |
| 49 | </div> |
| 50 | |
| 51 | {/* 只读模式:无上传按钮 */} |
| 52 | </header> |
| 53 | ) |
| 54 | } |
| 55 |