From 7bf0984698e43b9aa2dd879f65951318ed410390 Mon Sep 17 00:00:00 2001 From: Maze <167211895+mazeincoding@users.noreply.github.com> Date: Sat, 31 Jan 2026 00:20:04 +0100 Subject: codebase overhaul (#697) --- .../editor/properties-panel/text-properties.tsx | 370 --------------------- 1 file changed, 370 deletions(-) delete mode 100644 apps/web/src/components/editor/properties-panel/text-properties.tsx (limited to 'apps/web/src/components/editor/properties-panel/text-properties.tsx') diff --git a/apps/web/src/components/editor/properties-panel/text-properties.tsx b/apps/web/src/components/editor/properties-panel/text-properties.tsx deleted file mode 100644 index deaee157..00000000 --- a/apps/web/src/components/editor/properties-panel/text-properties.tsx +++ /dev/null @@ -1,370 +0,0 @@ -import { Textarea } from "@/components/ui/textarea"; -import { FontPicker } from "@/components/ui/font-picker"; -import { FontFamily } from "@/constants/font-constants"; -import { TextElement } from "@/types/timeline"; -import { useTimelineStore } from "@/stores/timeline-store"; -import { Slider } from "@/components/ui/slider"; -import { Input } from "@/components/ui/input"; -import { Button } from "@/components/ui/button"; -import { useState, useRef } from "react"; -import { PanelBaseView } from "@/components/editor/panel-base-view"; -import { - TEXT_PROPERTIES_TABS, - isTextPropertiesTab, - useTextPropertiesStore, -} from "@/stores/text-properties-store"; -import { - PropertyItem, - PropertyItemLabel, - PropertyItemValue, -} from "./property-item"; -import { ColorPicker } from "@/components/ui/color-picker"; -import { cn, uppercase } from "@/lib/utils"; -import { Grid2x2 } from "lucide-react"; -import { - Tooltip, - TooltipContent, - TooltipTrigger, -} from "@/components/ui/tooltip"; - -export function TextProperties({ - element, - trackId, -}: { - element: TextElement; - trackId: string; -}) { - const { updateTextElement } = useTimelineStore(); - const { activeTab, setActiveTab } = useTextPropertiesStore(); - const containerRef = useRef(null); - // Local state for input values to allow temporary empty/invalid states - const [fontSizeInput, setFontSizeInput] = useState( - element.fontSize.toString() - ); - const [opacityInput, setOpacityInput] = useState( - Math.round(element.opacity * 100).toString() - ); - - // Track the last selected color for toggling - const lastSelectedColor = useRef("#000000"); - - const parseAndValidateNumber = ( - value: string, - min: number, - max: number, - fallback: number - ): number => { - const parsed = parseInt(value, 10); - if (isNaN(parsed)) return fallback; - return Math.max(min, Math.min(max, parsed)); - }; - - const handleFontSizeChange = (value: string) => { - setFontSizeInput(value); - - if (value.trim() !== "") { - const fontSize = parseAndValidateNumber(value, 8, 300, element.fontSize); - updateTextElement(trackId, element.id, { fontSize }); - } - }; - - const handleFontSizeBlur = () => { - const fontSize = parseAndValidateNumber( - fontSizeInput, - 8, - 300, - element.fontSize - ); - setFontSizeInput(fontSize.toString()); - updateTextElement(trackId, element.id, { fontSize }); - }; - - const handleOpacityChange = (value: string) => { - setOpacityInput(value); - - if (value.trim() !== "") { - const opacityPercent = parseAndValidateNumber( - value, - 0, - 100, - Math.round(element.opacity * 100) - ); - updateTextElement(trackId, element.id, { opacity: opacityPercent / 100 }); - } - }; - - const handleOpacityBlur = () => { - const opacityPercent = parseAndValidateNumber( - opacityInput, - 0, - 100, - Math.round(element.opacity * 100) - ); - setOpacityInput(opacityPercent.toString()); - updateTextElement(trackId, element.id, { opacity: opacityPercent / 100 }); - }; - - // Update last selected color when a new color is picked - const handleColorChange = (color: string) => { - if (color !== "transparent") { - lastSelectedColor.current = color; - } - updateTextElement(trackId, element.id, { backgroundColor: color }); - }; - - // Toggle between transparent and last selected color - const handleTransparentToggle = (isTransparent: boolean) => { - const newColor = isTransparent ? "transparent" : lastSelectedColor.current; - updateTextElement(trackId, element.id, { backgroundColor: newColor }); - }; - - return ( - { - if (isTextPropertiesTab(v)) setActiveTab(v); - }} - ref={containerRef} - tabs={TEXT_PROPERTIES_TABS.map((t) => ({ - value: t.value, - label: t.label, - content: - t.value === "transform" ? ( -
- ) : ( -
-