From 3ad1cb3c58616e4dfb28ed4c737f0008a878ec4f Mon Sep 17 00:00:00 2001 From: Vishnu Date: Fri, 23 May 2025 12:07:58 +0530 Subject: [PATCH] feat: enhance Messages and ThreadChat components with improved textarea handling and styling --- .../components/ui/collaboration/Messages.tsx | 55 ++++++++- .../ui/collaboration/ThreadChat.tsx | 44 ++++++-- .../function/textAreaHeightAdjust.ts | 17 +++ app/src/modules/scene/setup/setup.tsx | 3 +- app/src/pages/Project.tsx | 2 +- app/src/styles/components/input.scss | 3 +- app/src/styles/scene/comments.scss | 105 ++++++++++++++++-- 7 files changed, 201 insertions(+), 28 deletions(-) create mode 100644 app/src/components/ui/collaboration/function/textAreaHeightAdjust.ts diff --git a/app/src/components/ui/collaboration/Messages.tsx b/app/src/components/ui/collaboration/Messages.tsx index 3440204..3fffb4b 100644 --- a/app/src/components/ui/collaboration/Messages.tsx +++ b/app/src/components/ui/collaboration/Messages.tsx @@ -1,30 +1,71 @@ -import React, { useState } from "react"; +import React, { useEffect, useRef, useState } from "react"; import { getAvatarColor } from "../../../modules/collaboration/functions/getAvatarColor"; import { KebabIcon } from "../../icons/ExportCommonIcons"; +import { adjustHeight } from "./function/textAreaHeightAdjust"; interface MessageProps { - val: Reply; + val: Reply | CommentSchema; i: number; } const Messages: React.FC = ({ val, i }) => { const [isEditing, setIsEditing] = useState(false); const [openOptions, setOpenOptions] = useState(false); + + // input + const [value, setValue] = useState( + "reply" in val ? val.reply : val.comment + ); + const textareaRef = useRef(null); const currentUser = "1"; const UserName = "username"; + useEffect(() => { + if (textareaRef.current) adjustHeight(textareaRef.current); + }, [value]); + + function handleCancelAction() { + setIsEditing(false); + } + + function handleSaveAction() { + setIsEditing(false); + } + return ( <> {isEditing ? (
-