2import axios from "axios";
4import yaml from "yaml";
5import contentYaml from "../content/home-content.yml?raw";
6import { HomeContent, HomeSection } from "../types/home-content";
7import "../components/Button.css";
104f442improve layoutJeremy Magland 10
3e91ba2add home pageJeremy Magland 11const SectionCard: React.FC<{ section: HomeSection }> = ({ section }) => {
12 if (section.external) {
13 return (
14 <div
15 style={{
18 borderRadius: "8px",
19 backgroundColor: "#f9f9f9",
21 flexDirection: "column",
22 height: "100%",
24 >
eba1648submit instructionsJeremy Magland 25 <h2 style={{ fontSize: "1.25rem", marginBottom: "0.5rem" }}>
26 {section.title}
27 </h2>
28 <p style={{ marginBottom: "0.5rem" }}>{section.description}</p>
30 href={section.link}
31 target="_blank"
32 rel="noopener noreferrer"
33 className="soft-button"
36 {section.linkText}
37 </a>
38 </div>
39 );
40 }
bde0876rearrange tabsJeremy Magland 41
43 <div
44 style={{
47 borderRadius: "8px",
48 backgroundColor: "#f9f9f9",
50 flexDirection: "column",
51 height: "100%",
53 >
eba1648submit instructionsJeremy Magland 54 <h2 style={{ fontSize: "1.25rem", marginBottom: "0.5rem" }}>
55 {section.title}
56 </h2>
57 <p style={{ marginBottom: "0.5rem" }}>{section.description}</p>
58 <Link
59 to={section.link}
60 className="soft-button"
61 style={{ marginTop: "auto", alignSelf: "flex-start" }}
62 >
64 </Link>
65 </div>
bde0876rearrange tabsJeremy Magland 68
70 current_dataset: string;
71 current_algorithm: string;
72 completed_count: number;
73 total_count: number;
74 progress_percentage: number;
75 elapsed_time: number;
76 last_update: string;
77 completed_benchmarks: Array<{
78 dataset: string;
79 algorithm: string;
80 compression_ratio: number;
81 encode_time: number;
82 decode_time: number;
83 cache_status: string;
84 }>;
85}
eba1648submit instructionsJeremy Magland 88 const [status, setStatus] = useState<BenchmarkStatus | null>(null);
90 useEffect(() => {
91 const fetchStatus = async () => {
92 try {
47f2554cachebustJeremy Magland 95 `https://tempory.net/f/memobin/benchmark_status/current.json?cachebust=${cacheBust}`,
97 setStatus(response.data);
98 } catch (error) {
99 console.error("Error fetching benchmark status:", error);
100 }
101 };
103 fetchStatus();
104 }, []);
107 <div style={{ maxWidth: "1200px", margin: "0 auto", padding: "2rem" }}>
109 style={{
110 marginBottom: "2rem",
111 display: "flex",
112 alignItems: "center",
113 gap: "1rem",
114 }}
115 >
116 <img
117 src={`${import.meta.env.BASE_URL}logo.svg`}
118 alt="BenchCompress Logo"
119 style={{ width: "40px", height: "auto" }}
120 />
121 {content.title}
122 </h1>
125 style={{ fontSize: "1.1rem", lineHeight: "1.6", marginBottom: "2rem" }}
126 >
127 {content.description}
128 </p>
131 style={{
132 display: "grid",
133 gap: "2rem",
134 gridTemplateColumns: "repeat(auto-fit, minmax(300px, 1fr))",
135 }}
136 >
137 {Object.entries(content.sections).map(([key, section]) => (
138 <SectionCard key={key} section={section} />
139 ))}
140 </div>
143 style={{
144 margin: "3rem 0",
145 border: "none",
146 borderTop: "1px solid #eaeaea",
147 }}
148 />
151 style={{ textAlign: "center", color: "#666", fontSize: "0.9rem" }}
152 >
153 <p>
157 <>
158 <div
159 style={{
160 margin: "1rem 0",
161 padding: "0.5rem",
162 border: "1px solid #eaeaea",
163 borderRadius: "4px",
164 display: "inline-block",
165 }}
166 >
167 Last benchmark run:{" "}
168 {new Date(status.last_update).toLocaleString()}
169 <br />
170 Status:{" "}
171 {status.progress_percentage === 100
172 ? "Completed"
173 : "In Progress"}{" "}
174 ({status.completed_count}/{status.total_count} benchmarks)
175 </div>
176 <br />
177 </>
178 )}
180 <a
3bb8dd5Update links to concept-collection locationmagland 181 href="https://github.com/concept-collection/benchcompress/blob/main/LICENSE"
183 rel="noopener noreferrer"
184 style={{ color: "#666", textDecoration: "underline" }}
187 </a>
188 </p>
189 </footer>
191 );
192}