refactor(desktop): wire PipelineResultPreview into PipelinesPanel
Replace the inline ResultModal with the full-featured PipelineResultPreview component. This gives users JSON/Markdown/ Classroom mode switching, file download cards, and classroom export support instead of the previous basic PresentationContainer wrapper. Remove unused ResultModal component and PresentationContainer import. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -18,6 +18,7 @@ import {
|
||||
Filter,
|
||||
X,
|
||||
} from 'lucide-react';
|
||||
import { PipelineResultPreview } from './PipelineResultPreview';
|
||||
import {
|
||||
PipelineClient,
|
||||
PipelineInfo,
|
||||
@@ -28,7 +29,6 @@ import {
|
||||
formatInputType,
|
||||
} from '../lib/pipeline-client';
|
||||
import { useToast } from './ui/Toast';
|
||||
import { PresentationContainer } from './presentation';
|
||||
|
||||
// === Category Badge Component ===
|
||||
|
||||
@@ -117,64 +117,6 @@ function PipelineCard({ pipeline, onRun }: PipelineCardProps) {
|
||||
);
|
||||
}
|
||||
|
||||
// === Pipeline Result Modal ===
|
||||
|
||||
interface ResultModalProps {
|
||||
result: PipelineRunResponse;
|
||||
pipeline: PipelineInfo;
|
||||
onClose: () => void;
|
||||
}
|
||||
|
||||
function ResultModal({ result, pipeline, onClose }: ResultModalProps) {
|
||||
return (
|
||||
<div className="fixed inset-0 bg-black/50 flex items-center justify-center z-50">
|
||||
<div className="bg-white dark:bg-gray-800 rounded-lg shadow-xl w-[90vw] max-w-4xl h-[85vh] flex flex-col mx-4">
|
||||
{/* Header */}
|
||||
<div className="flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700">
|
||||
<div className="flex items-center gap-3">
|
||||
<span className="text-2xl">{pipeline.icon}</span>
|
||||
<div>
|
||||
<h2 className="text-lg font-semibold text-gray-900 dark:text-white">
|
||||
{pipeline.displayName} - 执行结果
|
||||
</h2>
|
||||
<p className="text-sm text-gray-500 dark:text-gray-400">
|
||||
状态: {result.status === 'completed' ? '已完成' : '失败'}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
onClick={onClose}
|
||||
className="p-1 hover:bg-gray-100 dark:hover:bg-gray-700 rounded"
|
||||
>
|
||||
<X className="w-5 h-5 text-gray-500" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{/* Content */}
|
||||
<div className="flex-1 overflow-hidden">
|
||||
{result.outputs ? (
|
||||
<PresentationContainer
|
||||
data={result.outputs}
|
||||
pipelineId={pipeline.id}
|
||||
supportedTypes={['document', 'chart', 'quiz', 'slideshow']}
|
||||
/>
|
||||
) : result.error ? (
|
||||
<div className="p-6 text-center text-red-500">
|
||||
<XCircle className="w-8 h-8 mx-auto mb-2" />
|
||||
<p>{result.error}</p>
|
||||
</div>
|
||||
) : (
|
||||
<div className="p-6 text-center text-gray-500">
|
||||
<Package className="w-8 h-8 mx-auto mb-2" />
|
||||
<p>无输出结果</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// === Pipeline Run Modal ===
|
||||
|
||||
interface RunModalProps {
|
||||
@@ -602,11 +544,11 @@ export function PipelinesPanel() {
|
||||
/>
|
||||
)}
|
||||
|
||||
{/* Result Modal */}
|
||||
{/* Result Preview */}
|
||||
{runResult && (
|
||||
<ResultModal
|
||||
<PipelineResultPreview
|
||||
result={runResult.result}
|
||||
pipeline={runResult.pipeline}
|
||||
pipelineId={runResult.pipeline.id}
|
||||
onClose={() => setRunResult(null)}
|
||||
/>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user