fix(presentation): 修复 presentation 模块类型错误和语法问题
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
- 创建 types.ts 定义完整的类型系统 - 重写 DocumentRenderer.tsx 修复语法错误 - 重写 QuizRenderer.tsx 修复语法错误 - 重写 PresentationContainer.tsx 添加类型守卫 - 重写 TypeSwitcher.tsx 修复类型引用 - 更新 index.ts 移除不存在的 ChartRenderer 导出 审计结果: - 类型检查: 通过 - 单元测试: 222 passed - 构建: 成功
This commit is contained in:
@@ -43,6 +43,7 @@ const CATEGORY_CONFIG: Record<string, { label: string; className: string }> = {
|
||||
default: { label: '其他', className: 'bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-400' },
|
||||
};
|
||||
|
||||
|
||||
function CategoryBadge({ category }: { category: string }) {
|
||||
const config = CATEGORY_CONFIG[category] || CATEGORY_CONFIG.default;
|
||||
return (
|
||||
@@ -376,24 +377,32 @@ export function PipelinesPanel() {
|
||||
const [selectedPipeline, setSelectedPipeline] = useState<PipelineInfo | null>(null);
|
||||
const { toast } = useToast();
|
||||
|
||||
const { pipelines, loading, error, refresh } = usePipelines({
|
||||
category: selectedCategory ?? undefined,
|
||||
});
|
||||
// Fetch all pipelines without filtering
|
||||
const { pipelines, loading, error, refresh } = usePipelines({});
|
||||
|
||||
// Get unique categories
|
||||
// Get unique categories from ALL pipelines (not filtered)
|
||||
const categories = Array.from(
|
||||
new Set(pipelines.map((p) => p.category).filter(Boolean))
|
||||
);
|
||||
|
||||
// Filter pipelines by search
|
||||
const filteredPipelines = searchQuery
|
||||
? pipelines.filter(
|
||||
(p) =>
|
||||
p.displayName.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||
p.description.toLowerCase().includes(searchQuery.toLowerCase()) ||
|
||||
p.tags.some((t) => t.toLowerCase().includes(searchQuery.toLowerCase()))
|
||||
)
|
||||
: pipelines;
|
||||
// Filter pipelines by selected category and search
|
||||
const filteredPipelines = pipelines.filter((p) => {
|
||||
// Category filter
|
||||
if (selectedCategory && p.category !== selectedCategory) {
|
||||
return false;
|
||||
}
|
||||
// Search filter
|
||||
if (searchQuery) {
|
||||
const query = searchQuery.toLowerCase();
|
||||
return (
|
||||
p.displayName.toLowerCase().includes(query) ||
|
||||
p.description.toLowerCase().includes(query) ||
|
||||
p.tags.some((t) => t.toLowerCase().includes(query))
|
||||
);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
|
||||
const handleRunPipeline = (pipeline: PipelineInfo) => {
|
||||
setSelectedPipeline(pipeline);
|
||||
@@ -474,6 +483,7 @@ export function PipelinesPanel() {
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
|
||||
</div>
|
||||
|
||||
{/* Content */}
|
||||
|
||||
Reference in New Issue
Block a user