summaryrefslogtreecommitdiff
path: root/components/form-data/form-data-report-temp-uploaded-list-tab.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'components/form-data/form-data-report-temp-uploaded-list-tab.tsx')
-rw-r--r--components/form-data/form-data-report-temp-uploaded-list-tab.tsx37
1 files changed, 22 insertions, 15 deletions
diff --git a/components/form-data/form-data-report-temp-uploaded-list-tab.tsx b/components/form-data/form-data-report-temp-uploaded-list-tab.tsx
index a5c3c7a5..7bd5eeef 100644
--- a/components/form-data/form-data-report-temp-uploaded-list-tab.tsx
+++ b/components/form-data/form-data-report-temp-uploaded-list-tab.tsx
@@ -7,6 +7,8 @@ import React, {
useState,
useEffect,
} from "react";
+import { useParams } from "next/navigation";
+import { useTranslation } from "@/i18n/client";
import { useToast } from "@/hooks/use-toast";
import { toast as toastMessage } from "sonner";
import { Download, Trash2 } from "lucide-react";
@@ -44,6 +46,10 @@ interface FormDataReportTempUploadedListTabProps {
export const FormDataReportTempUploadedListTab: FC<
FormDataReportTempUploadedListTabProps
> = ({ packageId, formId }) => {
+ const params = useParams();
+ const lng = (params?.lng as string) || "ko";
+ const { t } = useTranslation(lng, "engineering");
+
const [prevReportTemp, setPrevReportTemp] = useState<VendorDataReportTemps[]>(
[]
);
@@ -60,13 +66,14 @@ export const FormDataReportTempUploadedListTab: FC<
return (
<div>
- <Label>Uploaded Template File List</Label>
+ <Label>{t("templateUploadedList.listLabel")}</Label>
<UploadedTempFiles
prevReportTemp={prevReportTemp}
updateReportTempList={() =>
updateReportTempList(packageId, formId, setPrevReportTemp)
}
isLoading={isLoading}
+ t={t}
/>
</div>
);
@@ -91,12 +98,14 @@ interface UploadedTempFiles {
prevReportTemp: VendorDataReportTemps[];
updateReportTempList: () => void;
isLoading: boolean;
+ t: (key: string, options?: any) => string;
}
const UploadedTempFiles: FC<UploadedTempFiles> = ({
prevReportTemp,
updateReportTempList,
isLoading,
+ t,
}) => {
const { toast } = useToast();
@@ -109,19 +118,17 @@ const UploadedTempFiles: FC<UploadedTempFiles> = ({
saveAs(blob, fileName);
- toastMessage.success("Report 다운로드 완료!");
+ toastMessage.success(t("templateUploadedList.downloadComplete"));
} else {
const err = await getTempFile.json();
console.error("에러:", err);
throw new Error(err.message);
}
-
- toastMessage.success("Template File 다운로드 완료!");
} catch (err) {
console.error(err);
toast({
- title: "Error",
- description: "Template File 다운로드 중 오류가 발생했습니다.",
+ title: t("templateUploadedList.error"),
+ description: t("templateUploadedList.downloadError"),
variant: "destructive",
});
}
@@ -133,14 +140,14 @@ const UploadedTempFiles: FC<UploadedTempFiles> = ({
if (result) {
updateReportTempList();
- toastMessage.success("Template File 삭제 완료!");
+ toastMessage.success(t("templateUploadedList.deleteComplete"));
} else {
throw new Error(error);
}
} catch (err) {
toast({
- title: "Error",
- description: "Template File 삭제 중 오류가 발생했습니다.",
+ title: t("templateUploadedList.error"),
+ description: t("templateUploadedList.deleteError"),
variant: "destructive",
});
}
@@ -149,7 +156,7 @@ const UploadedTempFiles: FC<UploadedTempFiles> = ({
if (isLoading) {
return (
<div className="min-h-[157px]">
- <Label>로딩 중...</Label>
+ <Label>{t("templateUploadedList.loading")}</Label>
</div>
);
}
@@ -174,29 +181,29 @@ const UploadedTempFiles: FC<UploadedTempFiles> = ({
}}
>
<Download className="h-4 w-4" />
- <span className="sr-only">Download</span>
+ <span className="sr-only">{t("templateUploadedList.download")}</span>
</FileListAction>
<AlertDialogTrigger asChild>
<FileListAction>
<Trash2 className="h-4 w-4" />
- <span className="sr-only">Delete</span>
+ <span className="sr-only">{t("templateUploadedList.delete")}</span>
</FileListAction>
</AlertDialogTrigger>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>
- Report Templete File({fileName})을 삭제하시겠습니까?
+ {t("templateUploadedList.deleteConfirmTitle", { fileName })}
</AlertDialogTitle>
<AlertDialogDescription />
</AlertDialogHeader>
<AlertDialogFooter>
- <AlertDialogCancel>취소</AlertDialogCancel>
+ <AlertDialogCancel>{t("templateUploadedList.cancel")}</AlertDialogCancel>
<AlertDialogAction
onClick={() => {
deleteTempFile(id);
}}
>
- 삭제
+ {t("templateUploadedList.delete")}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>