Skip to content

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

feat(ui): adopt official shell button tokens and spinner animation

hairyff11a9f34d436
diff --git a/src/components/harness-view.tsx b/src/components/harness-view.tsx
index 32d6ebc7..d1d28856 100644
--- a/src/components/harness-view.tsx
+++ b/src/components/harness-view.tsx
@@ -4,8 +4,9 @@ import { useI18n } from '../i18n/i18n-context'
import Loadable from './loadable'
import SetupScreen from './setup-screen'
+// 官方 md 主按钮:h36 / 圆角 18px 胶囊 / 中性品牌色填充无边框(对应 ui-primitives Button)
const btnPrimary
- = 'inline-flex cursor-pointer items-center justify-center rounded-md border border-accent bg-accent px-3 py-1.5 text-[13px] text-white transition-colors hover:bg-accent2 disabled:cursor-not-allowed disabled:opacity-55'
+ = 'inline-flex h-9 cursor-pointer items-center justify-center gap-1 rounded-[18px] bg-btn-fill px-3.5 text-sm leading-[22px] text-btn-ink transition-colors hover:bg-btn-fill-hover disabled:cursor-not-allowed disabled:opacity-40'
interface HarnessViewProps {
status: SetupStatus
diff --git a/src/components/sidebar-panel.tsx b/src/components/sidebar-panel.tsx
index f14713a7..f5851f1a 100644
--- a/src/components/sidebar-panel.tsx
+++ b/src/components/sidebar-panel.tsx
@@ -40,10 +40,12 @@ interface SidebarPanelProps {
onOpenBrowser: () => void
}
-// 按钮内的小型加载指示器:边框旋转动画,颜色跟随当前文字
+// 按钮内的小型加载指示器:边框旋转动画,颜色跟随当前文字。
+// 用 animate-load-spin(直接 animation + keyframes)而非 animate-spin,
+// 避免 Tailwind var() 间接层在 WebView2 下不旋转。
function Spinner() {
return (
- <span className="inline-block h-3 w-3 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent" />
+ <span className="inline-block h-3 w-3 shrink-0 animate-load-spin rounded-full border-2 border-current border-t-transparent" />
)
}
@@ -58,10 +60,14 @@ export default function SidebarPanel({
onOpenBrowser,
}: SidebarPanelProps) {
const { t, language, setLanguage } = useI18n()
+ // 官方 sm 按钮几何:h28 / 圆角 14px 胶囊 / padding 0 10px / 12px 字号(对应 ui-primitives Button)
const btnBase
- = 'inline-flex cursor-pointer items-center justify-center gap-1.5 rounded-md border border-line bg-panel2 px-2 py-1 text-xs text-ink transition-colors hover:border-line-strong hover:bg-panel-hover disabled:cursor-not-allowed disabled:opacity-55'
- const btnPrimary = `${btnBase} border-accent bg-accent text-white hover:border-accent2 hover:bg-accent2`
- const btnDanger = `${btnBase} border-[rgba(229,72,77,0.4)] text-danger`
+ = 'inline-flex h-7 cursor-pointer items-center justify-center gap-1 rounded-[14px] px-2.5 text-xs text-ink transition-colors disabled:cursor-not-allowed disabled:opacity-40'
+ // ghost 风格:透明底 + 官方 interactive-bg-hover/active 微透明底
+ const btnGhost = `${btnBase} hover:bg-btn-hover active:bg-btn-active`
+ // 主按钮:官方中性品牌色填充,无边框
+ const btnPrimary = `${btnBase} bg-btn-fill text-btn-ink hover:bg-btn-fill-hover`
+ const btnDanger = `${btnGhost} text-danger hover:bg-btn-danger-hover`
const btnBlock = ' mt-1.5 w-full'
const [info, setInfo] = useState<RuntimeInfo | null>(null)
const [port, setPort] = useState('3080')
@@ -241,13 +247,13 @@ export default function SidebarPanel({
<h3 className="mb-2 flex items-center justify-between gap-1.5 text-xs uppercase tracking-[0.06em] text-muted">{t('ui.service_url')}</h3>
<div className="flex items-center gap-1.5">
<code className="flex-1 truncate rounded-md border border-line bg-panel2 px-2 py-1.5 text-xs">{info?.service_url ?? '-'}</code>
- <button className={btnBase} onClick={copyUrl} disabled={busy === 'copy'} title={t('app.copy_url')}>
+ <button className={btnGhost} onClick={copyUrl} disabled={busy === 'copy'} title={t('app.copy_url')}>
{busy === 'copy' && <Spinner />}
{t('buttons.copy')}
</button>
</div>
<button
- className={`${btnBase}${btnBlock}`}
+ className={`${btnGhost}${btnBlock}`}
onClick={onOpenBrowser}
disabled={busyAction !== null}
>
@@ -262,7 +268,7 @@ export default function SidebarPanel({
{serviceRunning
? (
<>
- <button className={btnBase} onClick={onRestart} disabled={busyAction !== null}>
+ <button className={btnGhost} onClick={onRestart} disabled={busyAction !== null}>
{busyAction === 'restart' && <Spinner />}
{t('app.restart')}
</button>
@@ -278,7 +284,7 @@ export default function SidebarPanel({
{t('app.retry')}
</button>
)}
- <button className={btnBase} onClick={refreshInfo} disabled={busy === 'refreshInfo'}>
+ <button className={btnGhost} onClick={refreshInfo} disabled={busy === 'refreshInfo'}>
{busy === 'refreshInfo' && <Spinner />}
{t('app.refresh')}
</button>
@@ -307,7 +313,7 @@ export default function SidebarPanel({
<dt className="mt-1.5 text-muted">{t('ui.data_dir')}</dt>
<dd className="mt-0.5 flex items-center justify-center gap-2" title={info?.data_dir}>
<div className="break-all truncate">{info?.data_dir ?? '-'}</div>
- <button className={`${btnBase} flex-shrink-0 text-[10px]`} onClick={revealDataDir} disabled={busy === 'revealDataDir'}>
+ <button className={`${btnGhost} flex-shrink-0 text-[10px]`} onClick={revealDataDir} disabled={busy === 'revealDataDir'}>
{busy === 'revealDataDir' && <Spinner />}
{t('app.reveal_dir')}
</button>
@@ -352,7 +358,7 @@ export default function SidebarPanel({
<p className="mt-1 text-[11px] text-muted">{t('ui.cli_link_hint')}</p>
</div>
- <button className={`${btnBase}${btnBlock}`} onClick={saveConfig} disabled={saving}>
+ <button className={`${btnPrimary}${btnBlock}`} onClick={saveConfig} disabled={saving}>
{saving
? (
<>
@@ -383,12 +389,12 @@ export default function SidebarPanel({
<div className="flex flex-col gap-1.5">
<h3 className="mb-2 flex items-center justify-between gap-1.5 text-xs uppercase tracking-[0.06em] text-muted">
{t('ui.logs')}
- <button className={btnBase} onClick={refreshLogs} disabled={busy === 'refreshLogs'} title={t('buttons.refresh_logs')}>
+ <button className={btnGhost} onClick={refreshLogs} disabled={busy === 'refreshLogs'} title={t('buttons.refresh_logs')}>
{busy === 'refreshLogs' ? <Spinner /> : '↻'}
</button>
</h3>
<pre className="m-0 max-h-[200px] overflow-auto whitespace-pre-wrap break-all rounded-md border border-line bg-log-bg px-2 py-2 text-[11px] leading-[1.45] text-log-ink">{logs || t('ui.no_logs')}</pre>
- <button className={btnBase} onClick={clearLogs} disabled={busy === 'clearLogs'}>
+ <button className={btnGhost} onClick={clearLogs} disabled={busy === 'clearLogs'}>
{busy === 'clearLogs' && <Spinner />}
{t('buttons.clear_logs')}
</button>
diff --git a/src/style/main.css b/src/style/main.css
index c5b26b5c..07d8eeb8 100644
--- a/src/style/main.css
+++ b/src/style/main.css
@@ -25,6 +25,15 @@
--color-load-ink: #f9fafb;
--color-load-muted: #adb2b8;
--color-load-ring: rgba(255, 255, 255, 0.12);
+ /* 按钮 token:与官方 dsw alias 逐项一致(button-primary-fill/hover、
+ interactive-bg-*、border-l2),官方按钮为胶囊形中性色,非蓝色 */
+ --color-btn-fill: #0f1115;
+ --color-btn-fill-hover: #43454a;
+ --color-btn-ink: #ffffff;
+ --color-btn-border: rgba(0, 0, 0, 0.1);
+ --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);
}
html[data-theme="light"] {
@@ -47,6 +56,26 @@ html[data-theme="light"] {
--color-load-ink: #0f1115;
--color-load-muted: #81858c;
--color-load-ring: rgba(0, 0, 0, 0.1);
+ /* 按钮 token:light 主题对应官方 alias 值 */
+ --color-btn-fill: #f9fafb;
+ --color-btn-fill-hover: #ebeef2;
+ --color-btn-ink: #0f1115;
+ --color-btn-border: rgba(255, 255, 255, 0.12);
+ --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);
+}
+
+/* spinner 动画:与官方 web shell boot 页(AppRoot.module.css)逐字一致。
+ 刻意不用 Tailwind 的 animate-spin(其 animation 简写走 var(--animate-spin)
+ 间接层,WebView2 下 var() 出现在 animation 简写里可能整条失效导致不转),
+ 直接写 animation + @keyframes,确保必定旋转。 */
+@keyframes load-spin {
+ to { transform: rotate(360deg); }
+}
+
+.animate-load-spin {
+ animation: load-spin 0.8s linear infinite;
}
@layer base {
diff --git a/tailwind.config.js b/tailwind.config.js
index b6df273a..2ee63eb9 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -20,6 +20,20 @@ export default {
'ok': 'var(--color-ok)',
'log-bg': 'var(--color-log-bg)',
'log-ink': 'var(--color-log-ink)',
+ // 加载页 token:与主色不同,必须在此注册才会生成对应工具类
+ // (漏掉会整条回退 currentColor,spinner 变成同色整圈、看不出旋转)
+ 'load-bg': 'var(--color-load-bg)',
+ 'load-ink': 'var(--color-load-ink)',
+ 'load-muted': 'var(--color-load-muted)',
+ 'load-ring': 'var(--color-load-ring)',
+ // 按钮 token:官方 dsw alias 中性色(非蓝色),同样需注册才能生成工具类
+ 'btn-fill': 'var(--color-btn-fill)',
+ 'btn-fill-hover': 'var(--color-btn-fill-hover)',
+ 'btn-ink': 'var(--color-btn-ink)',
+ 'btn-border': 'var(--color-btn-border)',
+ 'btn-hover': 'var(--color-btn-hover)',
+ 'btn-active': 'var(--color-btn-active)',
+ 'btn-danger-hover': 'var(--color-btn-danger-hover)',
},
fontFamily: {
// 与官方 --dsw-font-family 保持一致