Skip to content

Commit 5bddbf3

Browse files
committed
Merge branch 'dev'
2 parents b3f5ffe + 3ac1b12 commit 5bddbf3

File tree

5 files changed

+43
-9
lines changed

5 files changed

+43
-9
lines changed

src-tauri/Cargo.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,17 @@ tauri-build = { version = "1", features = [] }
1414
anyhow = "1.0.86"
1515
thiserror = "1.0.63"
1616
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+
] }
1822
serde = { version = "1", features = ["derive"] }
1923
serde_json = "1"
2024
flate2 = "1.0.30"
2125
tar = "0.4.41"
2226
dirs-next = "2.0.0"
23-
filesize = "0.2.0" # or "postgres", or "mysql"
27+
filesize = "0.2.0" # or "postgres", or "mysql"
2428

2529
[features]
2630
# This feature is used for production builds or when a dev server is not specified, DO NOT REMOVE!!

src-tauri/tauri.conf.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
},
1919
"dialog": {
2020
"all": true
21+
},
22+
"window": {
23+
"show": true
2124
}
2225
},
2326
"windows": [
@@ -28,7 +31,8 @@
2831
"minWidth": 1024,
2932
"minHeight": 568,
3033
"resizable": true,
31-
"theme": "Dark"
34+
"theme": "Dark",
35+
"visible": false
3236
}
3337
],
3438
"security": {

src/components/main-sidebar.tsx

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
import { ButtonHTMLAttributes, useContext } from "react";
1+
import { ButtonHTMLAttributes, useContext, useEffect } from "react";
22
import { open } from "@tauri-apps/api/shell";
33
import { GlobalContext } from "../context/global-context";
44
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";
87

98
export default function MainSidebar() {
109
return (
@@ -17,6 +16,21 @@ export default function MainSidebar() {
1716

1817
function Options() {
1918
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+
2034
return (
2135
<>
2236
<div className="px-4 gap-3 flex flex-col flex-grow pb-3">
@@ -56,7 +70,9 @@ function Options() {
5670
</span>
5771
</p>
5872

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>
6076
</div>
6177
</>
6278
);

src/main.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from "react";
22
import ReactDOM from "react-dom/client";
33
import App from "./App";
44
import { GlobalContext } from "./context/global-context";
5+
import { appWindow } from "@tauri-apps/api/window";
56

67
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
78
<React.StrictMode>
@@ -10,3 +11,5 @@ ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
1011
</GlobalContext.User>
1112
</React.StrictMode>
1213
);
14+
15+
appWindow.show().then(() => {});

src/views/new-project/template-view.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,14 @@ function TemplateInfo({
390390
tgzJson.set({ status: "success", value: json });
391391
newProjectContext.dispatch({
392392
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+
),
394401
});
395402

396403
newProjectContext.dispatch({

0 commit comments

Comments
 (0)