Skip to content

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

refactor(components): rename ShellNavBar to Navbar and use theme tokens

hairyf0f5b740d76d1
diff --git a/src/components/harness-webview.tsx b/src/components/harness-webview.tsx
index 1f52cb62..3fea6acd 100644
--- a/src/components/harness-webview.tsx
+++ b/src/components/harness-webview.tsx
@@ -6,12 +6,12 @@ import { useStore } from 'valtio-define'
import { useIframeShim } from '@/hooks/use-iframe-shim'
import { harness } from '../store/modules/harness'
import Loadable from './loadable'
+import Navbar from './navbar'
import PreinstallSetup from './preinstall-setup'
import Setup from './setup'
-import ShellNavBar from './shell-nav-bar'
/**
- * 主区域视图:壳层导航栏(ShellNavBar)常驻顶部,
+ * 主区域视图:壳层导航栏(Navbar)常驻顶部,
* 安装/错误态渲染 Setup,就绪态渲染 iframe
* (挂载后加载职责交给 dsh 应用内官方 boot 页,避免两套 loading 叠加)。
* 状态与方法全部来自 harness store,不再接收 props。
@@ -34,7 +34,7 @@ export default function HarnessWebview() {
if (status === 'error') {
return (
<main className="relative flex min-h-0 flex-1 flex-col bg-canvas">
- <ShellNavBar />
+ <Navbar />
<div className="min-h-0 flex-1">
<Setup />
</div>
@@ -46,7 +46,7 @@ export default function HarnessWebview() {
if (status === 'preinstall') {
return (
<main className="relative flex min-h-0 w-full flex-col bg-canvas">
- <ShellNavBar />
+ <Navbar />
<div className="min-h-0 flex-1">
<PreinstallSetup />
</div>
@@ -57,7 +57,7 @@ export default function HarnessWebview() {
if (status !== 'ready') {
return (
<main className="relative flex min-h-0 w-full flex-col bg-canvas">
- <ShellNavBar />
+ <Navbar />
<div className="min-h-0 flex-1">
<Setup />
</div>
@@ -67,7 +67,7 @@ export default function HarnessWebview() {
return (
<main className="relative flex min-h-0 flex-1 flex-col bg-canvas">
- <ShellNavBar iframeRef={iframeRef} />
+ <Navbar iframeRef={iframeRef} />
{/* iframe 区域:加载失败时用覆盖层展示重试(iframe 保持挂载,重试复用) */}
<div className="relative min-h-0 flex-1">
diff --git a/src/components/shell-nav-bar.tsx b/src/components/navbar.tsx
similarity index 88%
rename from src/components/shell-nav-bar.tsx
rename to src/components/navbar.tsx
index 4dd343f2..b71887ed 100644
--- a/src/components/shell-nav-bar.tsx
+++ b/src/components/navbar.tsx
@@ -41,12 +41,12 @@ import { useIframeTauri } from '../hooks/use-iframe-tauri'
*/
const TAURI_PLUGIN_ID = 'dsh-tauri'
-interface ShellNavBarProps {
+interface NavbarProps {
/** 就绪态 iframe;传入时启用左侧导航控制 */
iframeRef?: RefObject<HTMLIFrameElement | null>
}
-export default function ShellNavBar({ iframeRef }: ShellNavBarProps) {
+export default function Navbar({ iframeRef }: NavbarProps) {
const { t } = useTranslation()
const { plugins } = useDshPlugins()
const { sidebarCollapsed, canGoBack, canGoForward, sendNav } = useIframeTauri(iframeRef)
@@ -70,13 +70,13 @@ export default function ShellNavBar({ iframeRef }: ShellNavBarProps) {
}
return (
- <div className="shell-nav">
+ <div className="relative flex h-11 w-full flex-none select-none items-center gap-0.5 border-b border-line bg-canvas px-1.5 dark:bg-[#1b1b1c]">
<If cond={iframeRef != null && tauriEnabled}>
<Button
+ className="rounded-lg size-7"
isIconOnly
size="sm"
variant="ghost"
- className="shell-nav__btn"
aria-label={t(sidebarCollapsed ? 'nav.sidebar_expand' : 'nav.sidebar_collapse')}
onPress={() => { sendNav('sidebar:toggle') }}
>
@@ -88,10 +88,10 @@ export default function ShellNavBar({ iframeRef }: ShellNavBarProps) {
</Button>
<Button
+ className="rounded-lg size-7"
isIconOnly
size="sm"
variant="ghost"
- className="shell-nav__btn"
aria-label={t('nav.back')}
isDisabled={!canGoBack}
onPress={() => { sendNav('page:prev') }}
@@ -100,10 +100,10 @@ export default function ShellNavBar({ iframeRef }: ShellNavBarProps) {
</Button>
<Button
+ className="rounded-lg size-7"
isIconOnly
size="sm"
variant="ghost"
- className="shell-nav__btn"
aria-label={t('nav.forward')}
isDisabled={!canGoForward}
onPress={() => { sendNav('page:next') }}
@@ -114,16 +114,16 @@ export default function ShellNavBar({ iframeRef }: ShellNavBarProps) {
{/* 拖拽区:Tauri 原生拖拽(仅此元素带 data-tauri-drag-region,按钮不受影响) */}
<div
- className="shell-nav__drag"
+ className="min-w-0 flex-1 self-stretch"
data-tauri-drag-region
onDoubleClick={() => { void getCurrentWindow().toggleMaximize() }}
/>
<Button
+ className="rounded-lg size-7"
isIconOnly
size="sm"
variant="ghost"
- className="shell-nav__btn"
aria-label={t('nav.minimize')}
onPress={() => { handleWindowAction('minimize') }}
>
@@ -131,10 +131,10 @@ export default function ShellNavBar({ iframeRef }: ShellNavBarProps) {
</Button>
<Button
+ className="rounded-lg size-7"
isIconOnly
size="sm"
variant="ghost"
- className="shell-nav__btn"
aria-label={t('nav.maximize')}
onPress={() => { handleWindowAction('maximize') }}
>
@@ -142,10 +142,10 @@ export default function ShellNavBar({ iframeRef }: ShellNavBarProps) {
</Button>
<Button
+ className="rounded-lg size-7 transition-colors enabled:hover:bg-danger/16 enabled:hover:text-danger"
isIconOnly
size="sm"
variant="ghost"
- className="shell-nav__btn shell-nav__btn--danger"
aria-label={t('nav.background')}
onPress={() => { handleWindowAction('background') }}
>
diff --git a/src/style/main.css b/src/style/main.css
index 0df40d60..4e93245c 100644
--- a/src/style/main.css
+++ b/src/style/main.css
@@ -39,6 +39,9 @@
--color-btn-hover: rgba(38, 49, 72, 0.06);
--color-btn-active: rgba(38, 49, 72, 0.1);
--color-btn-danger-hover: rgba(236, 19, 19, 0.05);
+ /* 壳层导航栏 token:ShellNavBar 按钮 hover/active 覆盖层(浅色主题同下) */
+ --color-nav-hover: rgba(255, 255, 255, 0.08);
+ --color-nav-active: rgba(255, 255, 255, 0.12);
}
html[data-theme="light"] {
@@ -71,6 +74,9 @@ html[data-theme="light"] {
--color-btn-hover: rgba(255, 255, 255, 0.08);
--color-btn-active: rgba(255, 255, 255, 0.14);
--color-btn-danger-hover: rgba(242, 90, 90, 0.15);
+ /* 壳层导航栏 token:浅色主题对应官方交互覆盖层 */
+ --color-nav-hover: rgba(0, 0, 0, 0.06);
+ --color-nav-active: rgba(0, 0, 0, 0.1);
}
/* spinner 动画:与官方 web shell boot 页(AppRoot.module.css)逐字一致。
@@ -101,71 +107,3 @@ html[data-theme="light"] {
}
}
-/* ── 顶部导航栏(壳层 ShellNavBar,常驻)────────────────────────
- 44px、无边框、主题色按钮:左侧为 iframe 导航控制(侧边栏/后退/前进),
- 右侧为窗口控制(最小化/最大化/后台化),空白区为 Tauri 原生拖拽。 */
-.shell-nav {
- --shell-nav-ink: #f9fafb;
- --shell-nav-muted: #adb2b8;
- --shell-nav-hover: rgba(255, 255, 255, 0.08);
- --shell-nav-active: rgba(255, 255, 255, 0.12);
- --shell-nav-line: rgba(255, 255, 255, 0.12);
- --shell-nav-danger: #f25a5a;
-
- position: relative;
- width: 100%;
- flex: none;
- height: 44px;
- display: flex;
- align-items: center;
- gap: 2px;
- padding: 0 6px;
- box-sizing: border-box;
- background: rgb(21, 21, 23);
- border-bottom: 1px solid var(--shell-nav-line);
- user-select: none;
- -webkit-user-select: none;
-}
-html[data-theme="light"] .shell-nav {
- --shell-nav-ink: #0f1115;
- --shell-nav-muted: #61666b;
- --shell-nav-hover: rgba(0, 0, 0, 0.06);
- --shell-nav-active: rgba(0, 0, 0, 0.1);
- --shell-nav-line: rgba(0, 0, 0, 0.12);
- background: rgb(255, 255, 255);
-}
-.shell-nav__btn {
- display: inline-flex;
- align-items: center;
- justify-content: center;
- width: 32px;
- height: 32px;
- padding: 0;
- border: none;
- border-radius: 8px;
- background: transparent;
- color: var(--shell-nav-ink);
- cursor: default;
- outline: none;
- transition: background-color 0.12s ease, color 0.12s ease;
-}
-.shell-nav__btn:hover {
- background: var(--shell-nav-hover);
-}
-.shell-nav__btn:active {
- background: var(--shell-nav-active);
-}
-.shell-nav__btn[aria-disabled='true'],
-.shell-nav__btn:disabled {
- color: var(--shell-nav-muted);
- background: transparent;
-}
-.shell-nav__btn--danger:hover {
- background: rgba(242, 90, 90, 0.16);
- color: var(--shell-nav-danger);
-}
-.shell-nav__drag {
- flex: 1;
- align-self: stretch;
- min-width: 0;
-}