Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
feat(web): Homepage UI optimization (#427)
yika7be6523c7191
diff --git a/project/web/src/app/[lng]/accounts/components/AddAccountModal/index.tsx b/project/web/src/app/[lng]/accounts/components/AddAccountModal/index.tsxindex bde6b041..ce1a9774 100644--- a/project/web/src/app/[lng]/accounts/components/AddAccountModal/index.tsx+++ b/project/web/src/app/[lng]/accounts/components/AddAccountModal/index.tsx@@ -378,23 +378,33 @@ const AddAccountModal = memo(return (<><Modal- title={t('addAccountModal.title')}+ title={+ <div className="flex items-center gap-2">+ <span className="text-xl">🎯</span>+ <span className="text-sm sm:text-base md:text-lg font-semibold">{t('addAccountModal.title')}</span>+ </div>+ }open={open}onOk={handleOk}onCancel={handleCancel}footer={null}- width={650}+ width={750}+ className="add-account-responsive-modal">- <div>- <h1 className="text-sm mb-[15px]">{t('addAccountModal.subtitle')}</h1>+ <div className="w-full">+ <h1 className="text-sm sm:text-base font-semibold mb-3 sm:mb-4 text-gray-700">+ {t('addAccountModal.subtitle')}+ </h1>{/* 空间选择器 */}{spaceSelectionRequired && (- <div className="mb-5 pb-4 border-b border-border">- <div className="flex items-center gap-3">- <span className="text-sm font-semibold min-w-[80px]">{t('addAccountModal.addTo')}</span>+ <div className="mb-3 sm:mb-4 pb-3 sm:pb-4 border-b border-border w-full">+ <div className="flex flex-col sm:flex-row items-start sm:items-center gap-2 sm:gap-3 p-3 bg-gradient-to-r from-blue-50 to-indigo-50 rounded-lg border border-blue-100">+ <span className="text-xs sm:text-sm font-semibold text-gray-700 whitespace-nowrap">+ {t('addAccountModal.addTo')}+ </span><Select value={selectedSpaceId} onValueChange={setSelectedSpaceId}>- <SelectTrigger className="w-[200px]">+ <SelectTrigger className="w-full sm:w-[220px] border-blue-200 h-9"><SelectValue placeholder={t('pleaseChooseSpace')} /></SelectTrigger><SelectContent>@@ -411,17 +421,34 @@ const AddAccountModal = memo({/* 当前选择的空间信息 */}{selectedSpaceId && !spaceSelectionRequired && (- <div className="mb-5 p-3 bg-muted rounded-md border border-border text-xs text-muted-foreground">- <span>- {t('addAccountModal.currentSpace')}- :- {' '}- {accountGroupList.find(g => g.id === selectedSpaceId)?.name}+ <div className="mb-3 sm:mb-4 p-2.5 sm:p-3 bg-gradient-to-r from-blue-50 to-indigo-50 rounded-lg border border-blue-100 text-xs sm:text-sm text-gray-600 w-full">+ <span className="flex items-center gap-1.5 sm:gap-2 flex-wrap">+ <span className="inline-block w-1.5 h-1.5 sm:w-2 sm:h-2 bg-blue-500 rounded-full flex-shrink-0"></span>+ <span>{t('addAccountModal.currentSpace')}:</span>+ <span className="font-semibold text-gray-800">+ {accountGroupList.find(g => g.id === selectedSpaceId)?.name}+ </span></span></div>)}- <div className="grid grid-cols-[repeat(auto-fill,minmax(84px,1fr))] gap-3 overflow-y-auto overflow-x-hidden mb-5">+ {/* 平台网格 - 响应式优化 */}+ <div+ className="+ w-full grid gap-2 sm:gap-3 mb-3 sm:mb-4+ overflow-y-auto overflow-x-hidden+ max-h-[60vh] sm:max-h-[450px]+ grid-cols-3+ sm:grid-cols-4+ md:grid-cols-5+ lg:grid-cols-6+ xl:grid-cols-7+ "+ style={{+ scrollbarWidth: 'thin',+ scrollbarColor: '#cbd5e1 #f1f5f9'+ }}+ ><TooltipProvider>{AccountPlatInfoArr.map(([key, value]) => {const isAvailable = isPlatformAvailable(key as PlatType)@@ -431,22 +458,62 @@ const AddAccountModal = memo(<TooltipTrigger asChild><Buttonvariant="ghost"- className="p-2 rounded-lg h-[90px] whitespace-normal flex flex-col items-center justify-center hover:bg-accent disabled:opacity-50"+ className={`+ relative rounded-lg sm:rounded-xl whitespace-normal+ flex flex-col items-center justify-center+ bg-gradient-to-br from-white to-gray-50+ border border-gray-200 sm:border-[1.5px]+ transition-all duration-300 ease-out+ hover:border-blue-400 hover:shadow-lg hover:shadow-blue-100/50+ hover:-translate-y-1 hover:bg-gradient-to-br hover:from-white hover:to-blue-50+ active:translate-y-0 active:scale-[0.98]+ disabled:opacity-40 disabled:cursor-not-allowed+ disabled:hover:translate-y-0 disabled:hover:shadow-none+ overflow-hidden group+ p-2 sm:p-3+ h-[90px] sm:h-[100px] md:h-[110px]+ min-w-0 w-full+ ${!isAvailable || (spaceSelectionRequired && !selectedSpaceId) ? 'grayscale' : ''}+ `}disabled={!isAvailable || (spaceSelectionRequired && !selectedSpaceId) || isLoading}onClick={() => handlePlatformClick(key as PlatType, value)}>- <div className="flex flex-col items-center gap-2 w-full">- <img- src={value.icon}- className="w-10 h-10"- style={{ opacity: isAvailable ? 1 : 0.5 }}- alt={value.name}- />- <span className="text-xs text-center" style={{ opacity: isAvailable ? 1 : 0.5 }}>{value.name}</span>+ {/* 光泽效果 */}+ <div className="absolute inset-0 bg-gradient-to-r from-transparent via-white/40 to-transparent -translate-x-full group-hover:translate-x-full transition-transform duration-700" />++ <div className="flex flex-col items-center gap-1.5 sm:gap-2 w-full relative z-10">+ {isLoading ? (+ <div className="w-9 h-9 sm:w-10 sm:h-10 md:w-11 md:h-11 flex items-center justify-center">+ <div className="animate-spin rounded-full h-8 w-8 sm:h-9 sm:w-9 md:h-10 md:w-10 border-b-2 border-blue-500" />+ </div>+ ) : (+ <img+ src={value.icon}+ className={`+ w-9 h-9 sm:w-10 sm:h-10 md:w-11 md:h-11+ object-contain+ transition-all duration-300+ group-hover:scale-110 group-hover:rotate-[5deg]+ filter drop-shadow-md+ `}+ alt={value.name}+ />+ )}+ <span+ className={`+ text-[11px] sm:text-xs text-center font-medium+ leading-tight transition-all duration-300+ group-hover:text-blue-600 group-hover:font-semibold+ ${isAvailable ? 'text-gray-700' : 'text-gray-400'}+ line-clamp-2 w-full+ `}+ >+ {value.name}+ </span></div></Button></TooltipTrigger>- <TooltipContent>+ <TooltipContent className="max-w-[200px] text-xs"><p>{value.tips?.account}</p></TooltipContent></Tooltip>@@ -457,17 +524,23 @@ const AddAccountModal = memo({/* 属地限制提示 */}{isCnSpace !== null && (- <div className="mt-4 p-3 bg-muted rounded-md text-xs text-muted-foreground text-center">- {isCnSpace- ? t('locationRestriction.cnSpace')- : t('locationRestriction.nonCnSpace')}+ <div className="mt-2 sm:mt-3 p-2.5 sm:p-3 bg-gradient-to-r from-amber-50 to-orange-50 rounded-lg text-amber-700 text-center border border-amber-200 flex items-center justify-center gap-1.5 sm:gap-2 flex-wrap w-full">+ <span className="text-sm flex-shrink-0">ℹ️</span>+ <span className="text-[11px] sm:text-xs leading-tight">+ {isCnSpace+ ? t('locationRestriction.cnSpace')+ : t('locationRestriction.nonCnSpace')}+ </span></div>)}{/* 空间选择提示 */}{spaceSelectionRequired && !selectedSpaceId && (- <div className="mt-4 p-3 bg-warning/10 rounded-md text-xs text-warning text-center">- {t('addAccountModal.pleaseChooseSpaceFirst')}+ <div className="mt-2 sm:mt-3 p-2.5 sm:p-3 bg-gradient-to-r from-yellow-50 to-amber-50 rounded-lg text-amber-600 text-center border border-yellow-200 flex items-center justify-center gap-1.5 sm:gap-2 animate-pulse flex-wrap w-full">+ <span className="text-sm flex-shrink-0">⚠️</span>+ <span className="font-medium text-[11px] sm:text-xs leading-tight">+ {t('addAccountModal.pleaseChooseSpaceFirst')}+ </span></div>)}</div>diff --git a/project/web/src/app/[lng]/page.tsx b/project/web/src/app/[lng]/page.tsxindex 054e1099..700307fd 100644--- a/project/web/src/app/[lng]/page.tsx+++ b/project/web/src/app/[lng]/page.tsx@@ -1,6 +1,6 @@/*** 首页 - AI Agent 内容生成- * 功能:AI 驱动的内容创作、提示词画廊、任务预览+ * 功能:AI 驱动的内容创作、任务预览*/'use client'@@ -62,13 +62,6 @@ export default function Home() {const token = useUserStore((state) => state.token)const router = useRouter()- // 用于接收从 PromptGallery 应用的提示词- const [appliedPrompt, setAppliedPrompt] = useState<{- prompt: string- image?: string- mode: 'edit' | 'generate'- } | null>(null)-/** 检查登录状态 */const handleLoginRequired = () => {if (!token) {@@ -76,23 +69,12 @@ export default function Home() {}}- /** 处理应用提示词 */- const handleApplyPrompt = useCallback(- (data: { prompt: string; image?: string; mode: 'edit' | 'generate' }) => {- setAppliedPrompt(data)- // 可以在这里扩展更多逻辑,比如自动填充到 HomeChat- },- []- )-return (<div className="min-h-screen bg-background">{/* 首屏 Chat 区域 */}<section className="min-h-[70vh] flex items-center justify-center px-4 pt-32 pb-12"><HomeChatonLoginRequired={token ? undefined : handleLoginRequired}- appliedPrompt={appliedPrompt}- onAppliedPromptHandled={() => setAppliedPrompt(null)}/></section>@@ -101,11 +83,11 @@ export default function Home() {{/* 提示词画廊区域 */}<section>- <PromptGallery onApplyPrompt={handleApplyPrompt} />+ <PromptGallery /></section>- {/* 回到顶部按钮 - 左侧 */}- <BackToTop position="left" />+ {/* 回到顶部按钮 - 右侧 */}+ <BackToTop position="right" /></div>)}diff --git a/project/web/src/app/globals.css b/project/web/src/app/globals.cssindex a8cb7e3f..75ba95a0 100644--- a/project/web/src/app/globals.css+++ b/project/web/src/app/globals.css@@ -155,4 +155,51 @@ button {body > div {pointer-events: auto;+}++/* 添加账号Modal响应式优化 */+.add-account-responsive-modal {+ /* 移动端优化 - 确保内容占满宽度 */+ @media (max-width: 640px) {+ /* 针对 shadcn Dialog 的移动端样式 */+ & [role="dialog"] {+ padding: 16px !important;+ }+ }+}++/* 自定义滚动条 - 细节优化 */+@layer utilities {+ .scrollbar-thin {+ scrollbar-width: thin;+ }++ .scrollbar-thumb-gray-300 {+ scrollbar-color: #d1d5db #f3f4f6;+ }++ .scrollbar-track-gray-100 {+ /* 用于scrollbar-color的第二个值 */+ }+}++/* Webkit浏览器滚动条优化 */+.add-account-responsive-modal ::-webkit-scrollbar {+ width: 6px;+ height: 6px;+}++.add-account-responsive-modal ::-webkit-scrollbar-track {+ background: #f3f4f6;+ border-radius: 10px;+}++.add-account-responsive-modal ::-webkit-scrollbar-thumb {+ background: #d1d5db;+ border-radius: 10px;+ transition: background 0.2s;+}++.add-account-responsive-modal ::-webkit-scrollbar-thumb:hover {+ background: #9ca3af;}\ No newline at end of filediff --git a/project/web/src/app/i18n/locales/en/chat.json b/project/web/src/app/i18n/locales/en/chat.jsonindex de1f46b3..ddaff070 100644--- a/project/web/src/app/i18n/locales/en/chat.json+++ b/project/web/src/app/i18n/locales/en/chat.json@@ -35,7 +35,7 @@"aiCreation": "AI Creation","supportUpload": "Support image/video upload","enterToSend": "Press Enter to send",- "connectTools": "Can help you publish to"+ "connectTools": "Publish to"},"history": {"title": "Task History",diff --git a/project/web/src/app/i18n/locales/en/notification.json b/project/web/src/app/i18n/locales/en/notification.jsonindex bec7625a..99670345 100644--- a/project/web/src/app/i18n/locales/en/notification.json+++ b/project/web/src/app/i18n/locales/en/notification.json@@ -1,5 +1,7 @@{"title": "Notifications",+ "taskCenter": "Task Center",+ "taskCenterDesc": "View and manage your tasks","detailTitle": "Notification Details","markAllAsRead": "Mark All as Read","markAsRead": "Mark as Read",diff --git a/project/web/src/app/i18n/locales/en/plugin.json b/project/web/src/app/i18n/locales/en/plugin.jsonindex 211e3b98..b380cfbf 100644--- a/project/web/src/app/i18n/locales/en/plugin.json+++ b/project/web/src/app/i18n/locales/en/plugin.json@@ -67,7 +67,7 @@"pluginActive": "Plugin Active","pluginInactive": "Plugin Inactive","downloadPlugin": "Download Plugin",- "downloadDescription": "Aitoearn browser plugin helps you quickly publish content to various platforms. Click the button below to download and install.",+ "downloadDescription": "The AiToEarn browser plugin is designed for smart automation of Douyin and Xiaohongshu. Click the button below to download and install.","downloadButton": "Download Now","chromeWebStore": "Chrome Web Store","githubRelease": "GitHub Release",diff --git a/project/web/src/app/i18n/locales/en/route.json b/project/web/src/app/i18n/locales/en/route.jsonindex 70426797..18ec94e0 100644--- a/project/web/src/app/i18n/locales/en/route.json+++ b/project/web/src/app/i18n/locales/en/route.json@@ -13,5 +13,6 @@"interactiveNew": "Engage New","dataMonitoring": "Data Monitoring","navigation": "Navigation",- "aiRank": "AI Rank"+ "aiRank": "AI Rank",+ "addChannel": "Add Channel"}diff --git a/project/web/src/app/i18n/locales/zh-CN/chat.json b/project/web/src/app/i18n/locales/zh-CN/chat.jsonindex 1d5f4ff5..423ca3d7 100644--- a/project/web/src/app/i18n/locales/zh-CN/chat.json+++ b/project/web/src/app/i18n/locales/zh-CN/chat.json@@ -35,7 +35,7 @@"aiCreation": "AI 智能创作","supportUpload": "支持图片/视频上传","enterToSend": "按 Enter 发送",- "connectTools": "可以帮您发布到"+ "connectTools": "发布到"},"history": {"title": "任务记录",diff --git a/project/web/src/app/i18n/locales/zh-CN/notification.json b/project/web/src/app/i18n/locales/zh-CN/notification.jsonindex fef5803d..cf3a7d1c 100644--- a/project/web/src/app/i18n/locales/zh-CN/notification.json+++ b/project/web/src/app/i18n/locales/zh-CN/notification.json@@ -1,5 +1,7 @@{"title": "消息通知",+ "taskCenter": "任务中心",+ "taskCenterDesc": "查看和管理您的任务","detailTitle": "通知详情","markAllAsRead": "全部标记为已读","markAsRead": "标记为已读",diff --git a/project/web/src/app/i18n/locales/zh-CN/plugin.json b/project/web/src/app/i18n/locales/zh-CN/plugin.jsonindex 6b6831c3..d4079087 100644--- a/project/web/src/app/i18n/locales/zh-CN/plugin.json+++ b/project/web/src/app/i18n/locales/zh-CN/plugin.json@@ -67,7 +67,7 @@"pluginActive": "插件已激活","pluginInactive": "插件未激活","downloadPlugin": "下载插件",- "downloadDescription": "Aitoearn 浏览器插件可以帮助您快速发布内容到各大平台。请点击下方按钮下载安装。",+ "downloadDescription": "AiToEarn 浏览器插件专门用于抖音和小红书的智能操作。请点击下方按钮下载安装。","downloadButton": "立即下载","chromeWebStore": "Chrome 应用商店","githubRelease": "GitHub 下载",diff --git a/project/web/src/app/i18n/locales/zh-CN/route.json b/project/web/src/app/i18n/locales/zh-CN/route.jsonindex b90fc9ea..22aee1c8 100644--- a/project/web/src/app/i18n/locales/zh-CN/route.json+++ b/project/web/src/app/i18n/locales/zh-CN/route.json@@ -14,5 +14,6 @@"interactiveNew": "作品互动 new","dataMonitoring": "数据监控","navigation": "导航",- "aiRank": "AI热榜"+ "aiRank": "AI热榜",+ "addChannel": "添加频道"}diff --git a/project/web/src/app/layout/LayoutSidebar/components/NavSection.tsx b/project/web/src/app/layout/LayoutSidebar/components/NavSection.tsxindex 6cb944b0..1a38d9b5 100644--- a/project/web/src/app/layout/LayoutSidebar/components/NavSection.tsx+++ b/project/web/src/app/layout/LayoutSidebar/components/NavSection.tsx@@ -5,7 +5,7 @@'use client'import Link from 'next/link'-import { FileText } from 'lucide-react'+import { FileText, PlusCircle } from 'lucide-react'import { useTransClient } from '@/app/i18n/client'import { useGetClientLng } from '@/hooks/useSystem'import { cn } from '@/lib/utils'@@ -70,16 +70,77 @@ function NavItem({ item, isActive, collapsed }: NavItemProps) {return content}-export function NavSection({ items, currentRoute, collapsed }: NavSectionProps) {+/** Add Channel 按钮 */+interface AddChannelButtonProps extends SidebarCommonProps {+ onClick: () => void+}++function AddChannelButton({ collapsed, onClick }: AddChannelButtonProps) {+ const { t } = useTransClient('route')++ const content = (+ <button+ onClick={onClick}+ className={cn(+ 'relative flex items-center rounded-lg text-sm font-medium transition-all w-full',+ 'text-primary hover:bg-primary/10 hover:text-primary',+ 'border border-dashed border-primary/40 hover:border-primary',+ collapsed ? 'justify-center px-2 py-2.5' : 'gap-3 px-3 py-2.5',+ )}+ >+ <span className="flex shrink-0 items-center justify-center text-primary">+ <PlusCircle size={20} />+ </span>+ {!collapsed && (+ <span className="overflow-hidden text-ellipsis whitespace-nowrap">+ {t('addChannel' as any)}+ </span>+ )}+ </button>+ )++ // 收缩状态下显示 Tooltip+ if (collapsed) {+ return (+ <TooltipProvider>+ <Tooltip>+ <TooltipTrigger asChild>{content}</TooltipTrigger>+ <TooltipContent side="right">+ <p>{t('addChannel' as any)}</p>+ </TooltipContent>+ </Tooltip>+ </TooltipProvider>+ )+ }++ return content+}++interface NavSectionWithAddChannelProps extends NavSectionProps {+ onAddChannel?: () => void+}++export function NavSection({ items, currentRoute, collapsed, onAddChannel }: NavSectionWithAddChannelProps) {+ // 在 "互动数据" 后面插入 Add Channel 按钮 (index 3,即第4个位置)+ const interactiveIndex = items.findIndex(item => item.translationKey === 'interactive')+ const insertIndex = interactiveIndex !== -1 ? interactiveIndex + 1 : 4+return (<nav className="flex flex-1 flex-col gap-1">- {items.map(item => (- <NavItem- key={item.path || item.translationKey}- item={item}- isActive={item.path === currentRoute}- collapsed={collapsed}- />+ {items.map((item, index) => (+ <div key={item.path || item.translationKey}>+ <NavItem+ item={item}+ isActive={item.path === currentRoute}+ collapsed={collapsed}+ />+ {/* 在指定位置插入 Add Channel 按钮 */}+ {index === insertIndex - 1 && onAddChannel && (+ <div className="mt-1">+ <AddChannelButton collapsed={collapsed} onClick={onAddChannel} />+ </div>+ )}+ </div>))}</nav>)diff --git a/project/web/src/app/layout/LayoutSidebar/index.tsx b/project/web/src/app/layout/LayoutSidebar/index.tsxindex b8574033..4990c560 100644--- a/project/web/src/app/layout/LayoutSidebar/index.tsx+++ b/project/web/src/app/layout/LayoutSidebar/index.tsx@@ -5,13 +5,16 @@*/'use client'-import { useState } from 'react'+import { useState, useEffect } from 'react'import { useRouter, useSelectedLayoutSegments } from 'next/navigation'+import { BookOpen } from 'lucide-react'import { useNotification } from '@/hooks/useNotification'import { cn } from '@/lib/utils'import { useUserStore } from '@/store/user'+import { toast } from '@/lib/toast'import NotificationPanel from '@/components/notification/NotificationPanel'import SettingsModal, { type SettingsTab } from '@/components/SettingsModal'+import AddAccountModal from '@/app/[lng]/accounts/components/AddAccountModal'import { routerData } from '@/app/layout/routerData'import {LogoSection,@@ -23,6 +26,86 @@ import {import { AffiliatesEntry } from './components/BottomSection/AffiliatesEntry'import { useSettingsModalStore } from '@/components/SettingsModal/store'+// GitHub 配置+const GITHUB_REPO = 'yikart/AiToEarn'+const DOCS_URL = 'https://docs.aitoearn.ai'++/**+ * 外部链接组件 - Docs 和 GitHub+ */+function ExternalLinks({ collapsed }: { collapsed: boolean }) {+ const [starCount, setStarCount] = useState<string>('9.5k')++ 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(() => {})+ }, [])++ if (collapsed) {+ return (+ <div className="flex flex-col items-center gap-1.5 pt-3 mt-2 border-t border-sidebar-border">+ <a+ href={DOCS_URL}+ target="_blank"+ rel="noopener noreferrer"+ className="flex items-center justify-center w-8 h-8 rounded-md text-muted-foreground/70 hover:bg-accent hover:text-foreground transition-colors"+ title="Docs"+ >+ <BookOpen className="w-3.5 h-3.5" />+ </a>+ <a+ href={`https://github.com/${GITHUB_REPO}`}+ target="_blank"+ rel="noopener noreferrer"+ className="flex items-center justify-center w-8 h-8 rounded-md text-muted-foreground/70 hover:bg-accent hover:text-foreground transition-colors"+ title={`GitHub Stars: ${starCount}`}+ >+ <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>+ </a>+ </div>+ )+ }++ return (+ <div className="flex items-center justify-center gap-3 pt-3 mt-2 border-t border-sidebar-border">+ <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-[11px] font-medium text-muted-foreground/80 hover:bg-accent hover:text-foreground hover:border-border transition-all"+ >+ <BookOpen className="w-3 h-3" />+ 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-[11px] font-medium text-muted-foreground/80 hover:bg-accent hover:text-foreground transition-colors">+ <svg className="w-3 h-3" 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-[11px] font-semibold text-muted-foreground bg-accent/30 border-l border-border/60">+ {starCount}+ </span>+ </a>+ </div>+ )+}+/*** 侧边栏主组件*/@@ -35,6 +118,7 @@ const LayoutSidebar = () => {// UI 状态const [collapsed, setCollapsed] = useState(false)const [notificationVisible, setNotificationVisible] = useState(false)+ const [addAccountVisible, setAddAccountVisible] = useState(false)const {settingsVisible,settingsDefaultTab,@@ -73,6 +157,16 @@ const LayoutSidebar = () => {closeSettings()}+ // 打开添加账号弹窗+ const handleAddChannel = () => {+ if (!token) {+ toast.warning('请先登录')+ router.push('/auth/login')+ return+ }+ setAddAccountVisible(true)+ }+// 转换路由数据为 NavSection 所需格式const navItems = routerData.map(item => ({path: item.path || '/',@@ -99,6 +193,7 @@ const LayoutSidebar = () => {items={navItems}currentRoute={currRouter}collapsed={collapsed}+ onAddChannel={handleAddChannel}/>{/* 推广赚钱入口 - 在底部功能区横线上方 */}@@ -127,6 +222,9 @@ const LayoutSidebar = () => {onLogin={handleLogin}onOpenSettings={handleOpenSettings}/>++ {/* 外部链接 - Docs 和 GitHub */}+ <ExternalLinks collapsed={collapsed} /></aside>{/* 通知面板 */}@@ -141,6 +239,17 @@ const LayoutSidebar = () => {onClose={handleCloseSettings}defaultTab={settingsDefaultTab}/>++ {/* 添加账号弹窗 */}+ <AddAccountModal+ open={addAccountVisible}+ onClose={() => setAddAccountVisible(false)}+ onAddSuccess={() => {+ setAddAccountVisible(false)+ toast.success('账号添加成功')+ }}+ showSpaceSelector={true}+ /></>)}diff --git a/project/web/src/app/layout/routerData.tsx b/project/web/src/app/layout/routerData.tsxindex 4d8f7662..ce3d5379 100644--- a/project/web/src/app/layout/routerData.tsx+++ b/project/web/src/app/layout/routerData.tsx@@ -51,12 +51,7 @@ export const routerData: IRouterDataItem[] = [path: '/interactiveNew',icon: <MessageCircle size={20} />,},- {- name: '任务中心',- translationKey: 'tasks',- path: '/tasks',- icon: <ListTodo size={20} />,- },+ // Tasks (任务中心) 已移至站内信通知面板中{name: '数据统计',translationKey: 'dataStatistics',diff --git a/project/web/src/components/Home/HomeChat/index.tsx b/project/web/src/components/Home/HomeChat/index.tsxindex 93fcd2c2..2f62776d 100644--- a/project/web/src/components/Home/HomeChat/index.tsx+++ b/project/web/src/components/Home/HomeChat/index.tsx@@ -1,7 +1,6 @@/*** HomeChat - 首页Chat组件* 功能:大尺寸聊天输入框,使用全局 AgentStore 发起 SSE 任务,获取 taskId 后跳转到对话详情页- * 支持外部传入提示词和图片(如从 PromptGallery 一键应用)*/'use client'@@ -16,25 +15,14 @@ import { useAgentStore } from '@/store/agent'import { useMediaUpload } from '@/hooks/useMediaUpload'import { toast } from '@/lib/toast'import { cn } from '@/lib/utils'-import { AccountPlatInfoArr, PlatType } from '@/app/config/platConfig'-import logo from '@/assets/images/logo.png'--/** 应用的提示词数据 */-export interface IAppliedPrompt {- prompt: string- image?: string- mode: 'edit' | 'generate'-}+import { AccountPlatInfoArr } from '@/app/config/platConfig'+import AddAccountModal from '@/app/[lng]/accounts/components/AddAccountModal'export interface IHomeChatProps {/** 登录检查回调 */onLoginRequired?: () => void/** 自定义类名 */className?: string- /** 外部应用的提示词(从 PromptGallery 一键应用) */- appliedPrompt?: IAppliedPrompt | null- /** 提示词已处理完成的回调 */- onAppliedPromptHandled?: () => void}/**@@ -43,22 +31,23 @@ export interface IHomeChatProps {export function HomeChat({onLoginRequired,className,- appliedPrompt,- onAppliedPromptHandled,}: IHomeChatProps) {const { t } = useTransClient('chat')const { t: tHome } = useTransClient('home')const router = useRouter()const { lng } = useParams()- // 状态- const [inputValue, setInputValue] = useState('')+ // 获取默认提示文本+ const defaultPrompt = t('input.placeholder' as any) || 'Help me create a cat dancing video and post it directly on YouTube'++ // 状态 - 默认显示提示文本+ const [inputValue, setInputValue] = useState(defaultPrompt)const [isSubmitting, setIsSubmitting] = useState(false)+ const [addAccountVisible, setAddAccountVisible] = useState(false)// 使用媒体上传 Hookconst {medias,- setMedias,isUploading,handleMediasChange,handleMediaRemove,@@ -67,32 +56,6 @@ export function HomeChat({onError: () => toast.error(t('media.uploadFailed' as any)),})- /**- * 处理外部应用的提示词(从 PromptGallery 一键应用)- */- useEffect(() => {- if (appliedPrompt) {- // 设置提示词到输入框- setInputValue(appliedPrompt.prompt)-- // 如果是编辑模式且有图片,添加到媒体列表- if (appliedPrompt.mode === 'edit' && appliedPrompt.image) {- setMedias([- {- url: appliedPrompt.image,- type: 'image',- },- ])- }-- // 通知父组件已处理完成- onAppliedPromptHandled?.()-- // 显示提示- toast.success('提示词已应用,可直接发送或修改后发送')- }- }, [appliedPrompt, setMedias, onAppliedPromptHandled])-// 全局 Storeconst { createTask, setActionContext } = useAgentStore()@@ -147,20 +110,10 @@ export function HomeChat({return (<div className={cn('w-full max-w-3xl mx-auto', className)}>{/* 标题区域 */}- <div className="text-center mb-6">- <div className="inline-flex items-center gap-3 mb-3">- <Image- src={logo}- alt="AiToEarn"- width={56}- height={56}- className="w-14 h-14 object-contain"- />- <span className="text-foreground font-bold text-3xl">AiToEarn</span>- </div>- <p className="text-base text-muted-foreground">+ <div className="text-center mb-6 px-4">+ <h1 className="text-2xl sm:text-3xl md:text-4xl text-foreground font-semibold leading-relaxed">{tHome('agentGenerator.subtitle' as any) || t('home.subtitle' as any)}- </p>+ </h1></div>{/* 聊天输入框 */}@@ -173,48 +126,39 @@ export function HomeChat({onMediaRemove={handleMediaRemove}isGenerating={isSubmitting}isUploading={isUploading}- placeholder={t('input.placeholder' as any)}+ placeholder=""mode="large"-/>{/* 平台工具链接提示 */}<div- className="flex items-center justify-between gap-2 mb-2"+ className="flex items-center gap-3 mb-2 cursor-pointer"style={{backgroundColor: '#F2F2F1',borderBottomLeftRadius: '10px',borderBottomRightRadius: '10px',- paddingTop: '20px',- paddingBottom: '8px',+ paddingTop: '16px',+ paddingBottom: '12px',paddingLeft: '16px',paddingRight: '16px',marginTop: '-12px',- zIndex: -1,+ position: 'relative',}}+ onClick={() => setAddAccountVisible(true)}>- <span- className="text-sm text-muted-foreground self-start pt-1"- style={{ zIndex: 10, position: 'relative', marginRight: '-8px' }}- >+ <span className="text-sm text-muted-foreground whitespace-nowrap">{t('home.connectTools' as any)}</span>- <div className="flex items-center">- {AccountPlatInfoArr.map(([key, value], index) => (+ <div className="flex items-center gap-1.5 flex-wrap">+ {AccountPlatInfoArr.map(([key, value]) => (<Imagekey={key}src={value.icon}alt={value.name}- width={20}- height={20}- className="w-6 h-6 rounded-full object-contain cursor-pointer hover:opacity-80 transition-opacity"- style={{- marginLeft: index > 0 ? '-8px' : '0',- zIndex: AccountPlatInfoArr.length - index,- position: 'relative',- }}+ width={24}+ height={24}+ className="w-6 h-6 rounded-full object-contain hover:scale-110 hover:opacity-80 transition-all"title={value.name}- onClick={() => router.push(`/${lng}/accounts?addChannel=${key}`)}/>))}</div>@@ -233,6 +177,14 @@ export function HomeChat({{t('home.enterToSend' as any)}</span></div>++ {/* 添加账号弹窗 */}+ <AddAccountModal+ open={addAccountVisible}+ onClose={() => setAddAccountVisible(false)}+ onAddSuccess={() => setAddAccountVisible(false)}+ showSpaceSelector={true}+ /></div>)}diff --git a/project/web/src/components/Home/PromptGallery/index.tsx b/project/web/src/components/Home/PromptGallery/index.tsxindex a177015a..4c008c95 100644--- a/project/web/src/components/Home/PromptGallery/index.tsx+++ b/project/web/src/components/Home/PromptGallery/index.tsx@@ -7,7 +7,7 @@'use client'import { useState, useCallback, useMemo } from 'react'-import { Sparkles, Check, ArrowRight, Grid3X3 } from 'lucide-react'+import { Check, ArrowRight, Grid3X3 } from 'lucide-react'import { useTransClient } from '@/app/i18n/client'import { Button } from '@/components/ui/button'import { cn } from '@/lib/utils'@@ -69,23 +69,6 @@ export default function PromptGallery({return (<section className={cn('py-12 px-4 md:px-6 lg:px-8', className)}><div className="max-w-[1920px] mx-auto">- {/* 标题区域 */}- <div className="text-center mb-10">- <div className="inline-flex items-center gap-2 px-4 py-2 bg-muted text-foreground rounded-full text-sm font-medium mb-4">- <Sparkles className="w-4 h-4" />- {t('badge')}- </div>- <h2 className="text-3xl md:text-4xl font-bold text-foreground mb-3">- {t('title')}{' '}- <span className="text-muted-foreground">- {t('titleHighlight')}- </span>- </h2>- <p className="text-muted-foreground text-lg max-w-2xl mx-auto">- {t('subtitle')}- </p>- </div>-{/* 精选卡片网格 - 固定8个,等高对齐 */}<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-5 mb-10">{featuredPrompts.map((item, index) => (diff --git a/project/web/src/components/common/DownloadAppModal.tsx b/project/web/src/components/common/DownloadAppModal.tsxindex b777dc77..7d46210d 100644--- a/project/web/src/components/common/DownloadAppModal.tsx+++ b/project/web/src/components/common/DownloadAppModal.tsx@@ -7,13 +7,10 @@import { useState } from 'react'import Image from 'next/image'-import { Check, Copy, Download, Puzzle, Smartphone } from 'lucide-react'-import { QRCode } from 'react-qrcode-logo'-import { toast } from '@/lib/toast'+import { Download, Puzzle, Smartphone } from 'lucide-react'import { Modal } from '@/components/ui/modal'import { Button } from '@/components/ui/button'import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'-import { getMainAppDownloadUrlSync } from '@/app/config/appDownloadConfig'import { useTransClient } from '@/app/i18n/client'import { PluginDownloadContent } from '@/components/Plugin/PluginDownloadContent'import logo from '@/assets/images/logo.png'@@ -49,117 +46,63 @@ interface DownloadAppModalProps {export default function DownloadAppModal({visible,onClose,- platform = '',- downloadUrl,- qrCodeUrl = '',zIndex = 1000,showPluginTab = false,defaultTab = 'app',pluginStatus = 'not_installed',onCheckPermission,}: DownloadAppModalProps) {- const { t } = useTransClient('common')const { t: tPlugin } = useTransClient('plugin')- const [copySuccess, setCopySuccess] = useState(false)const [activeTab, setActiveTab] = useState(defaultTab)- const actualDownloadUrl = downloadUrl || getMainAppDownloadUrlSync()-- const handleDownload = () => {- window.open(actualDownloadUrl, '_blank')- }-- const handleCopyLink = async () => {- try {- await navigator.clipboard.writeText(actualDownloadUrl)- setCopySuccess(true)- toast.success(t('downloadApp.copySuccess' as any))- setTimeout(() => setCopySuccess(false), 2000)- }- catch {- toast.error(t('downloadApp.copyFailed' as any))- }- }+ // 多平台下载链接 - 统一跳转到下载页面+ const downloadPageUrl = 'https://docs.aitoearn.ai/en/downloads'/** 渲染 App 下载内容 */const renderAppContent = () => (- <div className="flex flex-col items-center px-4 py-6">- {/* 描述 */}- <p- className="mb-6 text-center text-sm leading-relaxed text-muted-foreground"- dangerouslySetInnerHTML={{- __html: t('downloadApp.operationDescription' as any, { platform }),- }}- />-- {/* 二维码区域 */}- <div className="mb-8 rounded-xl border border-border bg-muted/50 p-5">- {qrCodeUrl ? (- <img- src={qrCodeUrl}- alt="QR Code"- className="h-[200px] w-[200px] rounded-lg shadow-sm"- />- ) : (- <QRCode- value={actualDownloadUrl}- size={200}- logoImage={logo.src}- logoWidth={20}- logoHeight={20}- logoPadding={5}- logoPaddingStyle="square"- logoOpacity={0.95}- qrStyle="dots"- eyeRadius={0}- />- )}- </div>-- {/* 下载链接区域 */}- <div className="mb-6 w-full rounded-lg border border-border bg-muted/30 p-4">- <p className="mb-2 text-xs text-muted-foreground">- {t('downloadApp.downloadLink')}- </p>- <div className="flex items-center justify-between gap-3">- <span className="flex-1 break-all text-left text-xs text-foreground">- {actualDownloadUrl}- </span>- <Button- variant={copySuccess ? 'default' : 'outline'}- size="sm"- onClick={handleCopyLink}- className="shrink-0"- >- {copySuccess ? (- <>- <Check className="mr-1.5 h-3.5 w-3.5" />- {t('downloadApp.copied' as any)}- </>- ) : (- <>- <Copy className="mr-1.5 h-3.5 w-3.5" />- {t('downloadApp.copy' as any)}- </>- )}- </Button>- </div>- </div>-- {/* 提示信息 */}- <div className="w-full rounded-lg border border-blue-200 bg-blue-50 p-4 dark:border-blue-900/50 dark:bg-blue-950/30">- <p className="text-center text-sm text-blue-700 dark:text-blue-400">- {t('downloadApp.tip')}- </p>- </div>-- {/* 下载按钮(仅在不显示插件 Tab 时在内容区显示) */}- {!showPluginTab && (- <Button onClick={handleDownload} className="mt-6 w-full" size="lg">- <Download className="mr-2 h-4 w-4" />- {t('downloadApp.downloadNow' as any)}+ <div className="flex flex-col items-center px-4 py-4">+ {/* 多平台下载按钮 */}+ <div className="w-full grid grid-cols-1 gap-3">+ <Button+ onClick={() => window.open(downloadPageUrl, '_blank')}+ variant="outline"+ className="w-full h-12 justify-start gap-3 text-left"+ size="lg"+ >+ <svg className="h-5 w-5" viewBox="0 0 24 24" fill="currentColor">+ <path d="M0 3.449L9.75 2.1v9.451H0m10.949-9.602L24 0v11.4H10.949M0 12.6h9.75v9.451L0 20.699M10.949 12.6H24V24l-12.9-1.801"/>+ </svg>+ <span className="flex-1">Windows</span>+ <Download className="h-4 w-4 text-muted-foreground" /></Button>- )}++ <Button+ onClick={() => window.open(downloadPageUrl, '_blank')}+ variant="outline"+ className="w-full h-12 justify-start gap-3 text-left"+ size="lg"+ >+ <svg className="h-5 w-5" viewBox="0 0 24 24" fill="currentColor">+ <path d="M18.71 19.5c-.83 1.24-1.71 2.45-3.05 2.47-1.34.03-1.77-.79-3.29-.79-1.53 0-2 .77-3.27.82-1.31.05-2.3-1.32-3.14-2.53C4.25 17 2.94 12.45 4.7 9.39c.87-1.52 2.43-2.48 4.12-2.51 1.28-.02 2.5.87 3.29.87.78 0 2.26-1.07 3.81-.91.65.03 2.47.26 3.64 1.98-.09.06-2.17 1.28-2.15 3.81.03 3.02 2.65 4.03 2.68 4.04-.03.07-.42 1.44-1.38 2.83M13 3.5c.73-.83 1.94-1.46 2.94-1.5.13 1.17-.34 2.35-1.04 3.19-.69.85-1.83 1.51-2.95 1.42-.15-1.15.41-2.35 1.05-3.11z"/>+ </svg>+ <span className="flex-1">macOS</span>+ <Download className="h-4 w-4 text-muted-foreground" />+ </Button>++ <Button+ onClick={() => window.open(downloadPageUrl, '_blank')}+ variant="outline"+ className="w-full h-12 justify-start gap-3 text-left"+ size="lg"+ >+ <svg className="h-5 w-5" viewBox="0 0 24 24" fill="currentColor">+ <path d="M17.6 9.48l1.84-3.18c.16-.31.04-.69-.26-.85-.29-.15-.65-.06-.83.22l-1.88 3.24c-1.45-.66-3.08-1.03-4.84-1.03-1.76 0-3.39.37-4.84 1.03L4.95 5.67c-.18-.28-.54-.37-.83-.22-.3.16-.42.54-.26.85L5.7 9.48C3.32 10.78 1.7 13 1.21 15.65h21.58C22.3 13 20.68 10.78 17.6 9.48M7 13.5c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1m10 0c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1"/>+ <path d="M5.5 17h1v5h-1zm12 0h1v5h-1zm-10 0h9v5h-9z"/>+ </svg>+ <span className="flex-1">Android</span>+ <Download className="h-4 w-4 text-muted-foreground" />+ </Button>+ </div></div>)diff --git a/project/web/src/components/notification/NotificationPanel.tsx b/project/web/src/components/notification/NotificationPanel.tsxindex 2037e157..77ec648f 100644--- a/project/web/src/components/notification/NotificationPanel.tsx+++ b/project/web/src/components/notification/NotificationPanel.tsx@@ -9,8 +9,8 @@ import type { NotificationItem, TaskItem } from '@/api/notification'import type { SocialAccount } from '@/api/types/account.type'// 平台配置(图标等)import type { PlatType } from '@/app/config/platConfig'-import { CheckOutlined, ClockCircleOutlined, DeleteOutlined } from '@ant-design/icons'-import { Badge, Button, Empty, List, Popconfirm, Spin, Steps, Tag } from 'antd'+import { CheckOutlined, ClockCircleOutlined, DeleteOutlined, UnorderedListOutlined } from '@ant-design/icons'+import { Badge, Button, Empty, List, Popconfirm, Spin, Steps, Tag, Tabs } from 'antd'import { toast } from '@/lib/toast'import { Modal } from '@/components/ui/modal'import { useParams, useRouter } from 'next/navigation'@@ -757,6 +757,56 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClosewidth={700}destroyOnClose>+ {/* 任务中心入口 */}+ <div+ style={{+ marginBottom: '16px',+ padding: '12px 16px',+ background: 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)',+ borderRadius: '12px',+ cursor: 'pointer',+ display: 'flex',+ alignItems: 'center',+ justifyContent: 'space-between',+ transition: 'all 0.3s ease',+ }}+ onClick={() => {+ router.push(`/${lng}/tasks`)+ onClose()+ }}+ onMouseEnter={(e) => {+ e.currentTarget.style.transform = 'translateY(-2px)'+ e.currentTarget.style.boxShadow = '0 8px 25px rgba(102, 126, 234, 0.4)'+ }}+ onMouseLeave={(e) => {+ e.currentTarget.style.transform = 'translateY(0)'+ e.currentTarget.style.boxShadow = 'none'+ }}+ >+ <div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>+ <div style={{+ width: '40px',+ height: '40px',+ background: 'rgba(255,255,255,0.2)',+ borderRadius: '10px',+ display: 'flex',+ alignItems: 'center',+ justifyContent: 'center',+ }}>+ <UnorderedListOutlined style={{ fontSize: '20px', color: 'white' }} />+ </div>+ <div>+ <div style={{ color: 'white', fontWeight: '600', fontSize: '15px' }}>+ {t('taskCenter' as any) || '任务中心'}+ </div>+ <div style={{ color: 'rgba(255,255,255,0.8)', fontSize: '12px' }}>+ {t('taskCenterDesc' as any) || '查看和管理您的任务'}+ </div>+ </div>+ </div>+ <div style={{ color: 'white', fontSize: '20px' }}>→</div>+ </div>+<Spin spinning={loading}>{notifications.length > 0? (diff --git a/project/web/src/components/ui/dialog.tsx b/project/web/src/components/ui/dialog.tsxindex 2c1d5d48..5da12cb9 100644--- a/project/web/src/components/ui/dialog.tsx+++ b/project/web/src/components/ui/dialog.tsx@@ -38,7 +38,7 @@ const DialogContent = React.forwardRef<<DialogPrimitive.Contentref={ref}className={cn(- "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-2xl duration-500 ease-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-xl",+ "fixed left-[50%] top-[50%] z-50 grid w-[calc(100%-24px)] sm:w-full sm:max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-4 sm:p-6 shadow-2xl duration-500 ease-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 rounded-xl",className)}{...props}diff --git a/project/web/src/components/ui/modal.tsx b/project/web/src/components/ui/modal.tsxindex be3ce9bd..58b984c1 100644--- a/project/web/src/components/ui/modal.tsx+++ b/project/web/src/components/ui/modal.tsx@@ -91,8 +91,9 @@ export const Modal: React.FC<ModalProps> = ({zIndex,}) => {// 处理宽度 - 'auto' 或 undefined 时不设置内联宽度,让 CSS 控制+ // 使用 CSS 变量来允许媒体查询覆盖const shouldSetWidthStyle = width !== 'auto' && width !== undefined- const widthStyle = typeof width === 'number' ? `${width}px` : width+ const widthValue = typeof width === 'number' ? `${width}px` : width// 如果 destroyOnClose 为 true 且 modal 关闭,不渲染 childrenconst shouldRenderContent = destroyOnClose ? open : true@@ -126,13 +127,18 @@ export const Modal: React.FC<ModalProps> = ({<DialogContentclassName={cn('max-h-[90vh] overflow-hidden flex flex-col',+ // 移动端响应式宽度+ 'w-[calc(100vw-24px)] sm:w-auto',!closable && '[&>button]:hidden',className,)}style={{- ...(shouldSetWidthStyle ? { width: widthStyle, maxWidth: widthStyle } : {}),+ // 使用 CSS 变量,允许媒体查询覆盖+ '--modal-width': shouldSetWidthStyle ? widthValue : undefined,+ width: shouldSetWidthStyle ? 'min(var(--modal-width), calc(100vw - 24px))' : undefined,+ maxWidth: shouldSetWidthStyle ? 'min(var(--modal-width), calc(100vw - 24px))' : undefined,...(zIndex ? { zIndex } : {}),- }}+ } as React.CSSProperties}onInteractOutside={handleInteractOutside}onEscapeKeyDown={!closable ? (e) => e.preventDefault() : undefined}aria-describedby={title ? undefined : undefined}@@ -156,7 +162,7 @@ export const Modal: React.FC<ModalProps> = ({)}{shouldRenderContent && (- <div className={cn('flex-1 py-2 flex', bodyClassName)}>+ <div className={cn('flex-1 py-2 w-full', bodyClassName)}>{children}</div>)}