@@ -15,6 +15,13 @@ function formatBytes(bytes: number): string {
1515export function UpdateDialog ( { isOpen, onClose } : UpdateDialogProps ) {
1616 const { status, version, releaseNotes, progress, errorMessage, setDownloading, setError } = useUpdateStore ( ) ;
1717
18+ function handleClose ( ) {
19+ if ( status === 'available' && version ) {
20+ localStorage . setItem ( 'update-dismissed-version' , version ) ;
21+ }
22+ onClose ( ) ;
23+ }
24+
1825 async function handleDownload ( ) {
1926 setDownloading ( ) ;
2027 try {
@@ -30,21 +37,29 @@ export function UpdateDialog({ isOpen, onClose }: UpdateDialogProps) {
3037 }
3138
3239 return (
33- < Dialog isOpen = { isOpen } onClose = { onClose } title = "Update Available" size = "sm" >
40+ < Dialog isOpen = { isOpen } onClose = { handleClose } title = "Update Available" size = "sm" >
3441 { status === 'available' && (
3542 < >
3643 < p className = "text-sm text-gray-600 dark:text-gray-300" >
3744 Version < span className = "font-semibold text-gray-900 dark:text-gray-100" > { version } </ span > is available.
3845 </ p >
3946 { releaseNotes && (
4047 < div className = "mt-3 p-3 bg-gray-50 dark:bg-gray-700/50 rounded-lg max-h-40 overflow-y-auto" >
41- < p className = "text-xs text-gray-500 dark:text-gray-400 font-medium uppercase tracking-wide mb-1" > Release Notes</ p >
42- < p className = "text-sm text-gray-700 dark:text-gray-300 whitespace-pre-wrap" > { releaseNotes } </ p >
48+ < p className = "text-xs text-gray-500 dark:text-gray-400 font-medium uppercase tracking-wide mb-1" >
49+ Release Notes
50+ </ p >
51+ < p className = "text-sm text-gray-700 dark:text-gray-300 whitespace-pre-wrap" >
52+ { releaseNotes . replace ( / < [ ^ > ] + > / g, '' ) . trim ( ) }
53+ </ p >
4354 </ div >
4455 ) }
4556 < div className = "flex justify-end gap-2 mt-5" >
46- < Button onClick = { onClose } variant = "secondary" size = "md" > Later</ Button >
47- < Button onClick = { handleDownload } variant = "primary" size = "md" > Download Update</ Button >
57+ < Button onClick = { handleClose } variant = "secondary" size = "md" >
58+ Later
59+ </ Button >
60+ < Button onClick = { handleDownload } variant = "primary" size = "md" >
61+ Download Update
62+ </ Button >
4863 </ div >
4964 </ >
5065 ) }
@@ -60,23 +75,31 @@ export function UpdateDialog({ isOpen, onClose }: UpdateDialogProps) {
6075 </ div >
6176 { progress && (
6277 < p className = "text-xs text-gray-500 dark:text-gray-400 mt-2" >
63- { formatBytes ( progress . transferred ) } / { formatBytes ( progress . total ) } — { formatBytes ( progress . bytesPerSecond ) } /s
78+ { formatBytes ( progress . transferred ) } / { formatBytes ( progress . total ) } —{ ' ' }
79+ { formatBytes ( progress . bytesPerSecond ) } /s
6480 </ p >
6581 ) }
6682 < div className = "flex justify-end mt-5" >
67- < Button disabled variant = "primary" size = "md" > Downloading…</ Button >
83+ < Button disabled variant = "primary" size = "md" >
84+ Downloading…
85+ </ Button >
6886 </ div >
6987 </ >
7088 ) }
7189
7290 { status === 'downloaded' && (
7391 < >
7492 < p className = "text-sm text-gray-600 dark:text-gray-300" >
75- Version < span className = "font-semibold text-gray-900 dark:text-gray-100" > { version } </ span > is ready to install. The app will restart automatically.
93+ Version < span className = "font-semibold text-gray-900 dark:text-gray-100" > { version } </ span > is ready to
94+ install. The app will restart automatically.
7695 </ p >
7796 < div className = "flex justify-end gap-2 mt-5" >
78- < Button onClick = { onClose } variant = "secondary" size = "md" > Later</ Button >
79- < Button onClick = { handleInstall } variant = "primary" size = "md" > Restart & Install</ Button >
97+ < Button onClick = { onClose } variant = "secondary" size = "md" >
98+ Later
99+ </ Button >
100+ < Button onClick = { handleInstall } variant = "primary" size = "md" >
101+ Restart & Install
102+ </ Button >
80103 </ div >
81104 </ >
82105 ) }
@@ -85,11 +108,17 @@ export function UpdateDialog({ isOpen, onClose }: UpdateDialogProps) {
85108 < >
86109 < p className = "text-sm text-gray-600 dark:text-gray-300 mb-1" > The update could not be downloaded.</ p >
87110 { errorMessage && (
88- < p className = "text-xs text-red-500 dark:text-red-400 bg-red-50 dark:bg-red-900/20 rounded p-2" > { errorMessage } </ p >
111+ < p className = "text-xs text-red-500 dark:text-red-400 bg-red-50 dark:bg-red-900/20 rounded p-2" >
112+ { errorMessage }
113+ </ p >
89114 ) }
90115 < div className = "flex justify-end gap-2 mt-5" >
91- < Button onClick = { onClose } variant = "secondary" size = "md" > Close</ Button >
92- < Button onClick = { handleDownload } variant = "primary" size = "md" > Retry</ Button >
116+ < Button onClick = { onClose } variant = "secondary" size = "md" >
117+ Close
118+ </ Button >
119+ < Button onClick = { handleDownload } variant = "primary" size = "md" >
120+ Retry
121+ </ Button >
93122 </ div >
94123 </ >
95124 ) }
0 commit comments