1
1
import { ButtonHTMLAttributes , useContext } from "react" ;
2
2
import { open } from "@tauri-apps/api/shell" ;
3
3
import { GlobalContext } from "../context/global-context" ;
4
+ import { getVersion } from "@tauri-apps/api/app" ;
5
+ import AsyncComponent from "./async-component" ;
6
+
7
+ const appVersion = await getVersion ( ) ;
4
8
5
9
export default function MainSidebar ( ) {
6
10
return (
@@ -14,41 +18,47 @@ export default function MainSidebar() {
14
18
function Options ( ) {
15
19
const globalContext = useContext ( GlobalContext . Context ) ;
16
20
return (
17
- < div className = "px-4 gap-3 flex flex-col flex-grow pb-3" >
18
- < OptionItem
19
- title = "Projects"
20
- selected = { globalContext . state . currentTab === "projects" }
21
- onClick = { ( ) =>
22
- globalContext . dispatch ( { type : "change_tab" , tab : "projects" } )
23
- }
24
- />
25
- < OptionItem
26
- title = "Editors"
27
- selected = { globalContext . state . currentTab === "editors" }
28
- onClick = { ( ) =>
29
- globalContext . dispatch ( { type : "change_tab" , tab : "editors" } )
30
- }
31
- />
21
+ < >
22
+ < div className = "px-4 gap-3 flex flex-col flex-grow pb-3" >
23
+ < OptionItem
24
+ title = "Projects"
25
+ selected = { globalContext . state . currentTab === "projects" }
26
+ onClick = { ( ) =>
27
+ globalContext . dispatch ( { type : "change_tab" , tab : "projects" } )
28
+ }
29
+ />
30
+ < OptionItem
31
+ title = "Editors"
32
+ selected = { globalContext . state . currentTab === "editors" }
33
+ onClick = { ( ) =>
34
+ globalContext . dispatch ( { type : "change_tab" , tab : "editors" } )
35
+ }
36
+ />
32
37
33
- < OptionItem
34
- title = "Settings"
35
- selected = { globalContext . state . currentTab === "settings" }
36
- onClick = { ( ) =>
37
- globalContext . dispatch ( { type : "change_tab" , tab : "settings" } )
38
- }
39
- className = "mt-auto"
40
- />
38
+ < OptionItem
39
+ title = "Settings"
40
+ selected = { globalContext . state . currentTab === "settings" }
41
+ onClick = { ( ) =>
42
+ globalContext . dispatch ( { type : "change_tab" , tab : "settings" } )
43
+ }
44
+ className = "mt-auto"
45
+ />
46
+ </ div >
47
+ < div className = "px-4 gap-1 flex flex-col pb-3" >
48
+ < p className = "text-sm text-stone-400 select-none px-3" >
49
+ < span className = "text-xs" > Made by</ span > < br />
50
+ < span
51
+ className = "text-stone-300 transition-colors hover:text-stone-50 hover:underline cursor-pointer"
52
+ title = "https://github.com/nomnomab"
53
+ onClick = { ( ) => open ( "https://github.com/nomnomab" ) }
54
+ >
55
+ Andrew Burke
56
+ </ span >
57
+ </ p >
41
58
42
- < p className = "text-sm text-stone-400 select-none px-3" >
43
- Made by < br />
44
- < span
45
- className = "text-stone-300 transition-colors hover:text-stone-50 hover:underline cursor-pointer"
46
- onClick = { ( ) => open ( "https://github.com/nomnomab" ) }
47
- >
48
- Andrew Burke
49
- </ span >
50
- </ p >
51
- </ div >
59
+ < p className = "text-xs text-stone-400 select-none px-3" > v{ appVersion } </ p >
60
+ </ div >
61
+ </ >
52
62
) ;
53
63
}
54
64
0 commit comments