Skip to content

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

feat(panel-scheduler): badge the sidebar entry for unread runs

hairyf22aff93985c9
diff --git a/packages/dsh-tauri-panel-scheduler/src/client/components/scheduler-nav-icon.tsx b/packages/dsh-tauri-panel-scheduler/src/client/components/scheduler-nav-icon.tsx
new file mode 100644
index 00000000..40edd854
--- /dev/null
+++ b/packages/dsh-tauri-panel-scheduler/src/client/components/scheduler-nav-icon.tsx
@@ -0,0 +1,21 @@
+import type { ReactElement } from 'react'
+import { Calendar, Icon } from 'dsh-tauri-ui/client'
+import { useStore } from 'dsh-tauri/client'
+import { store } from '../store'
+import { countUnreadRuns } from './schedule.utils'
+
+export function SchedulerNavIcon({ size }: { size: number }): ReactElement {
+ const state = useStore(store.scheduler)
+ return (
+ <>
+ <Icon as={Calendar} size={size} />
+ {countUnreadRuns(state.runs, state.readAt) > 0
+ ? (
+ <span className="dshp-scheduler__nav-badge">
+ <span className="dshp-scheduler__unread-dot" />
+ </span>
+ )
+ : null}
+ </>
+ )
+}
diff --git a/packages/dsh-tauri-panel-scheduler/src/client/register/panel.tsx b/packages/dsh-tauri-panel-scheduler/src/client/register/panel.tsx
index 0dee1df4..1c90cbfe 100644
--- a/packages/dsh-tauri-panel-scheduler/src/client/register/panel.tsx
+++ b/packages/dsh-tauri-panel-scheduler/src/client/register/panel.tsx
@@ -1,22 +1,32 @@
import type { ClientContext, PanelHandle } from 'dsh-tauri/client'
import type { Translate } from '../locales/index.types'
-import { Calendar, Icon, PanelPage } from 'dsh-tauri-ui/client'
+import { PanelPage } from 'dsh-tauri-ui/client'
import { definePanel, defineRegister } from 'dsh-tauri/client'
+import { SchedulerNavIcon } from '../components/scheduler-nav-icon'
import { SchedulerPanel } from '../components/scheduler-panel'
-import { PANEL_ACTION_ORDER, PANEL_ID } from '../constants'
+import { PANEL_ACTION_ORDER, PANEL_ID, REFRESH_INTERVAL_MS } from '../constants'
import { locale } from '../locales'
+import { loadScheduler } from '../service/scheduler'
import { store } from '../store'
export const panelFeature = defineRegister<ClientContext>((controller, ctx, adapter) => {
const t: Translate = locale.text
const holder: { current?: PanelHandle } = {}
+ // 侧边栏未读角标在面板关闭时也要跟上新运行,所以拉取轮询放在注册层;
+ // 面板自己只负责首屏(含对话框选项)与回焦刷新。
+ void loadScheduler(false)
+ const timer = setInterval(() => {
+ void loadScheduler(false)
+ }, REFRESH_INTERVAL_MS)
+ controller.add(() => clearInterval(timer))
+
holder.current = definePanel(ctx, {
id: PANEL_ID,
order: PANEL_ACTION_ORDER,
locale: locale.NS,
label: () => locale.text('scheduler'),
- icon: props => <Icon as={Calendar} size={props.size} />,
+ icon: props => <SchedulerNavIcon size={props.size} />,
render: () => (
<PanelPage>
<SchedulerPanel
diff --git a/packages/dsh-tauri-panel-scheduler/src/client/styles/index.cssr.ts b/packages/dsh-tauri-panel-scheduler/src/client/styles/index.cssr.ts
index de4229be..65387d24 100644
--- a/packages/dsh-tauri-panel-scheduler/src/client/styles/index.cssr.ts
+++ b/packages/dsh-tauri-panel-scheduler/src/client/styles/index.cssr.ts
@@ -52,6 +52,10 @@ export default c([
c('.dshp-scheduler__card-meta-text', { flex: '1', minWidth: '0', color: tertiary, fontSize: '12px', lineHeight: '18px', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }),
c('.dshp-scheduler__card-meta-text strong', { color: secondary, fontWeight: '600' }),
c('.dshp-scheduler__card-waiting', { flex: 'none', display: 'inline-flex', alignItems: 'center', height: '18px', padding: '0 6px', borderRadius: '6px', background: hover, color: 'var(--dsw-alias-state-business-primary)', fontSize: '11px', lineHeight: '18px', whiteSpace: 'nowrap' }),
+ // —— 未读角标:侧边栏 panellist 行(复刻官方尾部槽位几何)与执行记录标题 ——
+ c('button:has(.dshp-scheduler__nav-badge)', { position: 'relative' }),
+ c('.dshp-scheduler__nav-badge', { position: 'absolute', right: '8px', top: '50%', transform: 'translateY(-50%)', width: '16px', height: '20px', flex: 'none', display: 'inline-flex', justifyContent: 'center', alignItems: 'center', color: tertiary }),
+ c('.dshp-scheduler__unread-dot', { flex: 'none', width: '6px', height: '6px', borderRadius: '50%', background: success }),
// —— 官方控件复刻:36px 胶囊按钮(primary / secondary / danger)——
c('.dshp-scheduler__btn,.dshp-scheduler__btn--primary,.dshp-scheduler__btn--danger', { boxSizing: 'border-box', height: '36px', font: 'inherit', cursor: 'pointer', border: 'none', borderRadius: '18px', justifyContent: 'center', alignItems: 'center', gap: '4px', padding: '0 14px', fontSize: '14px', lineHeight: '22px', display: 'inline-flex', whiteSpace: 'nowrap' }),
c('.dshp-scheduler__btn', { border: `.5px solid ${borderL3}`, color: primary, background: 'transparent' }),