import { Template } from "interface/template"; import { Container, Heading, Text, Box, Flex, Card, Button, TextField, ScrollArea, Dialog, Tabs, } from "@radix-ui/themes"; import { PlusIcon, MagnifyingGlassIcon, CodeIcon, CheckIcon, Cross2Icon, DownloadIcon, GearIcon, } from "@radix-ui/react-icons"; import { useState } from "react"; import type { ThemeConfig } from "interface/theme"; // 模拟主题数据 const mockThemes: (ThemeConfig & { id: number; preview: string; active: boolean; })[] = [ { id: 1, name: "echoes", displayName: "Echoes", version: "1.0.0", description: "默认主题", author: "Admin", preview: "https://images.unsplash.com/photo-1481487196290-c152efe083f5?w=500&auto=format", templates: new Map(), configuration: { theme: { title: "主题配置", description: "Echoes主题配置项", data: { colors: { mode: "light", layout: "default", }, }, }, }, routes: new Map(), active: true, }, { id: 2, name: "minimal", displayName: "Minimal", version: "1.0.0", description: "简约风格主题", author: "Admin", preview: "https://images.unsplash.com/photo-1618005198919-d3d4b5a92ead?w=500&auto=format", templates: new Map(), configuration: { theme: { title: "主题配置", description: "Echoes主题配置项", data: { colors: { mode: "light", layout: "default", }, }, }, }, routes: new Map(), active: false, }, ]; export default new Template({}, ({ http, args }) => { const [searchTerm, setSearchTerm] = useState(""); const [isAddDialogOpen, setIsAddDialogOpen] = useState(false); const [selectedTheme, setSelectedTheme] = useState< (typeof mockThemes)[0] | null >(null); return ( {/* 页面标题和操作栏 */} 主题管理 共 {mockThemes.length} 个主题 {/* 搜索栏 */} {/* 主题列表 */} {mockThemes.map((theme) => ( {/* 预览图 */} {theme.displayName} {/* 主题信息 */} {theme.displayName} {theme.active && ( 当前使用 )} 版本 {theme.version} · 作者 {theme.author} {theme.description} {/* 操作按钮 */} {theme.active ? ( ) : ( <> )} ))} {/* 安装主题对话框 */} 安装主题 请上传主题包进行安装 { console.log(e.target.files); }} /> ); });