From 1b165baa2dbc310fa9eff7c1303c7b6503f7c17d Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 14 Nov 2025 18:01:14 +0000 Subject: [PATCH 1/6] Add comprehensive drawing feature to mapping application Implemented a full-featured drawing toolset that allows users to draw directly on event floor plans: **New Components:** - FreehandDrawingNode: Supports freehand pen drawing with customizable stroke width and color - ShapeNode: Enables drawing of rectangles, circles, and arrows with fill/stroke options - TextAnnotationNode: Allows adding text annotations with font size and style controls - DrawingToolbar: Central toolbar with tool selection (select, freehand, shapes, text) - DrawingSettings: Unified settings panel for customizing drawn elements - UI Components: Added Checkbox and Slider components from Radix UI **Enhanced EventFlow:** - Integrated drawing mode with tool selection - Added mouse event handlers for interactive drawing (mousedown, mousemove, mouseup) - Drawing elements are fully compatible with existing undo/redo system - All drawn elements auto-save to database like other nodes - Drawn elements support all standard operations: move, delete, edit properties **Features:** - Freehand drawing with smooth SVG paths - Shape drawing (rectangles, circles, arrows) with optional fill - Text annotations with customizable font size, weight, and background - Color picker with presets for all drawing elements - Stroke width adjustment for lines and shapes - Label and notes support for all drawn elements - Real-time collaboration support (drawn elements sync via Ably) - Full integration with existing copy/paste functionality **Dependencies:** - Added @radix-ui/react-slider and @radix-ui/react-checkbox This feature enables users to annotate floor plans with custom drawings, shapes, and text, making event planning more flexible and detailed. --- components/DrawingSettings.tsx | 268 +++++++++++++++++++++++++++++ components/DrawingToolbar.tsx | 61 +++++++ components/EventFlow.tsx | 201 +++++++++++++++++++++- components/FreehandDrawingNode.tsx | 144 ++++++++++++++++ components/ShapeNode.tsx | 220 +++++++++++++++++++++++ components/TextAnnotationNode.tsx | 178 +++++++++++++++++++ components/ui/checkbox.tsx | 30 ++++ components/ui/slider.tsx | 28 +++ package.json | 2 + 9 files changed, 1130 insertions(+), 2 deletions(-) create mode 100644 components/DrawingSettings.tsx create mode 100644 components/DrawingToolbar.tsx create mode 100644 components/FreehandDrawingNode.tsx create mode 100644 components/ShapeNode.tsx create mode 100644 components/TextAnnotationNode.tsx create mode 100644 components/ui/checkbox.tsx create mode 100644 components/ui/slider.tsx diff --git a/components/DrawingSettings.tsx b/components/DrawingSettings.tsx new file mode 100644 index 0000000..eab9068 --- /dev/null +++ b/components/DrawingSettings.tsx @@ -0,0 +1,268 @@ +"use client"; + +import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; +import { Label } from "@/components/ui/label"; +import { Input } from "@/components/ui/input"; +import { Textarea } from "@/components/ui/textarea"; +import { Button } from "@/components/ui/button"; +import { Trash2, Palette } from "lucide-react"; +import { Slider } from "@/components/ui/slider"; +import { Checkbox } from "@/components/ui/checkbox"; +import { FreehandDrawingData } from "./FreehandDrawingNode"; +import { ShapeData } from "./ShapeNode"; +import { TextAnnotationData } from "./TextAnnotationNode"; + +const colorPresets = [ + "#000000", "#FF0000", "#00FF00", "#0000FF", + "#FFFF00", "#FF00FF", "#00FFFF", "#FFA500", + "#800080", "#008080", "#808080", "#FFFFFF" +]; + +interface DrawingSettingsProps { + isOpen: boolean; + setIsOpen: (open: boolean) => void; + id: string; + data: FreehandDrawingData | ShapeData | TextAnnotationData; + type: "freehand" | "shape" | "text"; + handleLabelChange: (e: React.ChangeEvent) => void; + handleNotesChange: (e: React.ChangeEvent) => void; + handleColorChange?: (color: string) => void; + handleFillColorChange?: (fillColor: string) => void; + handleFilledChange?: (filled: boolean) => void; + handleStrokeWidthChange?: (width: number) => void; + handleTextChange?: (e: React.ChangeEvent) => void; + handleBackgroundColorChange?: (color: string) => void; + handleFontSizeChange?: (size: number) => void; + handleFontWeightChange?: (weight: "normal" | "bold") => void; + handleDelete: () => void; +} + +export default function DrawingSettings({ + isOpen, + setIsOpen, + id, + data, + type, + handleLabelChange, + handleNotesChange, + handleColorChange, + handleFillColorChange, + handleFilledChange, + handleStrokeWidthChange, + handleTextChange, + handleBackgroundColorChange, + handleFontSizeChange, + handleFontWeightChange, + handleDelete, +}: DrawingSettingsProps) { + return ( + + +
+ + +
+
+ + +
+ + {type === "text" && handleTextChange && ( +
+ +