diff --git a/components/modals/text-dialog.tsx b/components/modals/text-dialog.tsx deleted file mode 100644 index 5c1d3c5..0000000 --- a/components/modals/text-dialog.tsx +++ /dev/null @@ -1,288 +0,0 @@ -'use client'; - -import { useState, useEffect } from 'react'; -import { X, Type } from 'lucide-react'; -import { useTextStore } from '@/store/text-store'; -import { TextTool } from '@/tools/text-tool'; -import { WEB_SAFE_FONTS, GOOGLE_FONTS, loadGoogleFont } from '@/lib/text-utils'; -import type { FontStyle, FontWeight, TextAlign } from '@/types/text'; - -export function TextDialog() { - const { - settings, - isDialogOpen, - clickPosition, - setText, - setFontFamily, - setFontSize, - setFontStyle, - setFontWeight, - setColor, - setAlign, - setLineHeight, - setLetterSpacing, - closeDialog, - } = useTextStore(); - - const [text, setTextLocal] = useState(settings.text); - const [isLoadingFont, setIsLoadingFont] = useState(false); - - useEffect(() => { - if (isDialogOpen) { - setTextLocal(settings.text); - } - }, [isDialogOpen, settings.text]); - - if (!isDialogOpen || !clickPosition) return null; - - const handleInsert = async () => { - if (!text.trim()) { - closeDialog(); - return; - } - - // Update text in store - setText(text); - - // Load Google Font if needed - if (GOOGLE_FONTS.includes(settings.fontFamily as any)) { - try { - setIsLoadingFont(true); - await loadGoogleFont(settings.fontFamily); - } catch (error) { - console.error('Failed to load font:', error); - } finally { - setIsLoadingFont(false); - } - } - - // Render text on canvas - TextTool.renderTextOnCanvas(clickPosition.x, clickPosition.y); - - // Close dialog - closeDialog(); - setTextLocal(''); - }; - - const handleCancel = () => { - closeDialog(); - setTextLocal(''); - }; - - const allFonts = [...WEB_SAFE_FONTS, ...GOOGLE_FONTS]; - - return ( -
-
e.stopPropagation()} - > - {/* Header */} -
-
- -

Add Text

-
- -
- - {/* Content */} -
- {/* Text Input */} -
- -