feat: add update indicators and stabilize Cursor streams

This commit is contained in:
leookun committed 2026-08-24 05:24:07 +08:00
1 parent 0f23a9a9c3
commit 6170778de9
21 files changed
+360 -105

No files matched your search

+12 -1
View File
@@ -1,4 +1,6 @@
import { useEffect, useState } from "react";
import appIcon from "../../src-tauri/icons/32x32.png";
import { currentAppVersion } from "../native/appLifecycle";
import type { DesktopPlatform } from "./AppFrame";
import { WindowControls } from "./WindowControls";
import styles from "./AppHeader.module.scss";
@@ -10,6 +12,15 @@ type AppHeaderProps = {
export function AppHeader({ platform, nativeDesktop }: AppHeaderProps) {
const showNativeUi = nativeDesktop && platform !== "macos";
const [version, setVersion] = useState("…");
useEffect(() => {
let disposed = false;
void currentAppVersion().then((next) => {
if (!disposed) setVersion(next);
});
return () => { disposed = true; };
}, []);
return <header className={styles.root}>
<div className={styles.dragLayer} data-tauri-drag-region aria-hidden="true" />
@@ -17,7 +28,7 @@ export function AppHeader({ platform, nativeDesktop }: AppHeaderProps) {
{showNativeUi && <>
<div className={styles.identity} aria-label="Cursor BYOK">
<img src={appIcon} alt="" />
<span>{t("Cursor 助手 v0.1.0")}</span>
<span>{t("Cursor 助手 v{version}", { version })}</span>
</div>
<WindowControls />
</>}
@@ -83,7 +83,7 @@
}
}
.menuUnreadDot {
.menuIndicatorDot {
width: 7px;
height: 7px;
flex: 0 0 7px;
+4 -1
View File
@@ -18,6 +18,7 @@ import { useMessage } from "../components/ui/message";
import { VirtualList } from "../components/virtual/VirtualList";
import { useI18n } from "../i18n/store";
import { appStore, useAppStore } from "../store/appStore";
import { useUpdateStore } from "../store/updateStore";
import styles from "./AppLayout.module.scss";
import { PageActionsTarget } from "./PageActions";
@@ -43,6 +44,7 @@ function loadStoredAdIds(key: string): Set<string> {
export function AppLayout() {
const { busy } = useAppStore();
const { availableVersion } = useUpdateStore();
const { locale } = useI18n();
const message = useMessage();
const location = useLocation();
@@ -198,7 +200,7 @@ export function AppLayout() {
? <Icon src={item.icon} size="1.3em" />
: <Icon icon={item.icon} size="1.3em" />}
<span>{item.label}</span>
{!tutorialRead && <span className={styles.menuUnreadDot} aria-hidden="true" />}
{!tutorialRead && <span className={styles.menuIndicatorDot} aria-hidden="true" />}
</button>
</div>
: <div className={styles.navigationRow} key={item.path}>
@@ -207,6 +209,7 @@ export function AppLayout() {
? <Icon src={item.icon} size="1.3em" />
: <Icon icon={item.icon} size="1.3em" />}
<span>{item.label}</span>
{item.path === "/settings" && availableVersion && <span className={styles.menuIndicatorDot} aria-hidden="true" />}
</NavLink>
</div>}
</VirtualList>