diff --git a/app/new/page.tsx b/app/new/page.tsx new file mode 100644 index 0000000..234eebf --- /dev/null +++ b/app/new/page.tsx @@ -0,0 +1,377 @@ +"use client"; +import { pb } from "@/lib/pocketbase"; +import Image from "next/image"; +import React, { useEffect, useState } from "react"; +import { + Dialog, + DialogContent, + DialogDescription, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "@/components/ui/dialog"; +import { Clipboard, Info } from "lucide-react"; +import { Separator } from "@/components/ui/separator"; +import { Button } from "@/components/ui/button"; +import Link from "next/link"; +import { extractDate } from "@/lib/time"; +import { toast } from "sonner"; + + +interface Script { + title: string; + scriptID: string; +} + +interface Category { + id: string; + Catagory_Title: string; + Items: Script[]; +} + +type Scripts = { + id: string; + title: string; + description: string; + installCommand: string; + logo: string; + updated: string; + created: string; + default_cpu: string; + default_ram: string; + default_hdd: string; + port: number; + item_type: string; + website: string; + documentation: string; + isUpdateable: boolean; + post_install: string; + hasAlpineScript: boolean; + alpineScript: string; + alpine_default_cpu: string; + alpine_default_ram: string; + alpine_default_hdd: string; + alert1: string; + alert2: string; + alert3: string; +}; + +const getCatagories = async () => { + const res = await fetch( + `${process.env.NEXT_PUBLIC_POCKETBASE_URL}/api/collections/proxmox_items/records`, + ); + const data = await res.json(); + return data.items as Category[]; +}; + +const getItems = async () => { + const records = await pb.collection("proxmox_scripts").getFullList({ + sort: "-created", + }); + return records as unknown as Scripts[]; +}; + + function handleCopy(type: string, value: any) { + navigator.clipboard.writeText(value); + toast( +