Skip to content

Commit 81849f2

Browse files
committed
Report an issue in settings, sidebar tweaks
1 parent 837cf50 commit 81849f2

File tree

2 files changed

+58
-33
lines changed

2 files changed

+58
-33
lines changed

src/components/main-sidebar.tsx

Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import { ButtonHTMLAttributes, useContext } from "react";
22
import { open } from "@tauri-apps/api/shell";
33
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();
48

59
export default function MainSidebar() {
610
return (
@@ -14,41 +18,47 @@ export default function MainSidebar() {
1418
function Options() {
1519
const globalContext = useContext(GlobalContext.Context);
1620
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+
/>
3237

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>
4158

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+
</>
5262
);
5363
}
5464

src/views/settings/settings-body.tsx

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ import AsyncLazyValueComponent from "../../components/async-lazy-value-component
1111
import LoadingSpinner from "../../components/svg/loading-spinner";
1212
import { TauriRouter } from "../../utils/tauri-router";
1313
import { open } from "@tauri-apps/api/dialog";
14+
import * as shell from "@tauri-apps/api/shell";
15+
import { GlobalContext } from "../../context/global-context";
1416

1517
export default function SettingsBody(props: {
1618
overrideClassName?: string;
1719
onBadPref?: (bad: boolean) => void;
1820
}) {
21+
const globalContext = useContext(GlobalContext.Context);
1922
const lazyPrefs = useBetterState<LazyValue<TauriTypes.Prefs>>({
2023
status: "loading",
2124
value: null,
@@ -45,6 +48,18 @@ export default function SettingsBody(props: {
4548
)}
4649
</AsyncLazyValueComponent>
4750
</ValidateInputContext.User>
51+
52+
{globalContext.state.currentTab === "settings" && (
53+
<p
54+
className="text-sm text-red-400 underline-offset-4 select-none cursor-pointer hover:underline transition-all"
55+
title="https://github.com/nomnomab/nomnom-unity-hub/issues"
56+
onClick={() =>
57+
shell.open("https://github.com/nomnomab/nomnom-unity-hub/issues")
58+
}
59+
>
60+
Report an issue
61+
</p>
62+
)}
4863
</div>
4964
);
5065
}

0 commit comments

Comments
 (0)