From ef4c533ebacc2cdc97e518f30e9a9350004fcdfb Mon Sep 17 00:00:00 2001
From: dujinkim <dujin.kim@dtsolution.co.kr>
Date: Mon, 28 Apr 2025 02:13:30 +0000
Subject: ~20250428 작업사항
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/tbe/table/comments-sheet.tsx | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

(limited to 'lib/tbe/table/comments-sheet.tsx')

diff --git a/lib/tbe/table/comments-sheet.tsx b/lib/tbe/table/comments-sheet.tsx
index 7fcde35d..0952209d 100644
--- a/lib/tbe/table/comments-sheet.tsx
+++ b/lib/tbe/table/comments-sheet.tsx
@@ -4,7 +4,7 @@ import * as React from "react"
 import { useForm, useFieldArray } from "react-hook-form"
 import { z } from "zod"
 import { zodResolver } from "@hookform/resolvers/zod"
-import { Loader, Download, X } from "lucide-react"
+import { Loader, Download, X ,Loader2} from "lucide-react"
 import prettyBytes from "pretty-bytes"
 import { toast } from "sonner"
 
@@ -50,7 +50,6 @@ import {
 
 // DB 스키마에서 필요한 타입들을 가져온다고 가정
 // (실제 프로젝트에 맞춰 import를 수정하세요.)
-import { RfqWithAll } from "@/db/schema/rfq"
 import { formatDate } from "@/lib/utils"
 import { createRfqCommentWithAttachments } from "@/lib/rfqs/service"
 
@@ -77,6 +76,7 @@ interface CommentSheetProps extends React.ComponentPropsWithRef<typeof Sheet> {
   currentUserId: number
   rfqId:number
   vendorId:number
+  isLoading?: boolean // New prop
   /** 댓글 저장 후 갱신용 콜백 (옵션) */
   onCommentsUpdated?: (comments: TbeComment[]) => void
 }
@@ -96,6 +96,7 @@ export function CommentSheet({
   initialComments = [],
   currentUserId,
   onCommentsUpdated,
+  isLoading = false,
   ...props
 }: CommentSheetProps) {
   const [comments, setComments] = React.useState<TbeComment[]>(initialComments)
@@ -125,6 +126,16 @@ export function CommentSheet({
   // 간단히 테이블 하나로 표현
   // 실제로는 Bubble 형태의 UI, Accordion, Timeline 등 다양하게 구성할 수 있음
   function renderExistingComments() {
+
+    if (isLoading) {
+      return (
+        <div className="flex justify-center items-center h-32">
+          <Loader2 className="h-4 w-4 animate-spin text-muted-foreground" />
+          <span className="ml-2 text-sm text-muted-foreground">Loading comments...</span>
+        </div>
+      )
+    }
+
     if (comments.length === 0) {
       return <p className="text-sm text-muted-foreground">No comments yet</p>
     }
-- 
cgit v1.2.3

