pages description updated

This commit is contained in:
Cypro Freelance 2024-07-10 11:40:55 +05:30
parent 9f964c3aa2
commit ba7a0ee58b
8 changed files with 371 additions and 370 deletions

View file

@ -1,9 +1,8 @@
"use client";
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 { z } from "zod";
import { Button } from "@/components/ui/button";
import {
Form,
@ -14,21 +13,27 @@ import {
FormMessage,
} from "@/components/ui/form";
import { Input } from "@/components/ui/input";
import { UploadButton, UploadDropzone } from "@/lib/uploadthing";
import { logsSchema } from "@/lib/validations/validation";
import { z } from "zod";
const AdminPage = () => {
const form = useForm<z.infer<typeof logsSchema>>({
type LogsFormValues = z.infer<typeof logsSchema>;
const AdminLogPage = () => {
const form = useForm<LogsFormValues>({
resolver: zodResolver(logsSchema),
defaultValues: {
fileName: "",
version: "",
downloadLink: "",
fileSize: "",
date: "",
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", {
method: "POST",
headers: {
@ -52,25 +57,12 @@ const AdminPage = () => {
<h1 className="text-3xl font-bold py-6">Server Logs Form</h1>
<Form {...form}>
<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
control={form.control}
name="version"
render={({ field }) => (
<FormItem>
<FormLabel>Version</FormLabel>
<FormLabel>Version Name</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
@ -80,39 +72,50 @@ const AdminPage = () => {
/>
<FormField
control={form.control}
name="downloadLink"
name="date"
render={({ field }) => (
<FormItem>
<FormLabel>Download Link</FormLabel>
<UploadButton
endpoint="imageUploader"
onClientUploadComplete={(res) => {
field.onChange(res[0].url);
}}
onUploadError={(error: Error) => {
alert(`ERROR! ${error.message}`);
}}
/>
<FormLabel>Date</FormLabel>
<FormControl>
<Input {...field} />
<Input {...field} placeholder="Released on 24 Nov 2024" />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
{fields.map((field, index) => (
<FormField
key={field.id}
control={form.control}
name="fileSize"
name={`bullets.${index}`}
render={({ field }) => (
<FormItem>
<FormLabel>File Size</FormLabel>
<FormLabel>Key Point {index + 1}</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
<FormMessage />
<Button
type="button"
onClick={() => remove(index)}
className="mt-2"
variant={"destructive"}
>
Remove
</Button>
</FormItem>
)}
/>
))}
<Button
type="button"
onClick={() => append("")}
className="mb-4"
size={"lg"}
variant={"outline"}
>
Add
</Button>
<Button
type="submit"
className="w-full text-lg rounded-full"
@ -126,4 +129,4 @@ const AdminPage = () => {
);
};
export default AdminPage;
export default AdminLogPage;

View file

@ -17,7 +17,7 @@ import { Input } from "@/components/ui/input";
import { UploadButton, UploadDropzone } from "@/lib/uploadthing";
import { downloadSchema } from "@/lib/validations/validation";
const AdminPage = () => {
const DownloadsPage = () => {
const form = useForm<z.infer<typeof downloadSchema>>({
resolver: zodResolver(downloadSchema),
defaultValues: {
@ -128,4 +128,4 @@ const AdminPage = () => {
);
};
export default AdminPage;
export default DownloadsPage;

View file

@ -17,7 +17,7 @@ import { Input } from "@/components/ui/input";
import { UploadButton, UploadDropzone } from "@/lib/uploadthing";
import { modsSchema } from "@/lib/validations/validation";
const AdminPage = () => {
const SvrjsModsAdminPage = () => {
const form = useForm<z.infer<typeof modsSchema>>({
resolver: zodResolver(modsSchema),
defaultValues: {
@ -126,4 +126,4 @@ const AdminPage = () => {
);
};
export default AdminPage;
export default SvrjsModsAdminPage;

View file

@ -9,8 +9,8 @@ const AdminPage = () => {
<div className="grid lg:grid-cols-2 grid-cols-1 gap-4 ">
<Card title="Downloads" url="/admin/downloads" />
<Card title="Mods" url="/admin" />
<Card title="Logs" url="/admin" />
<Card title="Mods" url="/admin/mods" />
<Card title="Logs" url="/admin/changelogs" />
<Card title="Docs" url="/admin" />
</div>
</section>

View file

@ -10,7 +10,7 @@ export default function PageLayout({
<main className="flex flex-col min-h-screen root">
<Sidebar />
<MobileNav />
<div className="flex-grow flex-1 root-container">{children}</div>
<div className="root-container lg:px-24">{children}</div>
</main>
);
}

View file

@ -18,11 +18,7 @@ const PrivacyPolicy = () => {
Privacy Policy
</h1>
<p className="text-lg text-muted-foreground text-start mb-4">
Some older versions of SVR.JS are vulnerable to cyberattacks. It&apos;s
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&apos;ll mitigate that
vulnerability if it is possible.
Effective date: 26.05.2024
</p>
<div className="prose max-w-full prose-lg dark:prose-invert">
<ReactMarkdown>{PRIVACY_POLICY}</ReactMarkdown>

View file

@ -16,8 +16,11 @@ const Vulnerabilities = () => {
SVR.JS Vulnerabilities
</h1>
<p className="text-lg text-muted-foreground text-start mb-4">
We welcome contributions from the community! Here&apos;s how you can
help!
Some older versions of SVR.JS are vulnerable to cyberattacks. It&apos;s
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&apos;ll mitigate that
vulnerability if it is possible.
</p>
<div className="prose max-w-full prose-lg dark:prose-invert">
<ReactMarkdown>{vulnerabilities}</ReactMarkdown>

View file

@ -15,10 +15,9 @@ export const modsSchema = z.object({
});
export const logsSchema = z.object({
fileName: z.string().nonempty(),
version: z.string().nonempty(),
downloadLink: z.string().url().nonempty(),
fileSize: z.string().nonempty(),
date: z.string().nonempty(),
bullets: z.array(z.string().nonempty()),
});
// Contact Page