@@ -2,6 +2,23 @@ import { useEffect, useState } from "react";
22import { useHealth } from "src/hooks" ;
33import { T } from "src/locale" ;
44
5+ const compareVersions = ( current : string , latest : string ) : boolean => {
6+ const cleanCurrent = current . replace ( / ^ v / , "" ) ;
7+ const cleanLatest = latest . replace ( / ^ v / , "" ) ;
8+
9+ const currentParts = cleanCurrent . split ( "." ) . map ( Number ) ;
10+ const latestParts = cleanLatest . split ( "." ) . map ( Number ) ;
11+
12+ for ( let i = 0 ; i < Math . max ( currentParts . length , latestParts . length ) ; i ++ ) {
13+ const curr = currentParts [ i ] || 0 ;
14+ const lat = latestParts [ i ] || 0 ;
15+
16+ if ( lat > curr ) return true ;
17+ if ( lat < curr ) return false ;
18+ }
19+ return false ;
20+ } ;
21+
522export function SiteFooter ( ) {
623 const health = useHealth ( ) ;
724 const [ latestVersion , setLatestVersion ] = useState < string | null > ( null ) ;
@@ -15,23 +32,6 @@ export function SiteFooter() {
1532 return `v${ v . major } .${ v . minor } .${ v . revision } ` ;
1633 } ;
1734
18- const compareVersions = ( current : string , latest : string ) : boolean => {
19- const cleanCurrent = current . replace ( / ^ v / , "" ) ;
20- const cleanLatest = latest . replace ( / ^ v / , "" ) ;
21-
22- const currentParts = cleanCurrent . split ( "." ) . map ( Number ) ;
23- const latestParts = cleanLatest . split ( "." ) . map ( Number ) ;
24-
25- for ( let i = 0 ; i < Math . max ( currentParts . length , latestParts . length ) ; i ++ ) {
26- const curr = currentParts [ i ] || 0 ;
27- const lat = latestParts [ i ] || 0 ;
28-
29- if ( lat > curr ) return true ;
30- if ( lat < curr ) return false ;
31- }
32- return false ;
33- } ;
34-
3535 useEffect ( ( ) => {
3636 const checkForUpdates = async ( ) => {
3737 try {
0 commit comments