From cd792f61108e6a07eb93edf57f7776f4aaf2efe6 Mon Sep 17 00:00:00 2001 From: Jiang Bohan Date: Fri, 16 Jan 2026 16:18:13 +0800 Subject: [PATCH] fix: show error state in update notification instead of hiding --- .../src/components/UpdateNotification.tsx | 43 +++++++++++++------ 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/src/renderer/src/components/UpdateNotification.tsx b/src/renderer/src/components/UpdateNotification.tsx index f70a0e069..177564233 100644 --- a/src/renderer/src/components/UpdateNotification.tsx +++ b/src/renderer/src/components/UpdateNotification.tsx @@ -3,7 +3,7 @@ * Shows when a new version is available and allows user to download/install */ import { useState, useEffect } from 'react' -import { Download, RefreshCw, X, CheckCircle } from 'lucide-react' +import { Download, RefreshCw, X, CheckCircle, AlertCircle } from 'lucide-react' import { Button } from '@/components/ui/button' import type { UpdateStatus } from '../../../shared/electron-api' @@ -39,16 +39,18 @@ export function UpdateNotification(): React.JSX.Element | null { if (dismissed) return null if (!updateStatus) return null if (updateStatus.status === 'checking' || updateStatus.status === 'not-available') return null - if (updateStatus.status === 'error') return null const version = updateStatus.info?.version + const isError = updateStatus.status === 'error' return (
{/* Icon */} -
- {updateStatus.status === 'downloaded' ? ( +
+ {isError ? ( + + ) : updateStatus.status === 'downloaded' ? ( ) : updateStatus.status === 'downloading' ? ( @@ -60,18 +62,22 @@ export function UpdateNotification(): React.JSX.Element | null { {/* Content */}
- {updateStatus.status === 'downloaded' - ? 'Update ready' - : updateStatus.status === 'downloading' - ? 'Downloading update...' - : 'Update available'} + {isError + ? 'Update failed' + : updateStatus.status === 'downloaded' + ? 'Update ready' + : updateStatus.status === 'downloading' + ? 'Downloading update...' + : 'Update available'} - {updateStatus.status === 'downloading' && updateStatus.progress - ? `${Math.round(updateStatus.progress.percent)}%` - : version - ? `Version ${version}` - : 'New version available'} + {isError + ? 'Please download manually from GitHub' + : updateStatus.status === 'downloading' && updateStatus.progress + ? `${Math.round(updateStatus.progress.percent)}%` + : version + ? `Version ${version}` + : 'New version available'}
@@ -87,6 +93,15 @@ export function UpdateNotification(): React.JSX.Element | null { Restart )} + {isError && ( + + )} {updateStatus.status !== 'downloading' && (