import { CameraOutlined, ClockCircleOutlined, ColumnWidthOutlined, CustomerServiceOutlined, DashboardOutlined, DeleteOutlined, EditOutlined, HighlightOutlined, SwapOutlined, ThunderboltOutlined, VideoCameraOutlined, } from "@ant-design/icons"; import type { ReactNode } from "react"; import { useCallback, useEffect, useState } from "react"; import type { WebImageWorkbenchTool, WebViewKey } from "../../types"; interface MorePageProps { onSelectView?: (view: WebViewKey) => void; onOpenImageTool?: (tool: WebImageWorkbenchTool) => void; } type ToolCategory = "image" | "video"; type FilterKey = "all" | ToolCategory | "upcoming"; interface MoreTool { id: string; title: string; text: string; icon: ReactNode; category: ToolCategory; target?: WebViewKey; imageTool?: WebImageWorkbenchTool; ready: boolean; badge?: string; featured?: boolean; } const tools: MoreTool[] = [ { id: "workbench", title: "图片工作台", text: "融合、修复、局部增强", icon: , category: "image", imageTool: "workbench", ready: true, featured: true }, { id: "inpaint", title: "局部重绘", text: "遮罩区域重新生成", icon: , category: "image", imageTool: "inpaint", ready: true }, { id: "camera", title: "镜头实验室", text: "角度、焦段和机位控制", icon: , category: "image", imageTool: "camera", ready: true }, { id: "upscale", title: "分辨率提升", text: "图片与视频高清超分", icon: , category: "image", target: "resolutionUpscale", ready: true }, { id: "watermarkRemoval", title: "去水印", text: "AI 智能去除图片水印和文字", icon: , category: "image", target: "watermarkRemoval", ready: true }, { id: "subtitleRemoval", title: "字幕去除", text: "AI 智能擦除视频字幕", icon: , category: "video", target: "subtitleRemoval", ready: true }, { id: "digitalHuman", title: "数字人", text: "参考人像与音频生成口播视频", icon: , category: "video", target: "digitalHuman", ready: true, featured: true }, { id: "characterMix", title: "角色迁移", text: "人物图迁移到参考视频动作", icon: , category: "video", target: "characterMix", ready: true }, { id: "avatarConsole", title: "数字人控制台", text: "形象、播报、互动与接入配置", icon: , category: "video", target: "avatarConsole", ready: true }, ]; interface FeaturedTool { id: string; title: string; desc: string; icon: ReactNode; imageTool?: WebImageWorkbenchTool; target?: WebViewKey; category: ToolCategory; gradient: string; } const featuredTools: FeaturedTool[] = [ { id: "workbench", title: "图片工作台", desc: "融合、修复、局部增强 — 一站式图片创作", icon: , imageTool: "workbench", category: "image", gradient: "linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.06))", }, { id: "digitalHuman", title: "数字人", desc: "参考人像与音频,一键生成口播视频", icon: , target: "digitalHuman", category: "video", gradient: "linear-gradient(135deg, rgba(13, 148, 136, 0.12), rgba(6, 182, 212, 0.06))", }, ]; const categoryLabels: Record = { image: "图像创作", video: "视频生成", }; const categoryIcons: Record = { image: , video: , }; const filters: { key: FilterKey; label: string }[] = [ { key: "all", label: "全部" }, { key: "image", label: "图像" }, { key: "video", label: "视频" }, { key: "upcoming", label: "即将上线" }, ]; const RECENT_STORAGE_KEY = "omniai:more-recent-tools"; const MAX_RECENT = 4; function getRecentToolIds(): string[] { try { const raw = localStorage.getItem(RECENT_STORAGE_KEY); return raw ? JSON.parse(raw) : []; } catch { return []; } } function pushRecentToolId(id: string) { const ids = getRecentToolIds().filter((x) => x !== id); ids.unshift(id); localStorage.setItem(RECENT_STORAGE_KEY, JSON.stringify(ids.slice(0, MAX_RECENT))); } function MorePage({ onSelectView, onOpenImageTool }: MorePageProps) { const [filter, setFilter] = useState("all"); const [recentIds, setRecentIds] = useState(getRecentToolIds); useEffect(() => { setRecentIds(getRecentToolIds()); }, []); const openTool = useCallback((tool: MoreTool) => { if (!tool.ready) return; pushRecentToolId(tool.id); setRecentIds(getRecentToolIds()); if (tool.imageTool && onOpenImageTool) { onOpenImageTool(tool.imageTool); return; } if (tool.target && onSelectView) { onSelectView(tool.target); } }, [onOpenImageTool, onSelectView]); const filteredTools = tools.filter((t) => { if (t.featured) return false; if (filter === "all") return true; if (filter === "upcoming") return !t.ready; return t.category === filter; }); const recentTools = recentIds .map((id) => tools.find((t) => t.id === id)) .filter((t): t is MoreTool => Boolean(t) && (t?.ready ?? false)); const groupedTools = filteredTools.reduce>((acc, t) => { if (!acc[t.category]) acc[t.category] = []; acc[t.category].push(t); return acc; }, {} as Record); return (

工具盒

{recentTools.length > 0 && filter === "all" && (

最近使用

{recentTools.map((tool) => ( ))}
)} {filter === "all" && (

核心工具

{featuredTools.map((tool) => ( ))}
)} {(["image", "video", "template"] as ToolCategory[]).map((cat) => { const group = groupedTools[cat]; if (!group || group.length === 0) return null; return (

{categoryIcons[cat]} {categoryLabels[cat]}

{group.map((tool) => ( ))}
); })}
); } export default MorePage;