|
1 | 1 | import { StatusBarMenu } from "@components/StatusBarMenu"; |
2 | | -import { GearIcon } from "@radix-ui/react-icons"; |
3 | 2 | import { |
4 | 3 | Badge, |
5 | 4 | Box, |
6 | 5 | Code, |
7 | | - Flex, |
8 | | - IconButton, |
9 | | - Kbd, |
10 | | - Tooltip, |
| 6 | + Flex, Kbd |
11 | 7 | } from "@radix-ui/themes"; |
12 | 8 | import { useStatusBarStore } from "@stores/statusBarStore"; |
13 | | -import { useEffect, useState } from "react"; |
| 9 | + |
14 | 10 | import { IS_DEV } from "@/constants/environment"; |
15 | 11 |
|
16 | 12 | interface StatusBarProps { |
17 | 13 | showKeyHints?: boolean; |
18 | | - onOpenSettings?: () => void; |
19 | 14 | } |
20 | 15 |
|
21 | 16 | export function StatusBar({ |
22 | 17 | showKeyHints = true, |
23 | | - onOpenSettings, |
| 18 | + |
24 | 19 | }: StatusBarProps) { |
25 | 20 | 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; |
50 | 21 |
|
51 | 22 | return ( |
52 | 23 | <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({ |
79 | 50 | </Flex> |
80 | 51 | )} |
81 | 52 |
|
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 | + )} |
106 | 62 | </Box> |
107 | 63 | ); |
108 | 64 | } |
0 commit comments