|
|
@@ -0,0 +1,104 @@
|
|
|
+// ============================================================
|
|
|
+// TaskDispatchModule —— 任务分发独立模块(M2 骨架)
|
|
|
+// ============================================================
|
|
|
+// 设计合同:docs/specs/workspace-task-dispatch.md §8(三次/四次对齐形态)。
|
|
|
+// 四区布局:项目选择器 → 分析动作 → 按执行计划分组的任务清单 → 模块会话历史。
|
|
|
+// M2 骨架仅承载布局与状态框架;分析编排(M3)、确认执行(M4)、历史数据(M3)
|
|
|
+// 逐步填充。样式遵守 DESIGN.md(text-ui-* 字号体系)。
|
|
|
+
|
|
|
+import { useMemo, useState } from "react";
|
|
|
+import { Button } from "@/components/ui/button.js";
|
|
|
+import {
|
|
|
+ Select,
|
|
|
+ SelectContent,
|
|
|
+ SelectItem,
|
|
|
+ SelectTrigger,
|
|
|
+ SelectValue,
|
|
|
+} from "@/components/ui/select.js";
|
|
|
+import { useZCodeIntl } from "@/i18n/IntlProvider.js";
|
|
|
+import { cn } from "@/components/lib/utils.js";
|
|
|
+
|
|
|
+/** 模块内可选的项目目标(本地 + 远程 workspace)。 */
|
|
|
+export interface TaskDispatchWorkspaceOption {
|
|
|
+ key: string;
|
|
|
+ label: string;
|
|
|
+ workspacePath: string;
|
|
|
+ workspaceIdentity?: string;
|
|
|
+}
|
|
|
+
|
|
|
+export function TaskDispatchModule({
|
|
|
+ workspaceOptions,
|
|
|
+}: {
|
|
|
+ /** 由宿主注入可选项目列表(侧栏 workspace tabs 派生)。 */
|
|
|
+ workspaceOptions: TaskDispatchWorkspaceOption[];
|
|
|
+}) {
|
|
|
+ const { intl } = useZCodeIntl();
|
|
|
+ const [selectedKey, setSelectedKey] = useState<string | null>(
|
|
|
+ workspaceOptions[0]?.key ?? null,
|
|
|
+ );
|
|
|
+ const selected = useMemo(
|
|
|
+ () => workspaceOptions.find((option) => option.key === selectedKey) ?? null,
|
|
|
+ [workspaceOptions, selectedKey],
|
|
|
+ );
|
|
|
+
|
|
|
+ return (
|
|
|
+ <div className="flex h-full min-h-0 flex-col">
|
|
|
+ <header className="flex shrink-0 items-center justify-between gap-3 border-b border-border px-4 py-3">
|
|
|
+ <h1 className="text-ui-lg font-medium">
|
|
|
+ {intl.formatMessage({ id: "taskDispatch.module.title" })}
|
|
|
+ </h1>
|
|
|
+ {/* M3:选定项目后触发分析会话(moduleScope=task-dispatch)。 */}
|
|
|
+ <Button size="sm" disabled={!selected}>
|
|
|
+ {intl.formatMessage({ id: "taskDispatch.module.analyze" })}
|
|
|
+ </Button>
|
|
|
+ </header>
|
|
|
+ <div className="flex shrink-0 items-center gap-2 border-b border-border px-4 py-2">
|
|
|
+ <span className="text-ui-sm text-foreground-subtle">
|
|
|
+ {intl.formatMessage({ id: "taskDispatch.module.targetProject" })}
|
|
|
+ </span>
|
|
|
+ <Select
|
|
|
+ value={selectedKey ?? undefined}
|
|
|
+ onValueChange={(value) => setSelectedKey(value)}
|
|
|
+ >
|
|
|
+ <SelectTrigger className="h-8 w-[min(360px,60%)]" size="sm">
|
|
|
+ <SelectValue
|
|
|
+ placeholder={intl.formatMessage({
|
|
|
+ id: "taskDispatch.module.selectPlaceholder",
|
|
|
+ })}
|
|
|
+ />
|
|
|
+ </SelectTrigger>
|
|
|
+ <SelectContent>
|
|
|
+ {workspaceOptions.map((option) => (
|
|
|
+ <SelectItem key={option.key} value={option.key}>
|
|
|
+ {option.label}
|
|
|
+ </SelectItem>
|
|
|
+ ))}
|
|
|
+ </SelectContent>
|
|
|
+ </Select>
|
|
|
+ </div>
|
|
|
+ <div className="flex min-h-0 flex-1">
|
|
|
+ {/* 主区:按执行计划分组的任务清单(M2 占位;M3 填充模型分析结果)。 */}
|
|
|
+ <section
|
|
|
+ className={cn(
|
|
|
+ "flex min-w-0 flex-1 flex-col items-center justify-center gap-2 p-6",
|
|
|
+ "text-ui-base text-foreground-subtle",
|
|
|
+ )}
|
|
|
+ >
|
|
|
+ <p>{intl.formatMessage({ id: "taskDispatch.module.emptyAnalysis" })}</p>
|
|
|
+ <p className="text-ui-caption">
|
|
|
+ {intl.formatMessage({ id: "taskDispatch.module.emptyAnalysisHint" })}
|
|
|
+ </p>
|
|
|
+ </section>
|
|
|
+ {/* 侧区:模块会话历史(M2 占位;M3 按 moduleScope 过滤呈现)。 */}
|
|
|
+ <aside className="flex w-72 shrink-0 flex-col border-l border-border">
|
|
|
+ <div className="border-b border-border px-3 py-2 text-ui-sm font-medium text-foreground-subtle">
|
|
|
+ {intl.formatMessage({ id: "taskDispatch.module.history" })}
|
|
|
+ </div>
|
|
|
+ <div className="flex flex-1 items-center justify-center p-3 text-ui-caption text-foreground-subtlest">
|
|
|
+ {intl.formatMessage({ id: "taskDispatch.module.historyEmpty" })}
|
|
|
+ </div>
|
|
|
+ </aside>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ );
|
|
|
+}
|