diff --git a/apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx b/apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx index 5d5443db2..fcea807df 100644 --- a/apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx +++ b/apps/sn/app/(with-base-layout)/ii/BaseLayout.tsx @@ -2,8 +2,10 @@ import { DateMonthPicker, Form, SelectBox } from '@common/business_components/ui' import ListDiv from '@common/business_components/ui/list_div' import { Button, Label } from '@common/components/ui' -import { useState, type ReactNode } from 'react' +import { useEffect, type ReactNode } from 'react' import { CtpvSggPrcsFcltSelectBox } from '@/components/ui/ctpvSggPrcsFcltSelectBox' +import { confirmToast } from '@/components/ui/toast' +import { toast, Toaster } from "react-hot-toast"; type TitleName = { mainTitle: string @@ -85,6 +87,14 @@ const BaseLayout = ({ onAnalysis, }: BaseLayout) => { + // 컴포넌트 언마운트 시 confirmToast 정리 + useEffect(() => { + return () => { + // 컴포넌트가 언마운트될 때 global-confirm-toast ID를 가진 Toast 제거 + toast.dismiss("global-confirm-toast"); + }; + }, []); + // 파일 다운로드 const isChckFile = () => { // Excel 다운로드 함수가 있으면 Excel 다운로드 실행 @@ -103,118 +113,132 @@ const BaseLayout = ({ } } + const handleConfirm = () => { + // 기존 confirmToast가 있다면 먼저 제거 + toast.dismiss("global-confirm-toast"); + + confirmToast( + "분석에는 2분 내외의 시간이 소요될 수 있습니다.\n분석을 진행하시겠습니까?", + onAnalysis ?? (() => { }), + "text-xl font-medium text-gray-800" + ); + }; + return ( -
- - {children?.[1] != null && ( + <> +