import { useParams } from "react-router-dom"; import { Algorithm as AlgorithmType, BenchmarkData } from "../types"; import { BenchmarkCharts } from "../components/benchmark/charts/BenchmarkCharts"; import { useBenchmarkChartData } from "../hooks/useBenchmarkChartData"; import { BenchmarkTable } from "../components/benchmark/table/BenchmarkTable"; interface AlgorithmProps { algorithms: AlgorithmType[]; benchmarkData: BenchmarkData | null; } function Algorithm({ algorithms, benchmarkData }: AlgorithmProps) { const { algorithmName } = useParams<{ algorithmName: string }>(); const algorithm = algorithms.find((a) => a.name === algorithmName); const chartData = useBenchmarkChartData( benchmarkData?.results || [], null, algorithm?.name || null, ); if (!algorithm) { return
Algorithm not found
; } return (

{algorithm.name}

{algorithm.description}

Version:{" "} {algorithm.version}
Tags:{" "} {algorithm.tags.map((tag) => ( {tag} ))}
{algorithm.source_file && (
Source:{" "} View
)}
{benchmarkData && ( <>

Benchmark Results

result.algorithm === algorithm.name, )} />
)}
); } export default Algorithm;