From 5b0994f2af11c77b61ac59df6211ccb20fae4d44 Mon Sep 17 00:00:00 2001
From: 0-Zz-ang <s1998319@gmail.com>
Date: Tue, 28 Oct 2025 14:57:14 +0900
Subject: (박서영)준법설문 관련요구사항 반영
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/basic-contract/viewer/SurveyComponent.tsx | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

(limited to 'lib/basic-contract/viewer/SurveyComponent.tsx')

diff --git a/lib/basic-contract/viewer/SurveyComponent.tsx b/lib/basic-contract/viewer/SurveyComponent.tsx
index 299fe6fa..8662155e 100644
--- a/lib/basic-contract/viewer/SurveyComponent.tsx
+++ b/lib/basic-contract/viewer/SurveyComponent.tsx
@@ -34,6 +34,7 @@ interface SurveyComponentProps {
   contractId?: number;
   surveyTemplate: SurveyTemplateWithQuestions | null;
   surveyLoading: boolean;
+  surveyLoadAttempted?: boolean; // 로드 시도 여부 추가
   conditionalHandler: ConditionalSurveyHandler | null;
   onSurveyComplete?: () => void;
   onSurveyDataUpdate: (data: any) => void;
@@ -45,6 +46,7 @@ export const SurveyComponent: React.FC<SurveyComponentProps> = ({
   contractId,
   surveyTemplate,
   surveyLoading,
+  surveyLoadAttempted = false,
   conditionalHandler,
   onSurveyComplete,
   onSurveyDataUpdate,
@@ -487,7 +489,21 @@ export const SurveyComponent: React.FC<SurveyComponentProps> = ({
     );
   }
 
+
   if (!surveyTemplate) {
+    if (!surveyLoadAttempted) {
+      return (
+        <div className="h-full w-full">
+          <Card className="h-full">
+            <CardContent className="flex flex-col items-center justify-center h-full py-12">
+              <Loader2 className="h-8 w-8 text-blue-500 animate-spin mb-4" />
+              <p className="text-sm text-muted-foreground">설문조사를 준비하는 중...</p>
+            </CardContent>
+          </Card>
+        </div>
+      );
+    }
+
     return (
       <div className="h-full w-full">
         <Card className="h-full">
@@ -836,8 +852,8 @@ export const SurveyComponent: React.FC<SurveyComponentProps> = ({
                               {uploadedFiles[question.id].map((file, index) => (
                                 <div key={index} className="flex items-center space-x-2 text-sm">
                                   <FileText className="h-4 w-4 text-blue-500" />
-                                  <span>{file.fileName}</span>
-                                  <span className="text-gray-500">({(file.fileSize / 1024).toFixed(1)} KB)</span>
+                                  <span>{file.name || file.fileName}</span>
+                                  <span className="text-gray-500">({((file.size || file.fileSize || 0) / 1024).toFixed(1)} KB)</span>
                                 </div>
                               ))}
                             </div>
-- 
cgit v1.2.3

