refactor: clarify async state and subscription ownership

This commit is contained in:
手瓜一十雪 committed 2026-10-18 12:42:54 +08:00
1 parent f6ca9d5f65
commit c54aeffc77
20 files changed
+698 -316

No files matched your search

@@ -139,9 +139,7 @@ export function FileSource({
onChange={(e) => onChange(e.target.value)}
placeholder="/path/on/server/file.jpg"
/>
<span className="text-xs text-muted-foreground">
这是 <strong>运行 bot 的服务器</strong> 上的路径,不是你本机的。
</span>
<span className="text-xs text-muted-foreground">使用服务器上的文件路径</span>
</div>
)}
@@ -188,7 +186,7 @@ export function FileSource({
</>
) : (
<>
<FileUp className="h-4 w-4" /> 选择或拖入文件上传到服务器
<FileUp className="h-4 w-4" /> 选择或拖入文件
</>
)}
</label>
@@ -1,8 +1,3 @@
// TaskBadge — the app-wide floating indicator for in-flight debug tasks. Sits
// bottom-right on every page so a streaming upload/download stays visible after
// you switch tabs. Collapsed: a chip with a ring-progress + count. Expanded: a
// list with per-task progress, cancel (running) / dismiss (finished). Renders
// nothing when there are no tasks at all.
import { useState } from 'react';
import { AnimatePresence, motion } from 'motion/react';
import { CheckCircle2, Loader2, X, XCircle } from 'lucide-react';
@@ -37,7 +32,7 @@ function Row({ task, onDismiss }: { task: DebugTask; onDismiss: () => void }) {
>
<X className="h-3.5 w-3.5" />
</button>
) : (
) : task.status !== 'running' ? (
<button
type="button"
onClick={onDismiss}
@@ -46,7 +41,7 @@ function Row({ task, onDismiss }: { task: DebugTask; onDismiss: () => void }) {
>
<X className="h-3.5 w-3.5" />
</button>
)}
) : null}
</div>
{task.status === 'running' && (
<div className="h-1 overflow-hidden rounded-full bg-muted">
@@ -129,7 +124,7 @@ export function TaskBadge() {
)}
{count > 0 ? (
<span>
{count} 个任务进行中{ringPct !== null ? ` · ${ringPct}%` : ''}
{count} 个任务{ringPct !== null ? ` · ${ringPct}%` : ''}
</span>
) : (
<span className="text-muted-foreground">任务完成</span>