Skip to content

DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.

feat(shell): close sidebar when clicking outside its backdrop

hairyfa8c55823a387
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index f1f95c63..1223b56c 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "Deepseek Harness Desktop",
- "version": "0.1.6",
+ "version": "0.1.7",
"identifier": "io.github.hairyf.deepseek-harness-desktop",
"build": {
"beforeDevCommand": "pnpm dev",
@@ -20,7 +20,8 @@
"resizable": true,
"fullscreen": false,
"maximized": false,
- "decorations": false
+ "decorations": false,
+ "dragDropEnabled": false
}
],
"security": {
diff --git a/src/App.tsx b/src/App.tsx
index 19d48ede..3da2b82f 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -63,6 +63,12 @@ export default function App() {
});
};
+ // 点击侧边栏外内容(遮罩)时收起侧边栏
+ const handleCloseSidebar = () => {
+ setSidebarOpen(false);
+ localStorage.setItem("sidebarOpen", "false");
+ };
+
const refreshIframe = useCallback(() => {
setIframeLoaded(false);
setIframeError(false);
@@ -296,6 +302,7 @@ export default function App() {
<SidebarPanel
open={sidebarOpen}
serviceRunning={serviceRunning}
+ onClose={handleCloseSidebar}
onRestart={restart}
onShutdown={shutdown}
onStart={boot}
@@ -380,6 +387,7 @@ export default function App() {
<SidebarPanel
open={sidebarOpen}
serviceRunning={serviceRunning}
+ onClose={handleCloseSidebar}
onRestart={restart}
onShutdown={shutdown}
onStart={boot}
diff --git a/src/components/SidebarPanel.tsx b/src/components/SidebarPanel.tsx
index 50e72291..4233c461 100644
--- a/src/components/SidebarPanel.tsx
+++ b/src/components/SidebarPanel.tsx
@@ -21,6 +21,7 @@ export interface AppConfig {
interface SidebarPanelProps {
open: boolean;
serviceRunning: boolean;
+ onClose: () => void;
onRestart: () => void;
onShutdown: () => void;
onStart: () => void;
@@ -30,6 +31,7 @@ interface SidebarPanelProps {
export default function SidebarPanel({
open,
serviceRunning,
+ onClose,
onRestart,
onShutdown,
onStart,
@@ -134,11 +136,14 @@ export default function SidebarPanel({
};
return (
- <aside
- className={`fixed top-14.5 right-0 bottom-0 z-30 flex w-[300px] flex-col overflow-y-auto border-l border-t rounded-md border-line bg-panel shadow-2xl transition-transform duration-200 ease-out ${
- open ? "translate-x-0" : "translate-x-full"
- }`}
- >
+ <>
+ {/* 点击侧边栏外内容时关闭侧边栏;透明遮罩位于内容之上、侧边栏(以及窗口控制)之下 */}
+ {open && <div aria-hidden onClick={onClose} className="fixed inset-0 z-[25]" />}
+ <aside
+ className={`fixed top-14.5 right-0 bottom-0 z-30 flex w-[300px] flex-col overflow-y-auto border-l border-t rounded-md border-line bg-panel shadow-2xl transition-transform duration-200 ease-out ${
+ open ? "translate-x-0" : "translate-x-full"
+ }`}
+ >
<div className="px-3 pt-4 pb-5">
<div className="mb-[18px]">
<h3 className="mb-2 flex items-center justify-between gap-1.5 text-xs uppercase tracking-[0.06em] text-muted">{t("ui.connection_status")}</h3>
@@ -261,5 +266,6 @@ export default function SidebarPanel({
)}
</div>
</aside>
+ </>
);
}