2024-06-17 19:43:00 +02:00
|
|
|
import { Button } from "@/components/ui/button";
|
|
|
|
import {
|
|
|
|
Table,
|
|
|
|
TableBody,
|
|
|
|
TableCaption,
|
|
|
|
TableCell,
|
|
|
|
TableHead,
|
|
|
|
TableHeader,
|
2024-09-07 09:12:48 +02:00
|
|
|
TableRow
|
2024-06-17 19:43:00 +02:00
|
|
|
} from "@/components/ui/table";
|
|
|
|
import { Download } from "lucide-react";
|
|
|
|
import Link from "next/link";
|
2024-09-07 20:56:08 +02:00
|
|
|
import clientPromise from "@/lib/db";
|
2024-06-17 19:43:00 +02:00
|
|
|
|
2024-06-22 10:30:51 +02:00
|
|
|
interface Mods {
|
|
|
|
_id: string;
|
|
|
|
date: string;
|
|
|
|
fileName: string;
|
|
|
|
version: string;
|
|
|
|
fileSize: string;
|
|
|
|
downloadLink: string;
|
|
|
|
}
|
|
|
|
|
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 ModsPage: React.FC = async () => {
|
|
|
|
let error: Error | null = null;
|
|
|
|
let downloads: Mods[] = [];
|
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("mods")
|
|
|
|
.find()
|
|
|
|
.toArray()) as unknown as Mods[];
|
|
|
|
} catch (err) {
|
|
|
|
error = err as Error;
|
|
|
|
}
|
2024-06-17 19:43:00 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<section
|
|
|
|
id="mods"
|
2024-07-29 22:57:35 +02:00
|
|
|
className="wrapper container py-24 md:py-28 gap-2 flex flex-col"
|
2024-06-17 19:43:00 +02:00
|
|
|
>
|
2024-07-29 22:57:35 +02:00
|
|
|
<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 19:10:02 +02:00
|
|
|
SVR.JS mods
|
2024-06-17 19:43:00 +02:00
|
|
|
</h1>
|
2024-07-29 23:03:55 +02:00
|
|
|
<p className="md:text-lg text-muted-foreground text-start mb-6">
|
2024-09-07 19:10:02 +02:00
|
|
|
Get all the latest version of SVR.JS mods here! Notes can be found at{" "}
|
|
|
|
<Link
|
|
|
|
href="/docs/mod-notes"
|
2024-09-07 21:41:26 +02:00
|
|
|
className="text-black dark:text-white underline"
|
2024-09-07 19:10:02 +02:00
|
|
|
>
|
|
|
|
“SVR.JS mod notes” section in SVR.JS documentation
|
|
|
|
</Link>
|
|
|
|
. Other SVR.JS mods downloads can be found in{" "}
|
|
|
|
<Link
|
|
|
|
href="https://downloads.svrjs.org/mods"
|
2024-09-07 21:41:26 +02:00
|
|
|
className="text-black dark:text-white underline"
|
2024-09-07 19:10:02 +02:00
|
|
|
>
|
|
|
|
SVR.JS downloads server
|
|
|
|
</Link>
|
|
|
|
.
|
2024-06-17 19:43:00 +02:00
|
|
|
</p>
|
2024-09-07 20:56:08 +02:00
|
|
|
{error && <p className="text-red-500">{error.message}</p>}
|
2024-06-17 19:43:00 +02:00
|
|
|
<Table>
|
|
|
|
<TableCaption>A list of all available downloads.</TableCaption>
|
|
|
|
<TableHeader>
|
|
|
|
<TableRow>
|
|
|
|
<TableHead className="w-[150px]">Date</TableHead>
|
|
|
|
<TableHead>File Name</TableHead>
|
|
|
|
<TableHead>Version</TableHead>
|
2024-09-07 19:54:57 +02:00
|
|
|
<TableHead>File Size</TableHead>
|
|
|
|
<TableHead className="text-right">Download Link</TableHead>
|
2024-06-17 19:43:00 +02:00
|
|
|
</TableRow>
|
|
|
|
</TableHeader>
|
|
|
|
<TableBody>
|
2024-06-22 10:30:51 +02:00
|
|
|
{downloads
|
|
|
|
.slice(0, 10)
|
|
|
|
.reverse()
|
|
|
|
.map((download) => (
|
|
|
|
<TableRow key={download._id}>
|
|
|
|
<TableCell className="font-medium">{download.date}</TableCell>
|
|
|
|
<TableCell>{download.fileName}</TableCell>
|
|
|
|
<TableCell>{download.version}</TableCell>
|
|
|
|
<TableCell className="text-left">{download.fileSize}</TableCell>
|
|
|
|
<TableCell className="flex items-center justify-end">
|
|
|
|
<Link href={download.downloadLink}>
|
|
|
|
<Button variant={"ghost"} className="">
|
|
|
|
<Download className="w-4 h-4 mr-2" />
|
|
|
|
Download
|
|
|
|
</Button>
|
|
|
|
</Link>
|
|
|
|
</TableCell>
|
|
|
|
</TableRow>
|
|
|
|
))}
|
2024-06-17 19:43:00 +02:00
|
|
|
</TableBody>
|
|
|
|
</Table>
|
|
|
|
</section>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2024-06-22 10:30:51 +02:00
|
|
|
export default ModsPage;
|