1
1
import { invoke } from "@tauri-apps/api/core" ;
2
+ import { getVersion } from "@tauri-apps/api/app" ;
2
3
import { useEffect , useState } from "react" ;
3
4
import { backendFormatToShortcut , Shortcut } from "../utils/keyboardUtils" ;
4
5
import { updateManager , UpdateInfo } from "../utils/updater" ;
@@ -11,6 +12,8 @@ export function InfoPage() {
11
12
const [ isCheckingUpdate , setIsCheckingUpdate ] = useState ( false ) ;
12
13
const [ isDownloading , setIsDownloading ] = useState ( false ) ;
13
14
const [ downloadProgress , setDownloadProgress ] = useState ( 0 ) ;
15
+ const [ statusMessage , setStatusMessage ] = useState < string | null > ( null ) ;
16
+ const [ currentVersion , setCurrentVersion ] = useState < string > ( "" ) ;
14
17
15
18
// Load initial settings and check for updates
16
19
useEffect ( ( ) => {
@@ -50,6 +53,9 @@ export function InfoPage() {
50
53
} ;
51
54
52
55
loadSettings ( ) ;
56
+ getVersion ( ) . then ( setCurrentVersion ) . catch ( ( error ) => {
57
+ console . error ( "❌ Failed to get app version:" , error ) ;
58
+ } ) ;
53
59
// Check for updates 2 seconds after loading to avoid blocking UI
54
60
setTimeout ( checkForUpdatesOnLaunch , 2000 ) ;
55
61
} , [ ] ) ;
@@ -62,9 +68,13 @@ export function InfoPage() {
62
68
if ( ! update ) {
63
69
// Show a message that no updates are available
64
70
console . log ( 'No updates available' ) ;
71
+ setStatusMessage ( currentVersion ? `Milo v${ currentVersion } is up to date!` : 'Milo is up to date!' ) ;
72
+ } else {
73
+ setStatusMessage ( null ) ;
65
74
}
66
75
} catch ( error ) {
67
76
console . error ( 'Failed to check for updates:' , error ) ;
77
+ setStatusMessage ( 'Failed to check for updates. Please try again.' ) ;
68
78
} finally {
69
79
setIsCheckingUpdate ( false ) ;
70
80
}
@@ -196,6 +206,12 @@ export function InfoPage() {
196
206
</ p >
197
207
</ div >
198
208
) }
209
+
210
+ { statusMessage && ! updateInfo && ! isDownloading && (
211
+ < div className = "p-3 bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg text-xs text-green-800 dark:text-green-200" >
212
+ { statusMessage }
213
+ </ div >
214
+ ) }
199
215
</ div >
200
216
</ div >
201
217
</ div >
0 commit comments