summaryrefslogtreecommitdiff
path: root/lib/tbe/table/comments-sheet.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'lib/tbe/table/comments-sheet.tsx')
-rw-r--r--lib/tbe/table/comments-sheet.tsx15
1 files changed, 13 insertions, 2 deletions
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>
}