import React, { useEffect, useState } from "react";
import axios from "axios";
import { Link } from "react-router-dom";
import yaml from "yaml";
import contentYaml from "../content/home-content.yml?raw";
import { HomeContent, HomeSection } from "../types/home-content";
import "../components/Button.css";
const content = yaml.parse(contentYaml) as HomeContent;
const SectionCard: React.FC<{ section: HomeSection }> = ({ section }) => {
if (section.external) {
return (
);
}
return (
{section.title}
{section.description}
{section.linkText}
);
};
interface BenchmarkStatus {
current_dataset: string;
current_algorithm: string;
completed_count: number;
total_count: number;
progress_percentage: number;
elapsed_time: number;
last_update: string;
completed_benchmarks: Array<{
dataset: string;
algorithm: string;
compression_ratio: number;
encode_time: number;
decode_time: number;
cache_status: string;
}>;
}
export default function Home() {
const [status, setStatus] = useState(null);
useEffect(() => {
const fetchStatus = async () => {
try {
const cacheBust = Math.random().toString(36).substring(2, 15);
const response = await axios.get(
`https://tempory.net/f/memobin/ephys_compression_tests/benchmark_status/current.json?cachebust=${cacheBust}`,
);
setStatus(response.data);
} catch (error) {
console.error("Error fetching benchmark status:", error);
}
};
fetchStatus();
}, []);
return (
{content.title}
{content.description}
{Object.entries(content.sections).map(([key, section]) => (
))}
);
}