2024-06-22 10:30:51 +02:00
|
|
|
import { Button } from "@/components/ui/button";
|
|
|
|
import { Download } from "lucide-react";
|
|
|
|
import Link from "next/link";
|
2024-07-17 17:45:28 +02:00
|
|
|
import ReactMarkdown from "react-markdown";
|
|
|
|
import { CHANGE_LOGS } from "@/constants/guidelines";
|
2024-07-30 21:36:45 +02:00
|
|
|
import { Skeleton } from "@/components/ui/skeleton";
|
2024-09-07 20:56:08 +02:00
|
|
|
import clientPromise from "@/lib/db";
|
2024-07-17 17:45:28 +02:00
|
|
|
|
|
|
|
interface Bullet {
|
2024-09-07 09:12:48 +02:00
|
|
|
point: string;
|
2024-07-17 17:45:28 +02:00
|
|
|
}
|
2024-06-22 10:30:51 +02:00
|
|
|
|
|
|
|
interface LOGS {
|
2024-09-07 09:12:48 +02:00
|
|
|
_id: string;
|
|
|
|
date: string;
|
|
|
|
version: string;
|
|
|
|
bullets?: Bullet[]; // Make bullets optional
|
2024-06-22 10:30:51 +02:00
|
|
|
}
|
|
|
|
|
2024-09-07 20:56:08 +02:00
|
|
|
export const dynamic = "force-static";
|
2024-06-22 10:30:51 +02:00
|
|
|
|
2024-09-07 20:56:08 +02:00
|
|
|
const LogsPage: React.FC = async () => {
|
|
|
|
let error: Error | null = null;
|
|
|
|
let downloads: LOGS[] = [];
|
2024-06-22 10:30:51 +02:00
|
|
|
|
2024-09-07 20:56:08 +02:00
|
|
|
try {
|
|
|
|
const client = await clientPromise;
|
2024-09-07 21:11:11 +02:00
|
|
|
const db = client.db(process.env.MONGODB_DB);
|
2024-09-07 20:56:08 +02:00
|
|
|
downloads = (await db
|
|
|
|
.collection("logs")
|
|
|
|
.find()
|
|
|
|
.toArray()) as unknown as LOGS[];
|
|
|
|
} catch (err) {
|
|
|
|
error = err as Error;
|
|
|
|
}
|
2024-06-22 10:30:51 +02:00
|
|
|
|
2024-09-07 09:12:48 +02:00
|
|
|
const reversedDownloads = [...downloads].reverse();
|
2024-06-22 10:30:51 +02:00
|
|
|
|
2024-09-07 09:12:48 +02:00
|
|
|
return (
|
|
|
|
<section
|
|
|
|
id="logs"
|
|
|
|
className="wrapper container py-24 md:py-28 gap-2 flex flex-col"
|
|
|
|
>
|
|
|
|
<h1 className="text-3xl md:text-5xl pb-1 md:pb-2 font-bold text-black dark:bg-clip-text dark:text-transparent dark:bg-gradient-to-b dark:from-white dark:to-neutral-400">
|
2024-09-07 11:54:47 +02:00
|
|
|
SVR.JS change log
|
2024-09-07 09:12:48 +02:00
|
|
|
</h1>
|
|
|
|
<p className="md:text-lg text-muted-foreground text-start mb-6">
|
2024-09-07 11:54:47 +02:00
|
|
|
See the changes done to SVR.JS web server.
|
2024-09-07 09:12:48 +02:00
|
|
|
</p>
|
2024-09-07 20:56:08 +02:00
|
|
|
{error && <p className="text-red-500">{error.message}</p>}
|
2024-06-22 10:30:51 +02:00
|
|
|
|
2024-09-07 09:12:48 +02:00
|
|
|
{reversedDownloads.map((download) => (
|
|
|
|
<div
|
|
|
|
key={download._id}
|
|
|
|
className="flex-start prose max-w-full md:prose-lg dark:prose-invert flex-col mb-4"
|
|
|
|
>
|
2024-09-08 07:51:14 +02:00
|
|
|
<h2>{download.version}</h2>
|
|
|
|
<span className="italic">{download.date}</span>
|
|
|
|
<ul>
|
2024-09-07 09:12:48 +02:00
|
|
|
{(download.bullets ?? []).map((bullet, index) => (
|
|
|
|
<li key={index}>{bullet.point}</li>
|
|
|
|
))}
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
))}
|
|
|
|
<div className="prose max-w-full md:prose-lg dark:prose-invert">
|
|
|
|
<ReactMarkdown>{CHANGE_LOGS}</ReactMarkdown>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
);
|
2024-06-22 10:30:51 +02:00
|
|
|
};
|
|
|
|
|
2024-07-17 17:45:28 +02:00
|
|
|
export default LogsPage;
|