pages description updated
This commit is contained in:
parent
9f964c3aa2
commit
ba7a0ee58b
8 changed files with 371 additions and 370 deletions
|
@ -1,9 +1,8 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { useForm, SubmitHandler } from "react-hook-form";
|
import { useForm, SubmitHandler, useFieldArray } from "react-hook-form";
|
||||||
import { zodResolver } from "@hookform/resolvers/zod";
|
import { zodResolver } from "@hookform/resolvers/zod";
|
||||||
import { z } from "zod";
|
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import {
|
import {
|
||||||
Form,
|
Form,
|
||||||
|
@ -14,21 +13,27 @@ import {
|
||||||
FormMessage,
|
FormMessage,
|
||||||
} from "@/components/ui/form";
|
} from "@/components/ui/form";
|
||||||
import { Input } from "@/components/ui/input";
|
import { Input } from "@/components/ui/input";
|
||||||
import { UploadButton, UploadDropzone } from "@/lib/uploadthing";
|
|
||||||
import { logsSchema } from "@/lib/validations/validation";
|
import { logsSchema } from "@/lib/validations/validation";
|
||||||
|
import { z } from "zod";
|
||||||
|
|
||||||
const AdminPage = () => {
|
type LogsFormValues = z.infer<typeof logsSchema>;
|
||||||
const form = useForm<z.infer<typeof logsSchema>>({
|
|
||||||
|
const AdminLogPage = () => {
|
||||||
|
const form = useForm<LogsFormValues>({
|
||||||
resolver: zodResolver(logsSchema),
|
resolver: zodResolver(logsSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
fileName: "",
|
|
||||||
version: "",
|
version: "",
|
||||||
downloadLink: "",
|
date: "",
|
||||||
fileSize: "",
|
bullets: [""],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const onSubmit: SubmitHandler<z.infer<typeof logsSchema>> = async (data) => {
|
const { fields, append, remove } = useFieldArray({
|
||||||
|
control: form.control,
|
||||||
|
name: "bullets" as const, // Ensure this is typed correctly
|
||||||
|
});
|
||||||
|
|
||||||
|
const onSubmit: SubmitHandler<LogsFormValues> = async (data) => {
|
||||||
const response = await fetch("/api/uploadlogs", {
|
const response = await fetch("/api/uploadlogs", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -52,25 +57,12 @@ const AdminPage = () => {
|
||||||
<h1 className="text-3xl font-bold py-6">Server Logs Form</h1>
|
<h1 className="text-3xl font-bold py-6">Server Logs Form</h1>
|
||||||
<Form {...form}>
|
<Form {...form}>
|
||||||
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
|
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
|
||||||
<FormField
|
|
||||||
control={form.control}
|
|
||||||
name="fileName"
|
|
||||||
render={({ field }) => (
|
|
||||||
<FormItem>
|
|
||||||
<FormLabel>File Name</FormLabel>
|
|
||||||
<FormControl>
|
|
||||||
<Input {...field} />
|
|
||||||
</FormControl>
|
|
||||||
<FormMessage />
|
|
||||||
</FormItem>
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="version"
|
name="version"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>Version</FormLabel>
|
<FormLabel>Version Name</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
@ -80,39 +72,50 @@ const AdminPage = () => {
|
||||||
/>
|
/>
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="downloadLink"
|
name="date"
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>Download Link</FormLabel>
|
<FormLabel>Date</FormLabel>
|
||||||
<UploadButton
|
|
||||||
endpoint="imageUploader"
|
|
||||||
onClientUploadComplete={(res) => {
|
|
||||||
field.onChange(res[0].url);
|
|
||||||
}}
|
|
||||||
onUploadError={(error: Error) => {
|
|
||||||
alert(`ERROR! ${error.message}`);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} placeholder="Released on 24 Nov 2024" />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
{fields.map((field, index) => (
|
||||||
<FormField
|
<FormField
|
||||||
|
key={field.id}
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="fileSize"
|
name={`bullets.${index}`}
|
||||||
render={({ field }) => (
|
render={({ field }) => (
|
||||||
<FormItem>
|
<FormItem>
|
||||||
<FormLabel>File Size</FormLabel>
|
<FormLabel>Key Point {index + 1}</FormLabel>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Input {...field} />
|
<Input {...field} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
<FormMessage />
|
<FormMessage />
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
onClick={() => remove(index)}
|
||||||
|
className="mt-2"
|
||||||
|
variant={"destructive"}
|
||||||
|
>
|
||||||
|
Remove
|
||||||
|
</Button>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
))}
|
||||||
|
<Button
|
||||||
|
type="button"
|
||||||
|
onClick={() => append("")}
|
||||||
|
className="mb-4"
|
||||||
|
size={"lg"}
|
||||||
|
variant={"outline"}
|
||||||
|
>
|
||||||
|
Add
|
||||||
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
type="submit"
|
type="submit"
|
||||||
className="w-full text-lg rounded-full"
|
className="w-full text-lg rounded-full"
|
||||||
|
@ -126,4 +129,4 @@ const AdminPage = () => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default AdminPage;
|
export default AdminLogPage;
|
||||||
|
|
|
@ -17,7 +17,7 @@ import { Input } from "@/components/ui/input";
|
||||||
import { UploadButton, UploadDropzone } from "@/lib/uploadthing";
|
import { UploadButton, UploadDropzone } from "@/lib/uploadthing";
|
||||||
import { downloadSchema } from "@/lib/validations/validation";
|
import { downloadSchema } from "@/lib/validations/validation";
|
||||||
|
|
||||||
const AdminPage = () => {
|
const DownloadsPage = () => {
|
||||||
const form = useForm<z.infer<typeof downloadSchema>>({
|
const form = useForm<z.infer<typeof downloadSchema>>({
|
||||||
resolver: zodResolver(downloadSchema),
|
resolver: zodResolver(downloadSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
|
@ -128,4 +128,4 @@ const AdminPage = () => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default AdminPage;
|
export default DownloadsPage;
|
||||||
|
|
|
@ -17,7 +17,7 @@ import { Input } from "@/components/ui/input";
|
||||||
import { UploadButton, UploadDropzone } from "@/lib/uploadthing";
|
import { UploadButton, UploadDropzone } from "@/lib/uploadthing";
|
||||||
import { modsSchema } from "@/lib/validations/validation";
|
import { modsSchema } from "@/lib/validations/validation";
|
||||||
|
|
||||||
const AdminPage = () => {
|
const SvrjsModsAdminPage = () => {
|
||||||
const form = useForm<z.infer<typeof modsSchema>>({
|
const form = useForm<z.infer<typeof modsSchema>>({
|
||||||
resolver: zodResolver(modsSchema),
|
resolver: zodResolver(modsSchema),
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
|
@ -126,4 +126,4 @@ const AdminPage = () => {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default AdminPage;
|
export default SvrjsModsAdminPage;
|
||||||
|
|
|
@ -9,8 +9,8 @@ const AdminPage = () => {
|
||||||
|
|
||||||
<div className="grid lg:grid-cols-2 grid-cols-1 gap-4 ">
|
<div className="grid lg:grid-cols-2 grid-cols-1 gap-4 ">
|
||||||
<Card title="Downloads" url="/admin/downloads" />
|
<Card title="Downloads" url="/admin/downloads" />
|
||||||
<Card title="Mods" url="/admin" />
|
<Card title="Mods" url="/admin/mods" />
|
||||||
<Card title="Logs" url="/admin" />
|
<Card title="Logs" url="/admin/changelogs" />
|
||||||
<Card title="Docs" url="/admin" />
|
<Card title="Docs" url="/admin" />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -10,7 +10,7 @@ export default function PageLayout({
|
||||||
<main className="flex flex-col min-h-screen root">
|
<main className="flex flex-col min-h-screen root">
|
||||||
<Sidebar />
|
<Sidebar />
|
||||||
<MobileNav />
|
<MobileNav />
|
||||||
<div className="flex-grow flex-1 root-container">{children}</div>
|
<div className="root-container lg:px-24">{children}</div>
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,11 +18,7 @@ const PrivacyPolicy = () => {
|
||||||
Privacy Policy
|
Privacy Policy
|
||||||
</h1>
|
</h1>
|
||||||
<p className="text-lg text-muted-foreground text-start mb-4">
|
<p className="text-lg text-muted-foreground text-start mb-4">
|
||||||
Some older versions of SVR.JS are vulnerable to cyberattacks. It's
|
Effective date: 26.05.2024
|
||||||
recommended to update your SVR.JS version to the newest one. If you find
|
|
||||||
a security issue with SVR.JS, report it as soon as possible to
|
|
||||||
vulnerability-reports[at]svrjs[dot]org. We'll mitigate that
|
|
||||||
vulnerability if it is possible.
|
|
||||||
</p>
|
</p>
|
||||||
<div className="prose max-w-full prose-lg dark:prose-invert">
|
<div className="prose max-w-full prose-lg dark:prose-invert">
|
||||||
<ReactMarkdown>{PRIVACY_POLICY}</ReactMarkdown>
|
<ReactMarkdown>{PRIVACY_POLICY}</ReactMarkdown>
|
||||||
|
|
|
@ -16,8 +16,11 @@ const Vulnerabilities = () => {
|
||||||
SVR.JS Vulnerabilities
|
SVR.JS Vulnerabilities
|
||||||
</h1>
|
</h1>
|
||||||
<p className="text-lg text-muted-foreground text-start mb-4">
|
<p className="text-lg text-muted-foreground text-start mb-4">
|
||||||
We welcome contributions from the community! Here's how you can
|
Some older versions of SVR.JS are vulnerable to cyberattacks. It's
|
||||||
help!
|
recommended to update your SVR.JS version to the newest one. If you find
|
||||||
|
a security issue with SVR.JS, report it as soon as possible to
|
||||||
|
vulnerability-reports[at]svrjs[dot]org. We'll mitigate that
|
||||||
|
vulnerability if it is possible.
|
||||||
</p>
|
</p>
|
||||||
<div className="prose max-w-full prose-lg dark:prose-invert">
|
<div className="prose max-w-full prose-lg dark:prose-invert">
|
||||||
<ReactMarkdown>{vulnerabilities}</ReactMarkdown>
|
<ReactMarkdown>{vulnerabilities}</ReactMarkdown>
|
||||||
|
|
|
@ -15,10 +15,9 @@ export const modsSchema = z.object({
|
||||||
});
|
});
|
||||||
|
|
||||||
export const logsSchema = z.object({
|
export const logsSchema = z.object({
|
||||||
fileName: z.string().nonempty(),
|
|
||||||
version: z.string().nonempty(),
|
version: z.string().nonempty(),
|
||||||
downloadLink: z.string().url().nonempty(),
|
date: z.string().nonempty(),
|
||||||
fileSize: z.string().nonempty(),
|
bullets: z.array(z.string().nonempty()),
|
||||||
});
|
});
|
||||||
|
|
||||||
// Contact Page
|
// Contact Page
|
||||||
|
|
Loading…
Reference in a new issue