Skip to content

smakosh/vibecoded-tetris

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Design Tool

A modern, web-based design tool built with React, TypeScript, and Canvas API. Create, edit, and manipulate shapes, text, images, and freehand drawings with a professional Figma-like interface.

Design Tool Screenshot

โœจ Features

๐ŸŽจ Drawing Tools

  • Rectangle Tool: Create and resize rectangles with customizable fill and stroke
  • Circle Tool: Draw perfect circles with adjustable radius
  • Text Tool: Add and edit text with real-time property updates
  • Image Tool: Upload and manipulate images with auto-resizing and aspect ratio preservation
  • Pen Tool: Freehand drawing with smooth path rendering
  • Selection Tool: Select, move, and modify any object

๐ŸŽฏ Professional Interface

  • Figma-like Layout: Left sidebar for tools and layers, right sidebar for properties
  • Layer Management: Visual layer panel with proper naming and selection
  • Properties Panel: Comprehensive controls for position, size, appearance, and more
  • Editable Project Title: Click to rename your project

โšก Advanced Functionality

  • Undo/Redo System: Full history management with Ctrl+Z/Cmd+Z shortcuts
  • Copy/Paste/Duplicate: Standard shortcuts (Ctrl+C, Ctrl+V, Ctrl+D)
  • Keyboard Shortcuts: Professional shortcuts matching design tool conventions
  • Real-time Updates: Smooth interactions with optimized performance
  • Cross-platform: Works on Windows, macOS, and Linux

๐ŸŽ›๏ธ Shape Manipulation

  • Drag & Drop: Move objects around the canvas
  • Resize Handles: Visual resize handles for rectangles and images
  • Proportional Scaling: Hold Shift for aspect ratio preservation
  • Property Controls: Fine-tune position, size, colors, opacity, and rotation
  • Selection Feedback: Clear visual indicators for selected objects

๐Ÿš€ Getting Started

Prerequisites

  • Node.js 18+
  • pnpm (recommended) or npm

Installation

  1. Clone the repository

    git clone <repository-url>
    cd design-tool
  2. Install dependencies

    pnpm install
    # or
    npm install
  3. Start the development server

    pnpm dev
    # or
    npm run dev
  4. Open your browser Navigate to http://localhost:5173

๐ŸŽฎ Usage

Basic Workflow

  1. Select a tool from the left sidebar
  2. Create shapes by clicking and dragging on the canvas
  3. Select objects using the selection tool
  4. Modify properties in the right sidebar
  5. Use keyboard shortcuts for efficient workflow

Keyboard Shortcuts

Action Windows/Linux macOS
Undo Ctrl + Z Cmd + Z
Redo Ctrl + Shift + Z or Ctrl + Y Cmd + Shift + Z or Cmd + Y
Copy Ctrl + C Cmd + C
Paste Ctrl + V Cmd + V
Duplicate Ctrl + D Cmd + D
Delete Delete or Backspace Delete or Backspace

Tools Guide

Rectangle Tool

  • Click and drag to create rectangles
  • Use resize handles to adjust size
  • Hold Shift while resizing for proportional scaling

Circle Tool

  • Click and drag to create circles
  • Radius adjusts based on drag distance

Text Tool

  • Click to place text
  • Edit content in the properties panel
  • Customize font color and appearance

Image Tool

  • Click to open file picker
  • Supports all common image formats
  • Auto-resizes large images while preserving aspect ratio

Pen Tool

  • Click and drag to draw freehand
  • Creates smooth vector paths
  • Customizable stroke width and color

๐Ÿ—๏ธ Technical Architecture

Tech Stack

  • Frontend: React 18 + TypeScript
  • Routing: TanStack Router
  • State Management: Zustand
  • Styling: Tailwind CSS + shadcn/ui
  • Canvas: Native HTML5 Canvas API
  • Build Tool: Vite

Project Structure

src/
โ”œโ”€โ”€ components/          # React components
โ”‚   โ”œโ”€โ”€ Canvas.tsx      # Main canvas component
โ”‚   โ”œโ”€โ”€ LeftSidebar.tsx # Tools and layers panel
โ”‚   โ”œโ”€โ”€ RightSidebar.tsx# Properties panel
โ”‚   โ””โ”€โ”€ ui/             # shadcn/ui components
โ”œโ”€โ”€ store/              # Zustand store
โ”‚   โ””โ”€โ”€ drawingStore.ts # Main application state
โ”œโ”€โ”€ routes/             # TanStack Router routes
โ””โ”€โ”€ types/              # TypeScript type definitions

Key Design Decisions

Canvas API over Libraries

  • Why: Avoided react-konva and fabric.js due to dependency conflicts
  • Benefit: Full control, better performance, no external dependencies
  • Trade-off: More manual implementation but greater stability

Zustand for State Management

  • Why: Lightweight, TypeScript-friendly, minimal boilerplate
  • Benefit: Simple API, excellent performance, easy testing
  • Features: History management, real-time updates, action batching

Native Image Handling

  • Why: Avoided canvas.node native dependencies
  • Benefit: Works in all environments, no build complications
  • Implementation: FileReader API + Image caching system

๐Ÿ”ง Development

Available Scripts

# Development
pnpm dev          # Start dev server
pnpm build        # Build for production
pnpm preview      # Preview production build
pnpm lint         # Run ESLint
pnpm type-check   # Run TypeScript checks

Code Style

  • TypeScript: Strict mode enabled
  • ESLint: Standard configuration
  • Prettier: Automatic formatting
  • Conventions: React functional components, custom hooks

Performance Optimizations

  • Image Caching: Prevents redundant image loading
  • Real-time Updates: Separate functions for smooth interactions
  • History Batching: Prevents excessive undo/redo entries
  • Canvas Optimization: Efficient redraw cycles

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open a Pull Request

Development Guidelines

  • Follow TypeScript best practices
  • Add tests for new features
  • Update documentation for API changes
  • Ensure cross-platform compatibility

๐Ÿ“ License

This project is licensed under the MIT License - see the LICENSE.md file for details.

๐Ÿ™ Acknowledgments

  • shadcn/ui for the beautiful component library
  • Lucide React for the icon set
  • TanStack Router for modern routing
  • Zustand for elegant state management
  • Figma for design inspiration

๐Ÿ› Known Issues

  • Large images may take time to load initially
  • Complex pen drawings with many points may impact performance
  • Browser zoom affects canvas coordinate calculations

๐Ÿ”ฎ Roadmap

  • Layer reordering and grouping
  • More shape tools (polygons, stars, arrows)
  • Text formatting options (font family, size, weight)
  • Export functionality (PNG, SVG, PDF)
  • Collaborative editing
  • Plugin system
  • Mobile touch support

๐Ÿ“ž Support

If you encounter any issues or have questions:

  1. Check the Issues page
  2. Create a new issue with detailed description
  3. Include browser version and steps to reproduce

Built with โค๏ธ using modern web technologies

About

A modern, web-based design tool built with React, TypeScript, and Canvas API. Create, edit, and manipulate shapes, text, images, and freehand drawings with a professional Figma-like interface.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors