|
1 | 1 | import React, { useState, useEffect, useCallback } from 'react'; |
2 | | -import { Settings, Zap, Eye, ChevronDown, ChevronUp, Target, Code, ZoomIn } from 'lucide-react'; |
| 2 | +import { Settings, Zap, Eye, Target, Code, ZoomIn } from 'lucide-react'; |
| 3 | +import CollapsibleSection from './CollapsibleSection.jsx'; |
3 | 4 | import { METRIC_PRESETS } from '../metricPresets.js'; |
4 | 5 |
|
5 | 6 | // 匹配模式枚举 |
@@ -450,20 +451,26 @@ export function RegexControls({ |
450 | 451 |
|
451 | 452 | <div className="space-y-4"> |
452 | 453 | {globalParsingConfig.metrics.map((cfg, idx) => ( |
453 | | - <div key={idx} className="border rounded-lg p-3 relative"> |
454 | | - <button |
455 | | - onClick={() => removeMetric(idx)} |
456 | | - className="absolute top-1 right-1 text-red-500" |
457 | | - title="删除配置" |
458 | | - > |
459 | | - × |
460 | | - </button> |
461 | | - <h4 className="text-sm font-medium text-gray-800 mb-2 flex items-center gap-1"> |
462 | | - <span className="w-3 h-3 bg-blue-500 rounded-full"></span> |
463 | | - {getMetricTitle(cfg, idx)} 解析配置 |
464 | | - </h4> |
465 | | - {renderConfigPanel(`metric-${idx}`, cfg, (field, value) => handleMetricChange(idx, field, value), idx)} |
466 | | - </div> |
| 454 | + <CollapsibleSection |
| 455 | + key={idx} |
| 456 | + title={`${getMetricTitle(cfg, idx)} 解析配置`} |
| 457 | + action={ |
| 458 | + <button |
| 459 | + onClick={() => removeMetric(idx)} |
| 460 | + className="text-red-500" |
| 461 | + title="删除配置" |
| 462 | + > |
| 463 | + × |
| 464 | + </button> |
| 465 | + } |
| 466 | + > |
| 467 | + {renderConfigPanel( |
| 468 | + `metric-${idx}`, |
| 469 | + cfg, |
| 470 | + (field, value) => handleMetricChange(idx, field, value), |
| 471 | + idx |
| 472 | + )} |
| 473 | + </CollapsibleSection> |
467 | 474 | ))} |
468 | 475 | <button |
469 | 476 | onClick={addMetric} |
|
0 commit comments