spb/autoscholar
Public
1import { fmtBytes } from "@/lib/format";23/** ScientificFigure — a real research figure served from the immutable artifact store. */4export function ScientificFigure({5 src,6 path,7 bytes,8 index,9 vector,10}: {11 src: string;12 path: string;13 bytes: number;14 index: number;15 vector?: { href: string; bytes: number };16}) {17 const name = path.replace(/^results\/figures\//, "");18 return (19 <figure className="surface overflow-hidden">20 <a21 href={src}22 className="block bg-white p-3"23 target="_blank"24 rel="noopener noreferrer"25 aria-label={`Open figure ${index}: ${name}`}26 >27 {/* biome-ignore lint/performance/noImgElement: artifact images are served immutable from this origin */}28 <img29 src={src}30 alt={`Figure ${index}: ${name}`}31 className="mx-auto max-h-[28rem] w-auto"32 loading="lazy"33 decoding="async"34 />35 </a>36 <figcaption className="flex flex-wrap items-center justify-between gap-2 border-t px-3 py-2 text-xs hairline">37 <span>38 <span className="font-medium">Figure {index}.</span> <span className="muted font-mono">{name}</span>39 </span>40 <span className="subtle">41 {fmtBytes(bytes)}42 {vector && (43 <>44 {" · "}45 <a href={`${vector.href}?download=1`}>vector PDF ({fmtBytes(vector.bytes)})</a>46 </>47 )}48 </span>49 </figcaption>50 </figure>51 );52}53