From a040708997ca48604f79b54955eaa534acd65d18 Mon Sep 17 00:00:00 2001 From: Emir Karabeg Date: Sun, 2 Feb 2025 21:17:13 -0800 Subject: [PATCH] Rolled back comments into separate branch --- .../comment-block/comment-block.tsx | 106 ------------------ .../workflow-canvas/workflow-canvas.tsx | 47 ++------ app/w/components/control-bar/control-bar.tsx | 18 --- stores/comments/store.ts | 85 -------------- stores/comments/types.ts | 0 5 files changed, 8 insertions(+), 248 deletions(-) delete mode 100644 app/w/[id]/components/comment-block/comment-block.tsx delete mode 100644 stores/comments/store.ts delete mode 100644 stores/comments/types.ts diff --git a/app/w/[id]/components/comment-block/comment-block.tsx b/app/w/[id]/components/comment-block/comment-block.tsx deleted file mode 100644 index b55691103c..0000000000 --- a/app/w/[id]/components/comment-block/comment-block.tsx +++ /dev/null @@ -1,106 +0,0 @@ -import { useState, useEffect, useRef } from 'react' -import { Card } from '@/components/ui/card' -import { Textarea } from '@/components/ui/textarea' -import { X } from 'lucide-react' -import { useCommentStore } from '@/stores/comments/store' -import { NodeProps } from 'reactflow' -import { cn } from '@/lib/utils' - -interface CommentBlockData { - id: string - text: string -} - -export function CommentBlock({ data }: NodeProps) { - const [text, setText] = useState(data.text) - const [isEditing, setIsEditing] = useState(!data.text) - const [isExpanded, setIsExpanded] = useState(false) - const textareaRef = useRef(null) - const { updateComment, removeComment } = useCommentStore() - - useEffect(() => { - if (isEditing && textareaRef.current) { - textareaRef.current.focus() - } - }, [isEditing]) - - const handleBlur = () => { - setIsEditing(false) - setIsExpanded(false) - if (text.trim()) { - updateComment(data.id, text) - } else { - removeComment(data.id) - } - } - - const handleClick = () => { - setIsExpanded(true) - if (!text) { - setIsEditing(true) - } - } - - if (!isExpanded) { - return ( -
setIsExpanded(true)} - > -
-
- ) - } - - return ( - !isEditing && setIsExpanded(false)} - > -
-
Note
- -
- -
setIsEditing(true)}> - {isEditing ? ( -