import { AlertCircle, CheckCircle, Loader2 } from "lucide-react"; export const SUPPORT_EMAIL = "ben@openseo.so"; export function extractPathname(url: string): string { try { return new URL(url).pathname; } catch { return url; } } export function extractHostname(url: string): string { try { return new URL(url).hostname; } catch { return url; } } export function formatDate(dateStr: string): string { return new Date(dateStr).toLocaleDateString("en-US", { month: "short", day: "numeric", year: "numeric", }); } export function formatStartedAt(dateStr: string): string { return new Date(dateStr).toLocaleString("en-US", { month: "short", day: "numeric", hour: "numeric", minute: "2-digit", }); } export function StatusBadge({ status }: { status: string }) { if (status === "running") { return ( Running ); } if (status === "completed") { return ( Done ); } return ( Failed ); } export function HttpStatusBadge({ code }: { code: number | null }) { if (!code) return -; if (code >= 200 && code < 300) { return {code}; } if (code >= 300 && code < 400) { return {code}; } return {code}; } export function LighthouseScoreBadge({ score }: { score: number | null }) { if (score == null) { return -; } const color = score >= 90 ? "text-success" : score >= 50 ? "text-warning" : "text-error"; return {score}; }