@@ -11,6 +11,7 @@ import FacebookIcon from '@material-ui/icons/Facebook';
11
11
import { Config } from '../../config' ;
12
12
import LogotypeIcon from '../../../../assets/logotype.svg' ;
13
13
import DiscordIcon from '../../../../assets/DiscordIcon.svg' ;
14
+ import { useCheckForUpdatesQuery } from '../../gql/generated/types' ;
14
15
15
16
const useStyles = makeStyles ( ( theme ) => ( {
16
17
title : {
@@ -27,6 +28,11 @@ const useStyles = makeStyles((theme) => ({
27
28
version : {
28
29
fontSize : '0.4em' ,
29
30
} ,
31
+ updateAvailable : {
32
+ fontSize : '0.4em' ,
33
+ marginLeft : '0.4em' ,
34
+ color : 'rgb(52 216 52) !important' ,
35
+ } ,
30
36
toolbar : {
31
37
display : 'flex' ,
32
38
justifyContent : 'space-between' ,
@@ -54,6 +60,11 @@ interface HeaderProps {
54
60
55
61
const Header : FunctionComponent < HeaderProps > = memo ( ( { className } ) => {
56
62
const styles = useStyles ( ) ;
63
+ const { data : updateResponse } = useCheckForUpdatesQuery ( {
64
+ variables : {
65
+ currentVersion : process . env . EXPRESSLRS_CONFIGURATOR_VERSION || '0.0.1' ,
66
+ } ,
67
+ } ) ;
57
68
return (
58
69
< AppBar position = "static" color = "default" className = { className } >
59
70
< Toolbar className = { styles . toolbar } >
@@ -68,6 +79,17 @@ const Header: FunctionComponent<HeaderProps> = memo(({ className }) => {
68
79
< span className = { styles . version } >
69
80
v{ process . env . EXPRESSLRS_CONFIGURATOR_VERSION }
70
81
</ span >
82
+ { updateResponse ?. checkForUpdates ?. updateAvailable && (
83
+ < a
84
+ href = { updateResponse ?. checkForUpdates ?. releaseUrl }
85
+ target = "_blank"
86
+ title = "Click to download a newest release"
87
+ rel = "noreferrer noreferrer"
88
+ className = { styles . updateAvailable }
89
+ >
90
+ Update is available!
91
+ </ a >
92
+ ) }
71
93
</ Typography >
72
94
</ div >
73
95
< div className = { styles . social } >
0 commit comments