File tree Expand file tree Collapse file tree 5 files changed +43
-9
lines changed Expand file tree Collapse file tree 5 files changed +43
-9
lines changed Original file line number Diff line number Diff line change @@ -14,13 +14,17 @@ tauri-build = { version = "1", features = [] }
14
14
anyhow = " 1.0.86"
15
15
thiserror = " 1.0.63"
16
16
showfile = " 0.1.1"
17
- tauri = { version = " 1" , features = [" dialog-all" , " shell-open" ] }
17
+ tauri = { version = " 1" , features = [
18
+ " window-show" ,
19
+ " dialog-all" ,
20
+ " shell-open" ,
21
+ ] }
18
22
serde = { version = " 1" , features = [" derive" ] }
19
23
serde_json = " 1"
20
24
flate2 = " 1.0.30"
21
25
tar = " 0.4.41"
22
26
dirs-next = " 2.0.0"
23
- filesize = " 0.2.0" # or "postgres", or "mysql"
27
+ filesize = " 0.2.0" # or "postgres", or "mysql"
24
28
25
29
[features ]
26
30
# This feature is used for production builds or when a dev server is not specified, DO NOT REMOVE!!
Original file line number Diff line number Diff line change 18
18
},
19
19
"dialog" : {
20
20
"all" : true
21
+ },
22
+ "window" : {
23
+ "show" : true
21
24
}
22
25
},
23
26
"windows" : [
28
31
"minWidth" : 1024 ,
29
32
"minHeight" : 568 ,
30
33
"resizable" : true ,
31
- "theme" : " Dark"
34
+ "theme" : " Dark" ,
35
+ "visible" : false
32
36
}
33
37
],
34
38
"security" : {
Original file line number Diff line number Diff line change 1
- import { ButtonHTMLAttributes , useContext } from "react" ;
1
+ import { ButtonHTMLAttributes , useContext , useEffect } from "react" ;
2
2
import { open } from "@tauri-apps/api/shell" ;
3
3
import { GlobalContext } from "../context/global-context" ;
4
4
import { getVersion } from "@tauri-apps/api/app" ;
5
- import AsyncComponent from "./async-component" ;
6
-
7
- const appVersion = await getVersion ( ) ;
5
+ import useBetterState from "../hooks/useBetterState" ;
6
+ import { LazyValue } from "../utils" ;
8
7
9
8
export default function MainSidebar ( ) {
10
9
return (
@@ -17,6 +16,21 @@ export default function MainSidebar() {
17
16
18
17
function Options ( ) {
19
18
const globalContext = useContext ( GlobalContext . Context ) ;
19
+ const appVersion = useBetterState < LazyValue < string > > ( {
20
+ status : "loading" ,
21
+ value : null ,
22
+ } ) ;
23
+
24
+ useEffect ( ( ) => {
25
+ getVersion ( )
26
+ . then ( ( v ) => {
27
+ appVersion . set ( { status : "success" , value : v } ) ;
28
+ } )
29
+ . catch ( ( e ) => {
30
+ appVersion . set ( { status : "error" , value : e . message } ) ;
31
+ } ) ;
32
+ } , [ ] ) ;
33
+
20
34
return (
21
35
< >
22
36
< div className = "px-4 gap-3 flex flex-col flex-grow pb-3" >
@@ -56,7 +70,9 @@ function Options() {
56
70
</ span >
57
71
</ p >
58
72
59
- < p className = "text-xs text-stone-400 select-none px-3" > v{ appVersion } </ p >
73
+ < p className = "text-xs text-stone-400 select-none px-3" >
74
+ v{ appVersion . value . value ?? "???" }
75
+ </ p >
60
76
</ div >
61
77
</ >
62
78
) ;
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import React from "react";
2
2
import ReactDOM from "react-dom/client" ;
3
3
import App from "./App" ;
4
4
import { GlobalContext } from "./context/global-context" ;
5
+ import { appWindow } from "@tauri-apps/api/window" ;
5
6
6
7
ReactDOM . createRoot ( document . getElementById ( "root" ) as HTMLElement ) . render (
7
8
< React . StrictMode >
@@ -10,3 +11,5 @@ ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
10
11
</ GlobalContext . User >
11
12
</ React . StrictMode >
12
13
) ;
14
+
15
+ appWindow . show ( ) . then ( ( ) => { } ) ;
Original file line number Diff line number Diff line change @@ -390,7 +390,14 @@ function TemplateInfo({
390
390
tgzJson . set ( { status : "success" , value : json } ) ;
391
391
newProjectContext . dispatch ( {
392
392
type : "set_packages" ,
393
- packages : Object . keys ( json . tgzPackage . dependencies ?? { } ) ?? [ ] ,
393
+ packages : Object . entries ( json . tgzPackage . dependencies ?? { } ) . map (
394
+ ( [ k , v ] ) => {
395
+ return {
396
+ name : k ,
397
+ version : ( v as string ) ?? undefined ,
398
+ } ;
399
+ }
400
+ ) ,
394
401
} ) ;
395
402
396
403
newProjectContext . dispatch ( {
You can’t perform that action at this time.
0 commit comments