// Pieces shared by the product pages. import Link from "next/link"; import { Tag } from "@/components/status"; import { Card, CardContent } from "@/components/ui/card"; import type { ProductSummary } from "@/lib/api"; export function RatingTag({ rating }: { rating: string }) { return rating === "adult" ? Adult : null; } /** 1536 → "1.5 KB". */ export function formatSize(bytes: number): string { if (bytes < 1024) return `${bytes} B`; const units = ["KB", "MB", "GB"]; let n = bytes / 1024; let i = 0; while (n >= 1024 && i < units.length - 1) { n /= 1024; i++; } return `${n < 10 ? n.toFixed(1) : Math.round(n)} ${units[i]}`; } export function ProductCard({ product, children, }: { product: Pick; children?: React.ReactNode; }) { return (
{product.name}

{[product.creator && `by ${product.creator}`, `revision ${product.latest}`].filter(Boolean).join(" · ")}

{children}
); } export function Empty({ children }: { children: React.ReactNode }) { return (

{children}

); }