import { PlusOutlined, } from "@ant-design/icons"; import { ProConfigProvider, ProLayout, } from "@ant-design/pro-components"; import { css } from "@emotion/css"; import { Space, Button, ConfigProvider, Popover, } from "antd"; import React, { useMemo, useRef, useState } from "react"; import logo from "@/assets/logo.png"; import { Icon } from "umi"; import { createNew } from "@/utils"; import All from "./All"; import Recently from "./Recently"; import Collect from "./Collect"; import Template from "./Template"; import { GraphType } from "@/enum"; export default () => { const currentFolder = useRef('root'); const basicGraph = [ { id: "1", title: "流程图", subtitle: "图形化表单方式", color: "#dfecff", icon: , onClick: () => createNew(GraphType.flowchart, currentFolder.current), }, { id: "2", title: "思维导图", subtitle: "结构化表单方式", color: "#dff4ea", icon: , onClick: () => createNew(GraphType.mindmap, currentFolder.current), }, ]; const appList = [ { id: "1", title: "UML", icon: , onClick: () => createNew(GraphType.uml, currentFolder.current), }, { id: "2", title: "E-R图", icon: , onClick: () => createNew(GraphType.er, currentFolder.current), }, { id: "3", title: "泳道图", icon: , onClick: () => createNew(GraphType.lane, currentFolder.current), }, { id: "4", title: "BPMN", icon: , onClick: () => createNew(GraphType.bpmn, currentFolder.current), }, { id: "5", title: "韦恩图", icon: , onClick: () => createNew(GraphType.venn, currentFolder.current), }, { id: "6", title: "网络拓扑图", icon: , onClick: () => createNew(GraphType.net, currentFolder.current), }, ]; const handleMenuClick = (item: any) => { console.log("click", item); item?.onClick?.(); }; const renderBasicItem = (props: { title: string; subtitle: string; color: string; id: string; icon: React.ReactNode; }) => { return (
handleMenuClick(props)} > {props.icon}
{props.title}
{props.subtitle}
); }; const renderProItem = (props: { id: string; title: string; icon: React.ReactNode; }) => { return (
handleMenuClick(props)} > {props.icon} {props.title}
); }; const RenderAppList = () => { return (
基础图形
{basicGraph.map((item) => renderBasicItem(item))}
专业图形
{appList.map((item) => renderProItem(item))}
); }; const handleChangeFolder = (id: string) => { currentFolder.current = id; } const [pathname, setPathname] = useState("/all"); const routes = [ { path: "/all", name: "全部", icon: , component: , }, { path: "/recently", name: "最近项目", icon: , component: , }, { path: "/template", name: "我的模版", icon: , component: