refactor: Update release notes page to handle missing release notes gracefully

This commit is contained in:
Mauro Balades
2024-07-11 22:53:47 +02:00
parent 74d44c9bd6
commit 72daefbdf4
5 changed files with 158 additions and 13 deletions

View File

@@ -1,7 +1,33 @@
import { releaseNotes } from "@/lib/release-notes";
import { redirect } from "next/navigation";
import Footer from "@/components/footer";
import { Navigation } from "@/components/navigation";
import { releaseNoteIsAlpha, releaseNotes } from "@/lib/release-notes";
import Link from "next/link";
export default function() {
// "0" is the latest release
redirect(`/release-notes/${releaseNotes[0].version}`);
return (
<main className="flex min-h-screen flex-col items-center justify-start">
<div className="min-h-screen py-42 flex justify-center flex-col">
<h1 className="text-4xl text-center font-bold mt-12">Release Notes</h1>
<div className="grid gap-5 grid-cols-1 md:grid-cols-2 lg:grid-cols-3 mt-10">
{releaseNotes.map((releaseNote) => (
<Link href={`/release-notes/${releaseNote.version}`} className="bg-background relative max-w-64 overflow-hidden rounded-lg border p-5 hover:border-blue-500 transition-all duration-300 hover:-translate-y-1 hover:-translate-x-1">
<div className="text-md font-medium mb-5">
{releaseNote.version}
</div>
<div className="text-muted-foreground text-sm font-medium">
Check out the new features and improvements for {releaseNote.version}
</div>
{releaseNoteIsAlpha(releaseNote) && (
<div className="absolute top-0 right-0 bg-blue-500 text-white text-xs font-medium p-1 rounded-bl-lg">
Alpha Release
</div>
)}
</Link>
))}
</div>
</div>
<Footer />
<Navigation /> {/* At the bottom of the page */}
</main>
)
}