| 1 | import Link from "next/link"; |
| 2 | import type { RepoFacts } from "@/lib/facts"; |
| 3 | import { fill, getChrome, getDocsShell } from "@/lib/i18n/dictionaries"; |
| 4 | |
| 5 | export function ReleaseTruth({ locale, facts }: { locale: string; facts: RepoFacts }) { |
| 6 | const t = getDocsShell(locale); |
| 7 | const chrome = getChrome(locale); |
| 8 | const published = facts.latestPublishedRelease; |
| 9 | |
| 10 | return ( |
| 11 | <div className="release-truth dotline" data-release-state={published ? "published" : "unknown"}> |
| 12 | <span className="release-truth-label">{t.releaseLabel}</span> |
| 13 | {published && ( |
| 14 | <a href={published.url} target="_blank" rel="noreferrer"> |
| 15 | {fill(t.releasePublished, { |
| 16 | tag: published.tag, |
| 17 | date: new Date(published.publishedAt).toLocaleDateString(chrome.dateLocale, { |
| 18 | year: "numeric", |
| 19 | month: "short", |
| 20 | day: "numeric", |
| 21 | timeZone: "UTC", |
| 22 | }), |
| 23 | })} |
| 24 | </a> |
| 25 | )} |
| 26 | {published && <span>{fill(t.releaseDescribes, { tag: published.tag })}</span>} |
| 27 | <Link href={`/${locale}/changelog`}>{t.releaseChangelog}</Link> |
| 28 | </div> |
| 29 | ); |
| 30 | } |
| 31 |