From 28818bed777d1eebe82643687da55abf8b4b3236 Mon Sep 17 00:00:00 2001 From: zhom <2717306+zhom@users.noreply.github.com> Date: Thu, 7 Aug 2025 04:52:28 +0400 Subject: [PATCH] refactor: simplify app update toast --- src/components/app-update-toast.tsx | 22 +------ src/components/custom-toast.tsx | 91 +---------------------------- src/lib/toast-utils.ts | 37 +----------- 3 files changed, 4 insertions(+), 146 deletions(-) diff --git a/src/components/app-update-toast.tsx b/src/components/app-update-toast.tsx index 21b14a3..1606a07 100644 --- a/src/components/app-update-toast.tsx +++ b/src/components/app-update-toast.tsx @@ -144,11 +144,7 @@ export function AppUpdateToast({ {/* Other stage progress (with visual indicators) */} {showOtherStageProgress && ( -
- {updateProgress.message} -
- +- Preparing update files... -
- )} - {updateProgress.stage === "installing" && ( -- Installing new version... -
- )} - {updateProgress.stage === "completed" && ( -- Update completed! Restarting application... -
- )}- {progress.percentage.toFixed(1)}% - {progress.speed && ` • ${progress.speed} MB/s`} - {progress.eta && ` • ${progress.eta} remaining`} -
-- Preparing update files... -
- )} - {stage === "installing" && ( -- Installing new version... -
- )} - {stage === "completed" && ( -- Update completed! Restarting application... -
- )} - > - )} ); diff --git a/src/lib/toast-utils.ts b/src/lib/toast-utils.ts index 1285d63..66f5c8a 100644 --- a/src/lib/toast-utils.ts +++ b/src/lib/toast-utils.ts @@ -46,23 +46,12 @@ interface VersionUpdateToastProps extends BaseToastProps { }; } -interface AppUpdateToastProps extends BaseToastProps { - type: "app-update"; - stage?: "downloading" | "extracting" | "installing" | "completed"; - progress?: { - percentage: number; - speed?: string; - eta?: string; - }; -} - type ToastProps = | SuccessToastProps | ErrorToastProps | DownloadToastProps | LoadingToastProps - | VersionUpdateToastProps - | AppUpdateToastProps; + | VersionUpdateToastProps; export function showToast(props: ToastProps & { id?: string }) { const toastId = props.id ?? `toast-${props.type}-${Date.now()}`; @@ -257,27 +246,3 @@ export function showUnifiedVersionUpdateToast( ...options, }); } - -export function showAppUpdateToast( - title: string, - stage: "downloading" | "extracting" | "installing" | "completed", - options?: { - id?: string; - description?: string; - progress?: { - percentage: number; - speed?: string; - eta?: string; - }; - duration?: number; - }, -) { - return showToast({ - type: "app-update", - title, - stage, - id: options?.id ?? "app-update-progress", - duration: stage === "downloading" ? Number.POSITIVE_INFINITY : 5000, - ...options, - }); -}