diff --git a/packages/ui/src/components/primitives/pagination.tsx b/packages/ui/src/components/primitives/pagination.tsx index 2de5a36592..eb675e8bb0 100644 --- a/packages/ui/src/components/primitives/pagination.tsx +++ b/packages/ui/src/components/primitives/pagination.tsx @@ -1,4 +1,5 @@ -import { Button, buttonVariants } from '@cherrystudio/ui/components/primitives/button' +import type { Button } from '@cherrystudio/ui/components/primitives/button' +import { buttonVariants } from '@cherrystudio/ui/components/primitives/button' import { cn } from '@cherrystudio/ui/utils/index' import { ChevronLeftIcon, ChevronRightIcon, MoreHorizontalIcon } from 'lucide-react' import * as React from 'react' diff --git a/src/main/data/migration/v2/core/types.ts b/src/main/data/migration/v2/core/types.ts index ef7374b0d2..ecc91c07a5 100644 --- a/src/main/data/migration/v2/core/types.ts +++ b/src/main/data/migration/v2/core/types.ts @@ -9,6 +9,7 @@ export type MigrationStage = | 'backup_progress' | 'backup_confirmed' | 'migration' + | 'migration_completed' | 'completed' | 'error' diff --git a/src/main/data/migration/v2/window/MigrationIpcHandler.ts b/src/main/data/migration/v2/window/MigrationIpcHandler.ts index 705b8ed900..b77efaa3dd 100644 --- a/src/main/data/migration/v2/window/MigrationIpcHandler.ts +++ b/src/main/data/migration/v2/window/MigrationIpcHandler.ts @@ -242,9 +242,9 @@ export function registerMigrationIpcHandlers(): void { if (result.success) { updateProgress({ - stage: 'completed', + stage: 'migration_completed', overallProgress: 100, - currentMessage: 'Migration completed successfully! Click restart to continue.', + currentMessage: 'Migration completed successfully! Please confirm to continue.', migrators: currentProgress.migrators.map((m) => ({ ...m, status: 'completed' diff --git a/src/renderer/src/windows/migrationV2/MigrationApp.tsx b/src/renderer/src/windows/migrationV2/MigrationApp.tsx index 085fdf6009..38aef8145d 100644 --- a/src/renderer/src/windows/migrationV2/MigrationApp.tsx +++ b/src/renderer/src/windows/migrationV2/MigrationApp.tsx @@ -14,7 +14,7 @@ import { MigrationIpcChannels } from './types' const logger = loggerService.withContext('MigrationApp') const MigrationApp: React.FC = () => { - const { progress, lastError } = useMigrationProgress() + const { progress, lastError, confirmComplete } = useMigrationProgress() const actions = useMigrationActions() const [isLoading, setIsLoading] = useState(false) @@ -60,6 +60,7 @@ const MigrationApp: React.FC = () => { case 'backup_confirmed': return 1 case 'migration': + case 'migration_completed': return 2 case 'completed': return 3 @@ -160,6 +161,13 @@ const MigrationApp: React.FC = () => { ) + case 'migration_completed': + return ( + +
+ +
+ ) case 'completed': return ( @@ -251,7 +259,7 @@ const MigrationApp: React.FC = () => { @@ -262,6 +270,21 @@ const MigrationApp: React.FC = () => { )} + {progress.stage === 'migration_completed' && ( +
+ + 数据迁移完成! + 所有数据已成功迁移到新架构,请点击确定继续。 + + + + +
+ +
+
+ )} + {progress.stage === 'completed' && ( 迁移完成 diff --git a/src/renderer/src/windows/migrationV2/hooks/useMigrationProgress.ts b/src/renderer/src/windows/migrationV2/hooks/useMigrationProgress.ts index 9bca260f53..de6943898d 100644 --- a/src/renderer/src/windows/migrationV2/hooks/useMigrationProgress.ts +++ b/src/renderer/src/windows/migrationV2/hooks/useMigrationProgress.ts @@ -56,6 +56,15 @@ export function useMigrationProgress() { } }, []) + // Local state transition for confirming migration completion (frontend only) + const confirmComplete = useCallback(() => { + setProgress((prev) => ({ + ...prev, + stage: 'completed', + currentMessage: 'Migration completed successfully! Click restart to continue.' + })) + }, []) + // Stage helpers const isInProgress = progress.stage === 'migration' const isCompleted = progress.stage === 'completed' @@ -68,7 +77,8 @@ export function useMigrationProgress() { isInProgress, isCompleted, isError, - canCancel + canCancel, + confirmComplete } } diff --git a/src/renderer/src/windows/migrationV2/types.ts b/src/renderer/src/windows/migrationV2/types.ts index 5515ebb58d..79c0b6bd21 100644 --- a/src/renderer/src/windows/migrationV2/types.ts +++ b/src/renderer/src/windows/migrationV2/types.ts @@ -9,6 +9,7 @@ export type MigrationStage = | 'backup_progress' | 'backup_confirmed' | 'migration' + | 'migration_completed' | 'completed' | 'error'