summaryrefslogtreecommitdiff
path: root/lib/vendor-document-list/ship
diff options
context:
space:
mode:
Diffstat (limited to 'lib/vendor-document-list/ship')
-rw-r--r--lib/vendor-document-list/ship/import-from-dolce-button.tsx38
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