Skip to content

Commit 8a64aec

Browse files
committed
clean status bar
1 parent f091fc2 commit 8a64aec

File tree

1 file changed

+12
-56
lines changed

1 file changed

+12
-56
lines changed
Lines changed: 12 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,23 @@
11
import { StatusBarMenu } from "@components/StatusBarMenu";
2-
import { GearIcon } from "@radix-ui/react-icons";
32
import {
43
Badge,
54
Box,
65
Code,
7-
Flex,
8-
IconButton,
9-
Kbd,
10-
Tooltip,
6+
Flex, Kbd
117
} from "@radix-ui/themes";
128
import { useStatusBarStore } from "@stores/statusBarStore";
13-
import { useEffect, useState } from "react";
9+
1410
import { IS_DEV } from "@/constants/environment";
1511

1612
interface StatusBarProps {
1713
showKeyHints?: boolean;
18-
onOpenSettings?: () => void;
1914
}
2015

2116
export function StatusBar({
2217
showKeyHints = true,
23-
onOpenSettings,
18+
2419
}: StatusBarProps) {
2520
const { statusText, keyHints } = useStatusBarStore();
26-
const [appVersion, setAppVersion] = useState<string | null>(null);
27-
28-
const fallbackVersion = import.meta.env.VITE_APP_VERSION ?? "dev";
29-
30-
useEffect(() => {
31-
let cancelled = false;
32-
33-
window.electronAPI
34-
?.getAppVersion()
35-
.then((version) => {
36-
if (!cancelled) {
37-
setAppVersion(version);
38-
}
39-
})
40-
.catch((error) => {
41-
console.warn("[statusbar] Failed to load app version", error);
42-
});
43-
44-
return () => {
45-
cancelled = true;
46-
};
47-
}, []);
48-
49-
const version = appVersion ?? fallbackVersion;
5021

5122
return (
5223
<Box className="flex flex-row items-center justify-between border-gray-6 border-t bg-gray-2 px-4 py-2">
@@ -79,30 +50,15 @@ export function StatusBar({
7950
</Flex>
8051
)}
8152

82-
<Flex align="center" gap="2">
83-
<Badge color={IS_DEV ? "orange" : "green"} size="1">
84-
<Code size="1" variant="ghost">
85-
{IS_DEV ? "DEV" : "PROD"}
86-
</Code>
87-
</Badge>
88-
<Badge color="gray" size="1">
89-
<Code size="1" variant="ghost">
90-
v{version}
91-
</Code>
92-
</Badge>
93-
{onOpenSettings && (
94-
<Tooltip content="Settings">
95-
<IconButton
96-
size="1"
97-
variant="ghost"
98-
color="gray"
99-
onClick={onOpenSettings}
100-
>
101-
<GearIcon />
102-
</IconButton>
103-
</Tooltip>
104-
)}
105-
</Flex>
53+
{IS_DEV && (
54+
<Flex align="center" gap="2">
55+
<Badge color="orange" size="1">
56+
<Code size="1" variant="ghost">
57+
DEV
58+
</Code>
59+
</Badge>
60+
</Flex>
61+
)}
10662
</Box>
10763
);
10864
}

0 commit comments

Comments
 (0)