diff options
| author | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-08-21 06:57:36 +0000 |
|---|---|---|
| committer | dujinkim <dujin.kim@dtsolution.co.kr> | 2025-08-21 06:57:36 +0000 |
| commit | 02b1cf005cf3e1df64183d20ba42930eb2767a9f (patch) | |
| tree | e932c54d5260b0e6fda2b46be2a6ba1c3ee30434 /lib/vendor-document-list/ship/import-from-dolce-button.tsx | |
| parent | d78378ecd7ceede1429359f8058c7a99ac34b1b7 (diff) | |
(대표님, 최겸) 설계메뉴추가, 작업사항 업데이트
설계메뉴 - 문서관리
설계메뉴 - 벤더 데이터
gtc 메뉴 업데이트
정보시스템 - 메뉴리스트 및 정보 업데이트
파일 라우트 업데이트
엑셀임포트 개선
기본계약 개선
벤더 가입과정 변경 및 개선
벤더 기본정보 - pq
돌체 오류 수정 및 개선
벤더 로그인 과정 이메일 오류 수정
Diffstat (limited to 'lib/vendor-document-list/ship/import-from-dolce-button.tsx')
| -rw-r--r-- | lib/vendor-document-list/ship/import-from-dolce-button.tsx | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/vendor-document-list/ship/import-from-dolce-button.tsx b/lib/vendor-document-list/ship/import-from-dolce-button.tsx index 1ffe466d..5e720220 100644 --- a/lib/vendor-document-list/ship/import-from-dolce-button.tsx +++ b/lib/vendor-document-list/ship/import-from-dolce-button.tsx @@ -223,6 +223,8 @@ export function ImportFromDOLCEButton({ } }, [debouncedProjectIds, fetchAllImportStatus]) + + // 🔥 전체 통계 메모이제이션 const totalStats = React.useMemo(() => { const statuses = Array.from(importStatusMap.values()) @@ -389,6 +391,42 @@ export function ImportFromDOLCEButton({ fetchAllImportStatus() }, [fetchAllImportStatus]) + + // 🔥 자동 동기화 실행 (기존 useEffect들 다음에 추가) + React.useEffect(() => { + // 조건: 가져오기 가능하고, 동기화할 항목이 있고, 현재 진행중이 아닐 때 + if (canImport && + (totalStats.newDocuments > 0 || totalStats.updatedDocuments > 0) && + !isImporting && + !isDialogOpen) { + + // 상태 로딩이 완료된 후 잠깐 대기 (사용자가 상태를 확인할 수 있도록) + const timer = setTimeout(() => { + console.log(`🔄 자동 동기화 시작: 새 문서 ${totalStats.newDocuments}개, 업데이트 ${totalStats.updatedDocuments}개`) + + // 동기화 시작 알림 + toast.info( + '새로운 문서가 발견되어 자동 동기화를 시작합니다', + { + description: `새 문서 ${totalStats.newDocuments}개, 업데이트 ${totalStats.updatedDocuments}개`, + duration: 3000 + } + ) + + // 자동으로 다이얼로그 열고 동기화 실행 + setIsDialogOpen(true) + + // 잠깐 후 실제 동기화 시작 (다이얼로그가 열리는 시간) + setTimeout(() => { + handleImport() + }, 500) + }, 1500) // 1.5초 대기 + + return () => clearTimeout(timer) + } + }, [canImport, totalStats.newDocuments, totalStats.updatedDocuments, isImporting, isDialogOpen, handleImport]) + + // 로딩 중이거나 projectIds가 없으면 버튼을 표시하지 않음 if (projectIds.length === 0) { return null |
