From c54a2445b6285d06c0ce3afa1cd3aa6aecf6de94 Mon Sep 17 00:00:00 2001
From: joonhoekim <26rote@gmail.com>
Date: Mon, 24 Nov 2025 20:13:50 +0900
Subject: (김준회) dolce rebuild: i18n 지원
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 lib/dolce/dialogs/detail-drawing-dialog.tsx | 53 +++++++++++++++++------------
 1 file changed, 32 insertions(+), 21 deletions(-)

(limited to 'lib/dolce/dialogs/detail-drawing-dialog.tsx')

diff --git a/lib/dolce/dialogs/detail-drawing-dialog.tsx b/lib/dolce/dialogs/detail-drawing-dialog.tsx
index a06c9688..d9df58db 100644
--- a/lib/dolce/dialogs/detail-drawing-dialog.tsx
+++ b/lib/dolce/dialogs/detail-drawing-dialog.tsx
@@ -12,6 +12,7 @@ import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
 import { Skeleton } from "@/components/ui/skeleton";
 import { Plus, RefreshCw, Upload, Loader2 } from "lucide-react";
 import { toast } from "sonner";
+import { useTranslation } from "@/i18n/client";
 import {
   UnifiedDwgReceiptItem,
   DetailDwgReceiptItem,
@@ -20,7 +21,7 @@ import {
   fetchFileInfoList,
 } from "../actions";
 import { DrawingListTable } from "../table/drawing-list-table";
-import { detailDrawingColumns } from "../table/detail-drawing-columns";
+import { createDetailDrawingColumns } from "../table/detail-drawing-columns";
 import { createFileListColumns } from "../table/file-list-columns";
 import { AddDetailDrawingDialog } from "./add-detail-drawing-dialog";
 import { UploadFilesToDetailDialog } from "./upload-files-to-detail-dialog";
@@ -34,6 +35,7 @@ interface DetailDrawingDialogProps {
   userName: string;
   userEmail: string;
   drawingKind: "B3" | "B4";
+  lng: string;
 }
 
 export function DetailDrawingDialog({
@@ -45,7 +47,9 @@ export function DetailDrawingDialog({
   userName,
   userEmail,
   drawingKind,
+  lng,
 }: DetailDrawingDialogProps) {
+  const { t } = useTranslation(lng, "dolce");
   const [detailDrawings, setDetailDrawings] = useState<DetailDwgReceiptItem[]>([]);
   const [selectedDetail, setSelectedDetail] = useState<DetailDwgReceiptItem | null>(null);
   const [files, setFiles] = useState<FileInfoItem[]>([]);
@@ -75,11 +79,11 @@ export function DetailDrawingDialog({
       }
     } catch (error) {
       console.error("상세도면 로드 실패:", error);
-      toast.error("상세도면 로드에 실패했습니다");
+      toast.error(t("detailDialog.detailLoadError"));
     } finally {
       setIsLoading(false);
     }
-  }, [drawing, selectedDetail]);
+  }, [drawing, selectedDetail, t]);
 
   // 파일 목록 로드
   const loadFiles = useCallback(async () => {
@@ -94,11 +98,11 @@ export function DetailDrawingDialog({
       setFiles(data);
     } catch (error) {
       console.error("파일 목록 로드 실패:", error);
-      toast.error("파일 목록 로드에 실패했습니다");
+      toast.error(t("detailDialog.fileLoadError"));
     } finally {
       setIsLoadingFiles(false);
     }
-  }, [selectedDetail]);
+  }, [selectedDetail, t]);
 
   // 다이얼로그 열릴 때 데이터 로드
   useEffect(() => {
@@ -120,7 +124,7 @@ export function DetailDrawingDialog({
 
   const handleDownload = async (file: FileInfoItem) => {
     try {
-      toast.info("파일 다운로드를 준비 중입니다...");
+      toast.info(t("detailDialog.downloadPreparing"));
       
       // 파일 생성자의 userId를 사용하여 다운로드
       const response = await fetch("/api/dolce/download", {
@@ -136,7 +140,7 @@ export function DetailDrawingDialog({
       });
 
       if (!response.ok) {
-        throw new Error("파일 다운로드 실패");
+        throw new Error(t("detailDialog.downloadError"));
       }
 
       const blob = await response.blob();
@@ -149,10 +153,10 @@ export function DetailDrawingDialog({
       window.URL.revokeObjectURL(url);
       document.body.removeChild(a);
       
-      toast.success("파일 다운로드가 완료되었습니다");
+      toast.success(t("detailDialog.downloadSuccess"));
     } catch (error) {
       console.error("파일 다운로드 실패:", error);
-      toast.error("파일 다운로드에 실패했습니다");
+      toast.error(t("detailDialog.downloadError"));
     }
   };
 
@@ -170,7 +174,7 @@ export function DetailDrawingDialog({
     loadFiles();
   };
 
-  const fileColumns = createFileListColumns({ onDownload: handleDownload });
+  const fileColumns = createFileListColumns({ onDownload: handleDownload, lng });
 
   // RegisterId + UploadId 조합으로 고유 ID 생성
   const getDetailDrawingId = (detail: DetailDwgReceiptItem) => {
@@ -188,10 +192,15 @@ export function DetailDrawingDialog({
         <DialogContent className="max-w-[95vw] h-[90vh] flex flex-col">
           <DialogHeader>
             <DialogTitle className="flex flex-col gap-1">
-              <span>상세도면 정보</span>
+              <span>{t("detailDialog.title")}</span>
               {drawing && (
                 <span className="text-sm font-normal text-muted-foreground">
-                  {drawing.DrawingNo} | 프로젝트: {drawing.ProjectNo} | Discipline: {drawing.Discipline} | 종류: {drawing.DrawingKind}
+                  {t("detailDialog.subtitle", {
+                    drawingNo: drawing.DrawingNo,
+                    projectNo: drawing.ProjectNo,
+                    discipline: drawing.Discipline,
+                    drawingKind: drawing.DrawingKind
+                  })}
                 </span>
               )}
             </DialogTitle>
@@ -201,7 +210,7 @@ export function DetailDrawingDialog({
             {/* 상단: 상세도면 리스트 */}
             <Card className="flex-1 overflow-hidden flex flex-col">
               <CardHeader className="flex-row items-center justify-between py-3">
-                <CardTitle className="text-base">상세도면 목록</CardTitle>
+                <CardTitle className="text-base">{t("detailDialog.detailListTitle")}</CardTitle>
                 <div className="flex gap-2">
                   <Button
                     variant="outline"
@@ -210,7 +219,7 @@ export function DetailDrawingDialog({
                     disabled={isLoading}
                   >
                     <RefreshCw className={`h-4 w-4 mr-2 ${isLoading ? "animate-spin" : ""}`} />
-                    새로고침
+                    {t("detailDialog.refreshButton")}
                   </Button>
                   {canAddDetailDrawing && (
                     <Button
@@ -219,14 +228,14 @@ export function DetailDrawingDialog({
                       onClick={() => setAddDialogOpen(true)}
                     >
                       <Plus className="h-4 w-4 mr-2" />
-                      상세도면 추가
+                      {t("detailDialog.addDetailButton")}
                     </Button>
                   )}
                 </div>
               </CardHeader>
               <CardContent className="flex-1 overflow-y-auto p-4">
                 <DrawingListTable<DetailDwgReceiptItem, unknown>
-                  columns={detailDrawingColumns}
+                  columns={createDetailDrawingColumns(lng, t)}
                   data={detailDrawings}
                   onRowClick={setSelectedDetail}
                   selectedRow={selectedDetail || undefined}
@@ -239,8 +248,8 @@ export function DetailDrawingDialog({
             <Card className="flex-1 overflow-hidden flex flex-col">
               <CardHeader className="flex-row items-center justify-between py-3">
                 <CardTitle className="text-base">
-                  첨부파일 목록
-                  {selectedDetail && ` - Rev. ${selectedDetail.DrawingRevNo}`}
+                  {t("detailDialog.fileListTitle")}
+                  {selectedDetail && t("detailDialog.fileListSubtitle", { revNo: selectedDetail.DrawingRevNo })}
                 </CardTitle>
                 {selectedDetail && canAddDetailDrawing && (
                   <Button
@@ -249,20 +258,20 @@ export function DetailDrawingDialog({
                     onClick={() => setUploadFilesDialogOpen(true)}
                   >
                     <Upload className="h-4 w-4 mr-2" />
-                    파일 업로드
+                    {t("detailDialog.uploadFilesButton")}
                   </Button>
                 )}
               </CardHeader>
               <CardContent className="flex-1 overflow-y-auto p-4">
                 {!selectedDetail ? (
                   <div className="h-full flex items-center justify-center text-muted-foreground">
-                    상세도면을 선택하세요
+                    {t("detailDialog.selectDetailDrawing")}
                   </div>
                 ) : isLoadingFiles ? (
                   <div className="space-y-4">
                     <div className="flex items-center justify-center gap-2 text-muted-foreground py-8">
                       <Loader2 className="h-5 w-5 animate-spin" />
-                      <span>Loading files...</span>
+                      <span>{t("detailDialog.loadingFiles")}</span>
                     </div>
                     <div className="space-y-2">
                       <Skeleton className="h-10 w-full" />
@@ -292,6 +301,7 @@ export function DetailDrawingDialog({
         userEmail={userEmail}
         onComplete={handleAddComplete}
         drawingKind={drawingKind}
+        lng={lng}
       />
 
       {selectedDetail && (
@@ -303,6 +313,7 @@ export function DetailDrawingDialog({
           revNo={selectedDetail.DrawingRevNo}
           userId={userId}
           onUploadComplete={handleUploadComplete}
+          lng={lng}
         />
       )}
     </>
-- 
cgit v1.2.3

