From 2bbfbd65c20ef4bdfa673c3d8aeecae8971294de Mon Sep 17 00:00:00 2001 From: Jingchao Di Date: Sun, 12 May 2024 11:59:20 +0800 Subject: [PATCH] feat: husky --- .umirc.ts | 4 ++-- README.md | 4 ++-- src/pages/Home/index.tsx | 18 ++++++------------ 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/.umirc.ts b/.umirc.ts index ce8175e..e8ef0de 100644 --- a/.umirc.ts +++ b/.umirc.ts @@ -30,12 +30,12 @@ export default defineConfig({ path: 'https://twitter.com/alswl', external: true, }, - ], npmClient: 'pnpm', esbuildMinifyIIFE: true, analytics: { ga_v2: 'G-SFYS0VCR5W', // Google Analytics 的 key (GA 4) baidu: '4d80269d802b65e5b0356366f7fbb125', - } + }, + configProvider: {}, }); diff --git a/README.md b/README.md index df14916..331b832 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # dbml-editor -Online editor for [DBML](https://dbml.dbdiagram.io/home/) files. - ![build-status](https://github.com/alswl/dbml-editor/actions/workflows/ci.yaml/badge.svg) +Online editor for [DBML](https://dbml.dbdiagram.io/home/) files. + ## Online Editor [dbml-editor](https://dbml-editor.alswl.com/) diff --git a/src/pages/Home/index.tsx b/src/pages/Home/index.tsx index c57abeb..9aef2f9 100644 --- a/src/pages/Home/index.tsx +++ b/src/pages/Home/index.tsx @@ -1,22 +1,17 @@ import { DagreLayout, GridLayout } from '@antv/layout'; import { Graph, Model } from '@antv/x6'; import { Parser } from '@dbml/core'; -import { Col, Row, theme } from 'antd'; +import { Col, Row } from 'antd'; import { debounce } from 'lodash-es'; import { useEffect, useRef, useState } from 'react'; import MonacoEditor from 'react-monaco-editor'; import parseDatabaseToER from '@/parser/parser'; +import { PageContainer } from '@ant-design/pro-components'; import { Snapline } from '@antv/x6-plugin-snapline'; import './index.less'; -import { PageContainer } from '@ant-design/pro-components'; -import { useModel } from '@umijs/max'; export default () => { - // constructor - const { - token: { colorBgContainer, borderRadiusLG }, - } = theme.useToken(); const initCode = `Table users { id integer username varchar @@ -43,7 +38,7 @@ Enum post_status { Ref: posts.user_id > users.id // many-to-one `; - const [code, setCode] = useState(initCode); + const [code] = useState(initCode); const [models, setModels] = useState({}); const containerRef = useRef(null); const parser = new Parser(); @@ -106,14 +101,14 @@ Ref: posts.user_id > users.id // many-to-one }, [models]); // editorDidMount - const editorDidMount = (editor: any, monaco: any) => { + const editorDidMount = () => { const database = parser.parse(code, 'dbmlv2'); let models = parseDatabaseToER(database); setModels(layout.layout(models)); }; // onchange - const onChange = (newValue: any, e: any) => { + const onChange = (newValue: any) => { const database = parser.parse(newValue, 'dbmlv2'); console.log(database); let models = parseDatabaseToER(database); @@ -121,8 +116,7 @@ Ref: posts.user_id > users.id // many-to-one setModels(layout.layout(models)); }; const debouncedOnChange = debounce(onChange, 500); - - const { name } = useModel('global'); + // const { name } = useModel('global'); return (