diff options
Diffstat (limited to 'lib/vendor-document-list/ship')
| -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 |
