Skip to content

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

feat(toast-provider): add custom attribute to support custom toast rendering

hairyf7171082ca045
diff --git a/src/components/toast-provider.tsx b/src/components/toast-provider.tsx
index 127c490b..2aaf0f69 100644
--- a/src/components/toast-provider.tsx
+++ b/src/components/toast-provider.tsx
@@ -8,6 +8,7 @@ import { activeQueues, placements } from '@/utils/toast'
interface ToastProviderProps {
children?: ReactNode
+ custom?: boolean
}
/**
@@ -35,28 +36,30 @@ export function ToastProvider(props: ToastProviderProps) {
placement={placement}
queue={activeQueues[placement]}
>
- {({ toast: item }) => {
- const content = { ...item.content, ...updates.get(item.key) }
- return (
- <Toast toast={item} variant={content?.variant}>
- <If cond={content?.isLoading} else={<Toast.Indicator variant={content?.variant} />}>
- <Toast.Indicator variant={content?.variant}>
- <Spinner color="current" size="sm" />
- </Toast.Indicator>
- </If>
- <Toast.Content>
- <If cond={content?.title !== undefined}>
- <Toast.Title>{content?.title}</Toast.Title>
- </If>
- <If cond={content?.description !== undefined}>
- <Toast.Description className="line-clamp-2">
- {content?.description}
- </Toast.Description>
- </If>
- </Toast.Content>
- </Toast>
- )
- }}
+ {props.custom
+ ? ({ toast: item }) => {
+ const content = { ...item.content, ...updates.get(item.key) }
+ return (
+ <Toast toast={item} variant={content?.variant}>
+ <If cond={content?.isLoading} else={<Toast.Indicator variant={content?.variant} />}>
+ <Toast.Indicator variant={content?.variant}>
+ <Spinner color="current" size="sm" />
+ </Toast.Indicator>
+ </If>
+ <Toast.Content>
+ <If cond={content?.title !== undefined}>
+ <Toast.Title>{content?.title}</Toast.Title>
+ </If>
+ <If cond={content?.description !== undefined}>
+ <Toast.Description className="line-clamp-2">
+ {content?.description}
+ </Toast.Description>
+ </If>
+ </Toast.Content>
+ </Toast>
+ )
+ }
+ : null}
</Toast.Provider>
))}
{props.children}
diff --git a/src/pet/app.tsx b/src/pet/app.tsx
index eec5648f..ac38aca0 100644
--- a/src/pet/app.tsx
+++ b/src/pet/app.tsx
@@ -49,7 +49,7 @@ export function App() {
)
return (
- <ToastProvider>
+ <ToastProvider custom>
{/* 外层只负责铺满透明窗口,保持 pointer-events-none;dragRef 绑定到 Pet 内部
与 dsh-pet .dsh-pet-hit 一致的唯一可交互命中区。useDrag 负责拖拽/双击,
useOmitIgnoreCursorEvents 负责穿透恢复,调用方无需管理鼠标流和窗口几何。 */}