import Link from "next/link"; import { Badge } from "@/components/ui/badge"; import { Card } from "@/components/ui/card"; import type { ChangelogVersion } from "@/lib/changelog/parse-changelog"; /** Converte "[texto](url)" em link; texto simples fica como está */ function parseContributorLine(content: string) { const linkMatch = content.match(/^\[([^\]]+)\]\((https?:\/\/[^)]+)\)$/); if (linkMatch) { return { label: linkMatch[1], url: linkMatch[2] }; } return { label: content, url: null }; } const sectionBadgeVariant: Record< string, "success" | "info" | "destructive" | "secondary" > = { Adicionado: "success", Alterado: "info", Corrigido: "destructive", Removido: "secondary", }; function getSectionVariant(type: string) { return sectionBadgeVariant[type] ?? "secondary"; } export function ChangelogTab({ versions }: { versions: ChangelogVersion[] }) { return (
{versions.map((version) => (

v{version.version}

{version.date}
{version.sections.map((section) => (
{section.type}
    {section.items.map((item) => (
  • {item}
  • ))}
))} {version.contributor && (
Contribuições: {(() => { const { label, url } = parseContributorLine( version.contributor, ); if (url) { return ( {label} ); } return ( {label} ); })()}
)}
))}
); }