Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
feat(web): Homepage UI optimization (#431)
yika9a91c61b3fa1
diff --git a/project/web/src/app/[lng]/page.tsx b/project/web/src/app/[lng]/page.tsxindex 27b08344..300a0fe3 100644--- a/project/web/src/app/[lng]/page.tsx+++ b/project/web/src/app/[lng]/page.tsx@@ -4,13 +4,14 @@*/'use client'-import { useState, useCallback, useEffect } from 'react'+import { useState, useCallback, useEffect, useRef } from 'react'import { ArrowUp } from 'lucide-react'import { HomeChat } from '@/components/Home/HomeChat'import { TaskPreview } from '@/components/Home/TaskPreview'import PromptGallery from '@/components/Home/PromptGallery'import { Button } from '@/components/ui/button'import { cn } from '@/lib/utils'+import { toast } from '@/lib/toast'/*** 回到顶部按钮组件@@ -47,7 +48,7 @@ function BackToTop({ position = 'left' }: { position?: 'left' | 'right' }) {? 'opacity-100 translate-y-0': 'opacity-0 translate-y-4 pointer-events-none')}- aria-label="回到顶部"+ aria-label="Back to top"><ArrowUp className="w-5 h-5" /></Button>@@ -55,11 +56,29 @@ function BackToTop({ position = 'left' }: { position?: 'left' | 'right' }) {}export default function Home() {+ const [appliedPrompt, setAppliedPrompt] = useState<string>('')++ // 处理提示词应用+ const handleApplyPrompt = useCallback((data: { prompt: string; image?: string; mode: 'edit' | 'generate' }) => {+ setAppliedPrompt(data.prompt)+ // 滚动到顶部+ window.scrollTo({ top: 0, behavior: 'smooth' })+ toast.success('Prompt applied!')+ }, [])++ // 清除外部提示词+ const handleClearExternalPrompt = useCallback(() => {+ setAppliedPrompt('')+ }, [])+return (<div className="bg-background">{/* 首屏 Chat 区域 */}<section className="min-h-[60vh] flex items-center justify-center px-4 pt-16 pb-8 md:pt-24 md:pb-12">- <HomeChat />+ <HomeChat+ externalPrompt={appliedPrompt}+ onClearExternalPrompt={handleClearExternalPrompt}+ /></section>{/* 任务预览区域 - 无数据时自动隐藏 */}@@ -67,7 +86,7 @@ export default function Home() {{/* 提示词画廊区域 */}<section>- <PromptGallery />+ <PromptGallery onApplyPrompt={handleApplyPrompt} /></section>{/* 回到顶部按钮 - 右侧 */}diff --git a/project/web/src/app/layout/MobileNav/index.tsx b/project/web/src/app/layout/MobileNav/index.tsxindex 22966c23..24b71c5d 100644--- a/project/web/src/app/layout/MobileNav/index.tsx+++ b/project/web/src/app/layout/MobileNav/index.tsx@@ -1,22 +1,60 @@/*** MobileNav - 移动端顶部导航组件* 在移动端显示,包含 Logo 和抽屉式导航菜单+ * 与桌面端侧边栏功能保持一致*/'use client'-import { FileText, Menu, X } from 'lucide-react'+import { useEffect, useState } from 'react'+import {+ Bell,+ BookOpen,+ Crown,+ DollarSign,+ FileText,+ Mail,+ Menu,+ PlusCircle,+ Puzzle,+ Share2,+ Smartphone,+ X,+} from 'lucide-react'import Image from 'next/image'import Link from 'next/link'import { useRouter, useSelectedLayoutSegments } from 'next/navigation'-import { useState } from 'react'+import { useShallow } from 'zustand/react/shallow'import { useTransClient } from '@/app/i18n/client'import { routerData } from '@/app/layout/routerData'import logo from '@/assets/images/logo.png'+import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'+import { Badge } from '@/components/ui/badge'import { Button } from '@/components/ui/button'+import { Skeleton } from '@/components/ui/skeleton'+import DownloadAppModal from '@/components/common/DownloadAppModal'+import { PluginModal } from '@/components/Plugin'+import SettingsModal, { type SettingsTab } from '@/components/SettingsModal'+import { useSettingsModalStore } from '@/components/SettingsModal/store'+import NotificationPanel from '@/components/notification/NotificationPanel'+import AddAccountModal from '@/app/[lng]/accounts/components/AddAccountModal'import { useGetClientLng } from '@/hooks/useSystem'+import { toast } from '@/lib/toast'+import { useNotification } from '@/hooks/useNotification'import { cn } from '@/lib/utils'import { useUserStore } from '@/store/user'+import { usePluginStore } from '@/store/plugin'+import { PluginStatus } from '@/store/plugin/types/baseTypes'import { openLoginModal } from '@/store/loginModal'+import { centsToUsd } from '@/api/credits'+import { getOssUrl } from '@/utils/oss'++// GitHub 配置+const GITHUB_REPO = 'yikart/AiToEarn'+const DOCS_URL = 'https://docs.aitoearn.ai'+const AFFILIATES_URL = 'https://aitoearn.getrewardful.com/signup?_gl=1*15wk8k8*_gcl_au*MjAzNTIwODgyMi4xNzY1MjkwMjc2LjExMjI2NzUyNDguMTc2NjE1MjM5OS4xNzY2MTUzODYz*_ga*OTk1MTc5MzQzLjE3NjUyOTAyNzY.*_ga_YJYFH7ZS27*czE3NjYxNTIzOTIkbzckZzEkdDE3NjYxNTM4OTQkajQ3JGwwJGgxODk3OTAxMTc1'++// 有效的 VIP 会员状态+const ACTIVE_VIP_STATUSES = ['active_monthly', 'active_yearly', 'active_nonrenewing', 'monthly_once', 'yearly_once']/*** 移动端导航项组件@@ -56,16 +94,359 @@ function MobileNavItem({)}+/**+ * 移动端 Add Channel 按钮+ */+function MobileAddChannelButton({+ onClose,+ onAddChannel,+}: {+ onClose: () => void+ onAddChannel: () => void+}) {+ const { t } = useTransClient('route')++ return (+ <button+ onClick={() => {+ onClose()+ onAddChannel()+ }}+ className={cn(+ 'flex items-center gap-3 px-4 py-3 rounded-lg text-base font-medium transition-all w-full',+ 'text-primary hover:bg-primary/10 hover:text-primary',+ 'border border-dashed border-primary/40 hover:border-primary',+ )}+ >+ <span className="flex items-center justify-center text-primary">+ <PlusCircle size={20} />+ </span>+ <span>{t('addChannel' as any)}</span>+ </button>+ )+}++/**+ * 移动端用户头像/登录区域+ */+function MobileUserSection({+ onClose,+ onOpenSettings,+}: {+ onClose: () => void+ onOpenSettings: (tab?: SettingsTab) => void+}) {+ const { t } = useTransClient('common')+ const token = useUserStore(state => state.token)+ const userInfo = useUserStore(state => state.userInfo)++ const handleLogin = () => {+ onClose()+ openLoginModal()+ }++ if (token && userInfo) {+ return (+ <button+ onClick={() => {+ onClose()+ onOpenSettings()+ }}+ className="flex w-full items-center gap-3 px-4 py-3 rounded-lg text-muted-foreground hover:bg-muted transition-colors"+ >+ <Avatar className="h-8 w-8 shrink-0 border-2 border-border">+ <AvatarImage+ src={getOssUrl(userInfo.avatar) || ''}+ alt={userInfo.name || t('unknownUser')}+ />+ <AvatarFallback className="bg-muted-foreground font-semibold text-background">+ {userInfo.name?.charAt(0)?.toUpperCase() || 'U'}+ </AvatarFallback>+ </Avatar>+ <span className="truncate text-sm font-medium text-foreground">+ {userInfo.name || t('unknownUser')}+ </span>+ </button>+ )+ }++ return (+ <Button onClick={handleLogin} className="w-full">+ {t('login')}+ </Button>+ )+}++/**+ * 移动端底部功能区+ */+function MobileBottomSection({+ onClose,+ onOpenSettings,+}: {+ onClose: () => void+ onOpenSettings: (tab?: SettingsTab) => void+}) {+ const { t } = useTransClient('common')+ const lng = useGetClientLng()+ const token = useUserStore(state => state.token)+ const userInfo = useUserStore(state => state.userInfo)+ const { unreadCount } = useNotification()++ const { creditsBalance, creditsLoading, fetchCreditsBalance } = useUserStore(+ useShallow(state => ({+ creditsBalance: state.creditsBalance,+ creditsLoading: state.creditsLoading,+ fetchCreditsBalance: state.fetchCreditsBalance,+ })),+ )++ const pluginStatus = usePluginStore(state => state.status)+ const [pluginModalVisible, setPluginModalVisible] = useState(false)+ const [downloadModalVisible, setDownloadModalVisible] = useState(false)+ const [notificationVisible, setNotificationVisible] = useState(false)+ const [starCount, setStarCount] = useState<string>('9.5k')++ // 判断用户是否是有效会员:需要有有效的状态且未过期+ const isVip = Boolean(+ userInfo?.vipInfo?.status &&+ ACTIVE_VIP_STATUSES.includes(userInfo.vipInfo.status) &&+ userInfo.vipInfo.expireTime &&+ new Date(userInfo.vipInfo.expireTime) > new Date()+ )++ // 登录后获取余额+ useEffect(() => {+ if (token) {+ fetchCreditsBalance()+ }+ }, [token, fetchCreditsBalance])++ // 获取 GitHub star 数量+ useEffect(() => {+ fetch(`https://api.github.com/repos/${GITHUB_REPO}`)+ .then(res => res.json())+ .then(data => {+ if (data.stargazers_count) {+ const count = data.stargazers_count+ setStarCount(count >= 1000 ? `${(count / 1000).toFixed(1)}k` : count.toString())+ }+ })+ .catch(() => {})+ }, [])++ // 根据插件状态返回对应的颜色和状态文本+ const getPluginStatusInfo = () => {+ switch (pluginStatus) {+ case PluginStatus.READY:+ return {+ iconColor: 'text-success',+ dotColor: 'bg-success',+ statusText: t('pluginStatus.ready'),+ }+ case PluginStatus.INSTALLED_NO_PERMISSION:+ return {+ iconColor: 'text-warning',+ dotColor: 'bg-warning',+ statusText: t('pluginStatus.noPermission'),+ }+ case PluginStatus.CHECKING:+ return {+ iconColor: 'text-info',+ dotColor: 'bg-info animate-pulse',+ statusText: t('pluginStatus.checking'),+ }+ default:+ return {+ iconColor: 'text-muted-foreground/70',+ dotColor: 'bg-muted-foreground/70',+ statusText: t('pluginStatus.notInstalled'),+ }+ }+ }++ const pluginInfo = getPluginStatusInfo()++ return (+ <>+ <div className="flex flex-col gap-1 border-t border-border pt-3">+ {/* 推广赚钱入口 */}+ <a+ href={AFFILIATES_URL}+ target="_blank"+ rel="noopener noreferrer"+ className="flex items-center justify-between px-4 py-3 rounded-lg text-muted-foreground hover:bg-muted transition-colors"+ >+ <div className="flex items-center gap-3">+ <Share2 size={20} className="text-primary" />+ <span className="text-base font-medium">{t('affiliates')}</span>+ </div>+ </a>++ {/* 余额 - 仅登录后显示 */}+ {token && (+ <button+ onClick={() => {+ onClose()+ onOpenSettings('subscription')+ }}+ className="flex items-center justify-between px-4 py-3 rounded-lg text-muted-foreground hover:bg-muted transition-colors w-full"+ >+ <div className="flex items-center gap-3">+ <DollarSign size={20} className="text-success" />+ <span className="text-base font-medium">{t('balance')}</span>+ </div>+ {creditsLoading ? (+ <Skeleton className="h-4 w-12" />+ ) : (+ <span className="text-sm font-medium text-foreground">+ ${centsToUsd(creditsBalance)}+ </span>+ )}+ </button>+ )}++ {/* 插件入口 */}+ <button+ onClick={() => setPluginModalVisible(true)}+ className="flex items-center justify-between px-4 py-3 rounded-lg text-muted-foreground hover:bg-muted transition-colors w-full"+ >+ <div className="flex items-center gap-3">+ <div className="relative">+ <Puzzle size={20} className={pluginInfo.iconColor} />+ <span+ className={cn(+ 'absolute -right-0.5 -top-0.5 h-2 w-2 rounded-full border border-background',+ pluginInfo.dotColor,+ )}+ />+ </div>+ <span className="text-base font-medium">{t('plugin')}</span>+ </div>+ <span className="text-xs text-muted-foreground">{pluginInfo.statusText}</span>+ </button>++ {/* VIP 会员入口 */}+ <Link+ href={`/${lng}/pricing`}+ onClick={onClose}+ className="flex flex-col px-4 py-3 rounded-lg text-muted-foreground hover:bg-muted transition-colors"+ >+ <div className="flex items-center justify-between w-full">+ <div className="flex items-center gap-3">+ <Crown size={20} className="text-warning" />+ <span className="text-base font-medium">{t('vip')}</span>+ </div>+ {!isVip && (+ <span className="text-xs text-muted-foreground">{t('subscribe')}</span>+ )}+ </div>+ {!isVip && (+ <div className="mt-1 ml-8">+ <span className="text-[10px] text-orange-500 font-medium">$19→$50 Credits</span>+ </div>+ )}+ </Link>+ </div>++ {/* 图标栏 */}+ <div className="flex items-center justify-center gap-4 border-t border-border py-3 mt-2">+ {/* 邮箱 - 联系我们 */}+ <a+ href="mailto:[email protected]"+ className="flex h-10 w-10 items-center justify-center rounded-lg text-muted-foreground hover:bg-muted transition-colors"+ title={`${t('contactUs')}: [email protected]`}+ >+ <Mail size={20} />+ </a>++ {/* 下载APP */}+ <button+ onClick={() => setDownloadModalVisible(true)}+ className="flex h-10 w-10 items-center justify-center rounded-lg text-muted-foreground hover:bg-muted transition-colors"+ title={t('downloadAppButton')}+ >+ <Smartphone size={20} />+ </button>++ {/* 通知 - 仅登录后显示 */}+ {token && (+ <button+ onClick={() => setNotificationVisible(true)}+ className="flex h-10 w-10 items-center justify-center rounded-lg text-muted-foreground hover:bg-muted transition-colors relative"+ title={t('notifications')}+ >+ <Bell size={20} />+ {unreadCount > 0 && (+ <Badge+ variant="destructive"+ className="absolute -right-1 -top-1 h-[18px] min-w-[18px] px-1 text-[10px] leading-[18px]"+ >+ {unreadCount > 99 ? '99+' : unreadCount}+ </Badge>+ )}+ </button>+ )}+ </div>++ {/* 外部链接 - Docs 和 GitHub */}+ <div className="flex items-center justify-center gap-3 border-t border-border py-3">+ <a+ href={DOCS_URL}+ target="_blank"+ rel="noopener noreferrer"+ className="inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full border border-border/60 text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground transition-all"+ >+ <BookOpen className="w-3.5 h-3.5" />+ Docs+ </a>+ <a+ href={`https://github.com/${GITHUB_REPO}`}+ target="_blank"+ rel="noopener noreferrer"+ className="inline-flex items-center rounded-full border border-border/60 overflow-hidden hover:border-border transition-all"+ >+ <span className="inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground transition-colors">+ <svg className="w-3.5 h-3.5" viewBox="0 0 24 24" fill="currentColor">+ <path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/>+ </svg>+ Star+ </span>+ <span className="px-2 py-1.5 text-xs font-semibold text-muted-foreground bg-muted/50 border-l border-border/60">+ {starCount}+ </span>+ </a>+ </div>++ {/* 用户区域 */}+ <div className="border-t border-border pt-3 px-4">+ <MobileUserSection onClose={onClose} onOpenSettings={onOpenSettings} />+ </div>++ {/* 弹窗 */}+ <PluginModal visible={pluginModalVisible} onClose={() => setPluginModalVisible(false)} />+ <DownloadAppModal visible={downloadModalVisible} onClose={() => setDownloadModalVisible(false)} />+ <NotificationPanel visible={notificationVisible} onClose={() => setNotificationVisible(false)} />+ </>+ )+}+/*** 移动端导航主组件*/const MobileNav = () => {const [isOpen, setIsOpen] = useState(false)+ const [addAccountVisible, setAddAccountVisible] = useState(false)const router = useRouter()- const { t } = useTransClient('common')const lng = useGetClientLng()- const token = useUserStore(state => state.token)const route = useSelectedLayoutSegments()+ const token = useUserStore(state => state.token)+ const {+ settingsVisible,+ settingsDefaultTab,+ openSettings,+ closeSettings,+ } = useSettingsModalStore()// 获取当前路由let currRouter = '/'@@ -77,11 +458,26 @@ const MobileNav = () => {currRouter = `/${route.slice(0, 2).join('/')}`}+ // auth 和 websit 页面不显示导航+ const isAuthPage = route[0] === 'auth' || route[0] === 'websit'+ if (isAuthPage) {+ return null+ }+const handleClose = () => setIsOpen(false)- const handleLogin = () => {- handleClose()- openLoginModal()+ const handleOpenSettings = (defaultTab?: SettingsTab) => {+ openSettings(defaultTab)+ }++ // 打开添加账号弹窗+ const handleAddChannel = () => {+ if (!token) {+ toast.warning('Please login first')+ openLoginModal(() => setAddAccountVisible(true))+ return+ }+ setAddAccountVisible(true)}return (@@ -111,12 +507,12 @@ const MobileNav = () => {{/* 抽屉导航 */}<divclassName={cn(- 'md:hidden fixed top-0 right-0 z-50 w-[280px] h-full bg-background shadow-xl transition-transform duration-300 ease-in-out',+ 'md:hidden fixed top-0 right-0 z-50 w-[300px] h-full bg-background shadow-xl transition-transform duration-300 ease-in-out flex flex-col',isOpen ? 'translate-x-0' : 'translate-x-full',)}>{/* 抽屉头部 */}- <div className="flex items-center justify-between h-14 px-4 border-b border-border">+ <div className="flex items-center justify-between h-14 px-4 border-b border-border shrink-0"><span className="text-base font-semibold text-foreground">Menu</span><buttononClick={handleClose}@@ -126,32 +522,60 @@ const MobileNav = () => {</button></div>- {/* 导航列表 */}- <nav className="flex flex-col gap-1 p-4">- {routerData.map(item => (- <MobileNavItem- key={item.path || item.name}- path={item.path || '/'}- translationKey={item.translationKey}- icon={item.icon}- isActive={item.path === currRouter}- onClose={handleClose}- />- ))}- </nav>-- {/* 底部登录按钮 */}- {!token && (- <div className="absolute bottom-0 left-0 right-0 p-4 border-t border-border">- <Button- onClick={handleLogin}- className="w-full"- >- {t('login')}- </Button>+ {/* 可滚动内容区域 */}+ <div className="flex-1 overflow-y-auto">+ {/* 导航列表 */}+ <nav className="flex flex-col gap-1 p-4">+ {routerData.map((item, index) => {+ // 找到 interactive(Engage)的位置,在其后面插入 Add Channel 按钮+ const isInteractive = item.translationKey === 'interactive'+ return (+ <div key={item.path || item.name}>+ <MobileNavItem+ path={item.path || '/'}+ translationKey={item.translationKey}+ icon={item.icon}+ isActive={item.path === currRouter}+ onClose={handleClose}+ />+ {/* 在 Engage 后面插入 Add Channel 按钮 */}+ {isInteractive && (+ <div className="mt-1">+ <MobileAddChannelButton+ onClose={handleClose}+ onAddChannel={handleAddChannel}+ />+ </div>+ )}+ </div>+ )+ })}+ </nav>++ {/* 底部功能区 */}+ <div className="px-4 pb-4">+ <MobileBottomSection onClose={handleClose} onOpenSettings={handleOpenSettings} /></div>- )}+ </div></div>++ {/* 设置弹框 */}+ <SettingsModal+ open={settingsVisible}+ onClose={closeSettings}+ defaultTab={settingsDefaultTab}+ />++ {/* 添加账号弹窗 */}+ <AddAccountModal+ open={addAccountVisible}+ onClose={() => setAddAccountVisible(false)}+ onAddSuccess={() => {+ setAddAccountVisible(false)+ toast.success('Account added successfully')+ }}+ showSpaceSelector={true}+ /></>)}diff --git a/project/web/src/components/Home/HomeChat/index.tsx b/project/web/src/components/Home/HomeChat/index.tsxindex bad28fb4..09912979 100644--- a/project/web/src/components/Home/HomeChat/index.tsx+++ b/project/web/src/components/Home/HomeChat/index.tsx@@ -25,6 +25,10 @@ export interface IHomeChatProps {onLoginRequired?: () => void/** 自定义类名 */className?: string+ /** 外部设置的提示词 */+ externalPrompt?: string+ /** 清除外部提示词的回调 */+ onClearExternalPrompt?: () => void}/**@@ -33,6 +37,8 @@ export interface IHomeChatProps {export function HomeChat({onLoginRequired,className,+ externalPrompt,+ onClearExternalPrompt,}: IHomeChatProps) {const { t } = useTransClient('chat')const { t: tHome } = useTransClient('home')@@ -45,6 +51,14 @@ export function HomeChat({// 状态 - 默认显示提示文本const [inputValue, setInputValue] = useState(defaultPrompt)++ // 当外部提示词变化时更新输入框+ useEffect(() => {+ if (externalPrompt) {+ setInputValue(externalPrompt)+ onClearExternalPrompt?.()+ }+ }, [externalPrompt, onClearExternalPrompt])const [isSubmitting, setIsSubmitting] = useState(false)const [addAccountVisible, setAddAccountVisible] = useState(false)diff --git a/project/web/src/components/Home/PromptGallery/components/PromptDetailModal.tsx b/project/web/src/components/Home/PromptGallery/components/PromptDetailModal.tsxindex 07efd322..2f818260 100644--- a/project/web/src/components/Home/PromptGallery/components/PromptDetailModal.tsx+++ b/project/web/src/components/Home/PromptGallery/components/PromptDetailModal.tsx@@ -37,57 +37,59 @@ export function PromptDetailModal({const getCategory = (it: PromptItem) => isEnglish && it.category_en ? it.category_en : it.categoryreturn (<Dialog open={!!item} onOpenChange={onClose}>- <DialogContent className="sm:max-w-[700px] max-h-[90vh] p-0 overflow-hidden bg-card rounded-2xl flex flex-col">+ <DialogContent className="sm:max-w-[600px] max-h-[80vh] p-0 overflow-hidden bg-card rounded-2xl flex flex-col">{item && (<>- {/* 图片区域 - 自适应高度,最大 400px */}- <div className="relative flex-shrink-0 max-h-[400px] overflow-hidden bg-muted">- <img- src={item.preview}- alt={item.title}- className="w-full h-auto max-h-[400px] object-contain"- />- </div>-- {/* 内容区域 - 可滚动 */}- <div className="p-6 flex-1 overflow-y-auto">- <DialogHeader className="mb-4">- <DialogTitle className="text-2xl font-bold text-foreground">- {getTitle(item)}- </DialogTitle>- </DialogHeader>-- {/* 标签 */}- <div className="flex items-center gap-2 mb-4 flex-wrap">- {getSubCategory(item) && (+ {/* 上半部分:图片 + 标题 + 标签 - 水平布局 */}+ <div className="flex gap-4 p-4 border-b border-border">+ {/* 图片缩略图 */}+ <div className="flex-shrink-0 w-24 h-24 rounded-xl overflow-hidden bg-muted">+ <img+ src={item.preview}+ alt={item.title}+ className="w-full h-full object-cover"+ />+ </div>+ {/* 标题和标签 */}+ <div className="flex-1 min-w-0">+ <DialogHeader>+ <DialogTitle className="text-lg font-bold text-foreground line-clamp-2">+ {getTitle(item)}+ </DialogTitle>+ </DialogHeader>+ <div className="flex items-center gap-2 mt-2 flex-wrap">+ {getSubCategory(item) && (+ <Badge+ variant="secondary"+ className="bg-muted text-muted-foreground text-xs"+ >+ {getSubCategory(item)}+ </Badge>+ )}<Badgevariant="secondary"- className="bg-muted text-muted-foreground"+ className="bg-muted text-muted-foreground text-xs">- {getSubCategory(item)}+ {getCategory(item)}</Badge>- )}- <Badge- variant="secondary"- className="bg-muted text-muted-foreground"- >- {getCategory(item)}- </Badge>+ </div></div>+ </div>- {/* 提示词内容 */}- <div className="mb-6">- <label className="block text-sm font-semibold text-foreground mb-2">- {t('modal.promptLabel')}- </label>- <div className="bg-muted rounded-xl p-4 max-h-48 overflow-y-auto border border-border">- <p className="text-sm text-foreground whitespace-pre-wrap leading-relaxed">- {getPrompt(item)}- </p>- </div>+ {/* 提示词内容区域 - 可滚动 */}+ <div className="flex-1 overflow-y-auto p-4">+ <label className="block text-sm font-semibold text-foreground mb-2">+ {t('modal.promptLabel')}+ </label>+ <div className="bg-muted rounded-xl p-4 max-h-[200px] overflow-y-auto border border-border">+ <p className="text-sm text-foreground whitespace-pre-wrap leading-relaxed">+ {getPrompt(item)}+ </p></div>+ </div>- {/* 应用按钮 */}+ {/* 底部应用按钮 - 固定在底部 */}+ <div className="flex-shrink-0 p-4 border-t border-border bg-card"><Buttonsize="lg"onClick={() => onApply(item)}diff --git a/project/web/src/components/Home/PromptGallery/index.tsx b/project/web/src/components/Home/PromptGallery/index.tsxindex d89744a2..8bb442c5 100644--- a/project/web/src/components/Home/PromptGallery/index.tsx+++ b/project/web/src/components/Home/PromptGallery/index.tsx@@ -43,14 +43,17 @@ export default function PromptGallery({}, [selectedCategory])/**- * 处理应用提示词+ * 处理应用提示词 - 根据语言选择对应的提示词*/const handleApplyPrompt = useCallback((item: PromptItem, e?: React.MouseEvent) => {e?.stopPropagation()if (onApplyPrompt) {+ const isEnglish = lng === 'en'+ // 根据语言选择对应的提示词+ const promptText = isEnglish && item.prompt_en ? item.prompt_en : item.promptconst applyData = {- prompt: item.prompt,+ prompt: promptText,mode: item.mode,...(item.mode === 'edit' && { image: item.preview }),}@@ -62,7 +65,7 @@ export default function PromptGallery({window.scrollTo({ top: 0, behavior: 'smooth' })}},- [onApplyPrompt]+ [onApplyPrompt, lng])/**