Skip to content

feat: 将主页面翻译为中文并移除Discord相关功能 #532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 144 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

DrawDB is a React-based database entity relationship diagram (ERD) editor that runs in the browser. It supports multiple database types (MySQL, PostgreSQL, SQLite, MariaDB, SQL Server, Oracle) and provides features for creating, editing, and exporting database schemas.

## **标准工作流程**

**每次开始一个新的复杂任务的时候,按如下工作流程进行**

1. 先理清问题,查阅代码库相关文件,把解决方案写成tasks/projectplan.md文档。
2. 文档里要列出具体待办事项,完成一项就勾掉一项。
3. 开工前先找我过一遍方案,我会把关确认。
4. 接着逐项处理待办事项,实时更新完成状态。
5. 每完成一个步骤,简单跟我同步下改了哪些内容。
6. 所有代码改动都要最小化。宁可多拆几个小改动,也别搞复杂的大改。能少动代码就少动,越简单越好。
7. 最后在tasks/projectplan.md补充"改动总结"章节,记录修改内容和相关说明。

## Development Commands

**Start development server:**
```bash
pnpm dev
```

**Build for production:**
```bash
pnpm build
```

**Lint code:**
```bash
pnpm lint
```

**Preview production build:**
```bash
pnpm preview
```

**Docker build:**
```bash
docker build -t drawdb .
docker run -p 3000:80 drawdb
```

## Architecture

### Core Structure
- **React 18** with **Vite** build system
- **React Router** for navigation between pages
- **Tailwind CSS** for styling with **Semi-UI** components
- **Framer Motion** for animations
- **i18next** for internationalization (40+ languages)

### Key Pages
- `/` - Landing page
- `/editor` - Main diagram editor
- `/templates` - Predefined templates
- `/bug-report` - Bug reporting form

### Context Architecture
The application uses React Context for state management with multiple specialized contexts:
- **DiagramContext** - Core diagram state and operations
- **CanvasContext** - Canvas rendering and interactions
- **SettingsContext** - User preferences and settings
- **UndoRedoContext** - History management
- **SelectContext** - Selection state management
- **TransformContext** - Canvas transformations (zoom, pan)
- **SaveStateContext** - Save/load state management

### Key Directories
- `src/components/` - Reusable UI components
- `src/context/` - React Context providers
- `src/hooks/` - Custom React hooks
- `src/utils/` - Utility functions for import/export
- `src/data/` - Constants, database schemas, data types
- `src/i18n/` - Internationalization files

### Database Support
- **Export formats:** SQL (multiple dialects), DBML, JSON
- **Import formats:** DBML, JSON, SQL
- **Supported databases:** MySQL, PostgreSQL, SQLite, MariaDB, SQL Server, Oracle SQL

### Key Features
- Visual table/relationship editor with drag-and-drop
- SQL generation for multiple database types
- Schema validation and issue detection
- Template system for common patterns
- Export to various formats (SQL, DBML, PNG, PDF)
- Collaborative sharing (with server setup)

## Code Conventions

### State Management
- Use appropriate context for feature-specific state
- Custom hooks in `src/hooks/` wrap context logic
- Avoid prop drilling by using contexts

### Styling
- Use Tailwind CSS classes
- Semi-UI components for complex UI elements
- Responsive design with mobile-first approach
- Custom breakpoints: 3xl, 2xl, xl, lg, md, sm

### Internationalization
- All user-facing strings must be internationalized
- Use `useTranslation` hook from react-i18next
- Translation files located in `src/i18n/locales/`

### Component Organization
- Components grouped by feature in subdirectories
- Reusable components in `src/components/`
- Page components in `src/pages/`
- Context providers in `src/context/`

## Development Notes

### Canvas System
The editor uses a custom canvas system with:
- SVG-based rendering for tables and relationships
- Custom transform matrix for zoom/pan
- Grid-based positioning system
- Drag-and-drop functionality via @dnd-kit

### Data Persistence
- Uses **Dexie** (IndexedDB wrapper) for local storage
- Schema validation with **jsonschema**
- Export utilities in `src/utils/exportAs/` and `src/utils/exportSQL/`

### Performance Considerations
- Large diagrams use virtualization techniques
- Debounced operations for frequent updates
- Memoization for expensive calculations
- Lazy loading for templates and assets

## Testing

No test suite is currently configured. When adding tests, consider:
- Unit tests for utility functions
- Integration tests for context providers
- E2E tests for critical user flows
57 changes: 32 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
<div align="center">
<sup>Special thanks to:</sup>
<br>
<a href="https://www.warp.dev/drawdb/" target="_blank">
<img alt="Warp sponsorship" width="280" src="https://github.com/user-attachments/assets/c7f141e7-9751-407d-bb0e-d6f2c487b34f">
<br>
<b>Next-gen AI-powered intelligent terminal for all platforms</b>
</a>
</div>

<br/>
<br/>

<div align="center">
<img width="64" alt="drawdb logo" src="./src/assets/icon-dark.png">
<h1>drawDB</h1>
</div>

<h3 align="center">Free, simple, and intuitive database schema editor and SQL generator.</h3>

<h3 align="center">免费、简单、直观的数据库模式编辑器和 SQL 生成器。</h3>


<div align="center" style="margin-bottom:12px;">
<a href="https://drawdb.app/" style="display: flex; align-items: center;">
Expand All @@ -30,35 +19,53 @@
</a>
</div>

<h3 align="center"><img width="700" style="border-radius:5px;" alt="demo" src="drawdb.png"></h3>
> Fork 自: [drawdb-io/drawdb](https://github.com/drawdb-io/drawdb)

<h3 align="center"><img width="700" style="border-radius:5px;" alt="demo" src="./src/assets/drawdb.png"></h3>

DrawDB 是一个强大且用户友好的数据库实体关系(DBER)编辑器,直接在浏览器中运行。只需几次点击即可构建图表,导出 SQL 脚本,自定义编辑器等,无需创建账户。查看完整功能列表请访问[这里](https://drawdb.app/)。



---
<div align="center">
<sup>特别感谢:</sup>
<br>
<a href="https://www.warp.dev/drawdb/" target="_blank">
<img alt="Warp sponsorship" width="280" src="./src/assets/warp2.png">
<br>
<b>新一代 AI 驱动的智能终端,适用于所有平台</b>
</a>
</div>
<br/>
<br/>

DrawDB is a robust and user-friendly database entity relationship (DBER) editor right in your browser. Build diagrams with a few clicks, export sql scripts, customize your editor, and more without creating an account. See the full set of features [here](https://drawdb.app/).

## Getting Started
## 快速开始

### Local Development
### 本地开发

```bash
git clone https://github.com/drawdb-io/drawdb
cd drawdb
npm install
npm run dev
pnpm install
pnpm run dev
```

### Build
### 构建

```bash
git clone https://github.com/drawdb-io/drawdb
cd drawdb
npm install
npm run build
pnpm install
pnpm run build
```

### Docker Build
### Docker 构建

```bash
docker build -t drawdb .
docker run -p 3000:80 drawdb
```

If you wish to work with sharing, set up [server](https://github.com/drawdb-io/drawdb-server) and environment variables according to `.env.sample`. This is not required unless you want to share files.
如果你想使用分享功能,请设置[服务器](https://github.com/drawdb-io/drawdb-server)并根据 `.env.sample` 配置环境变量。除非你想分享文件,否则这不是必需的。
110 changes: 99 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading