diff --git a/frontend/src/app/scripts/_components/ScriptItem.tsx b/frontend/src/app/scripts/_components/ScriptItem.tsx index 8f1efd5..57f74c9 100644 --- a/frontend/src/app/scripts/_components/ScriptItem.tsx +++ b/frontend/src/app/scripts/_components/ScriptItem.tsx @@ -57,6 +57,7 @@ function ScriptItem({ const os = defaultInstallMethod?.resources?.os || "Proxmox Node"; const version = defaultInstallMethod?.resources?.version || ""; + const [linksVisible, setLinksVisible] = useState(false); return (
@@ -82,7 +83,7 @@ function ScriptItem({ unoptimized />
-
+

{item.name} {getDisplayValueFromType(item.type)} @@ -126,10 +127,20 @@ function ScriptItem({
- +
+ <> + + {linksVisible && } + +

- +
diff --git a/frontend/src/app/scripts/_components/ScriptItems/Buttons.tsx b/frontend/src/app/scripts/_components/ScriptItems/Buttons.tsx index e3c1a0c..97a7e2d 100644 --- a/frontend/src/app/scripts/_components/ScriptItems/Buttons.tsx +++ b/frontend/src/app/scripts/_components/ScriptItems/Buttons.tsx @@ -5,77 +5,78 @@ import { BookOpenText, Code, Globe, RefreshCcw } from "lucide-react"; import Link from "next/link"; const generateInstallSourceUrl = (slug: string) => { - const baseUrl = `https://raw.githubusercontent.com/community-scripts/${basePath}/main`; - return `${baseUrl}/install/${slug}-install.sh`; + const baseUrl = `https://raw.githubusercontent.com/community-scripts/${basePath}/main`; + return `${baseUrl}/install/${slug}-install.sh`; }; const generateSourceUrl = (slug: string, type: string) => { - const baseUrl = `https://raw.githubusercontent.com/community-scripts/${basePath}/main`; - return type === "vm" ? `${baseUrl}/vm/${slug}.sh` : `${baseUrl}/misc/${slug}.sh`; - return `${baseUrl}/misc/${slug}.sh`; + const baseUrl = `https://raw.githubusercontent.com/community-scripts/${basePath}/main`; + return type === "vm" ? `${baseUrl}/vm/${slug}.sh` : `${baseUrl}/misc/${slug}.sh`; + return `${baseUrl}/misc/${slug}.sh`; }; const generateUpdateUrl = (slug: string) => { - const baseUrl = `https://raw.githubusercontent.com/community-scripts/${basePath}/main`; - return `${baseUrl}/ct/${slug}.sh`; + const baseUrl = `https://raw.githubusercontent.com/community-scripts/${basePath}/main`; + return `${baseUrl}/ct/${slug}.sh`; }; interface ButtonLinkProps { - href: string; - icon: React.ReactNode; - text: string; + href: string; + icon: React.ReactNode; + text: string; } const ButtonLink = ({ href, icon, text }: ButtonLinkProps) => ( - + ); export default function Buttons({ item }: { item: Script }) { - const isCtOrDefault = ["ct"].includes(item.type); - const installSourceUrl = isCtOrDefault ? generateInstallSourceUrl(item.slug) : null; - const updateSourceUrl = isCtOrDefault ? generateUpdateUrl(item.slug) : null; - const sourceUrl = !isCtOrDefault ? generateSourceUrl(item.slug, item.type) : null; + const isCtOrDefault = ["ct"].includes(item.type); + const installSourceUrl = isCtOrDefault ? generateInstallSourceUrl(item.slug) : null; + const updateSourceUrl = isCtOrDefault ? generateUpdateUrl(item.slug) : null; + const sourceUrl = !isCtOrDefault ? generateSourceUrl(item.slug, item.type) : null; - const buttons = [ - item.website && { - href: item.website, - icon: , - text: "Website", - }, - item.documentation && { - href: item.documentation, - icon: , - text: "Documentation", - }, - installSourceUrl && { - href: installSourceUrl, - icon: , - text: "Install-Source", - }, - updateSourceUrl && { - href: updateSourceUrl, - icon: , - text: "Update-Source", - }, - sourceUrl && { - href: sourceUrl, - icon: , - text: "Source Code", - }, - ].filter(Boolean) as ButtonLinkProps[]; + const buttons = [ + item.website && { + href: item.website, + icon: , + text: "Website", + }, + item.documentation && { + href: item.documentation, + icon: , + text: "Documentation", + }, + installSourceUrl && { + href: installSourceUrl, + icon: , + text: "Install-Source", + }, + updateSourceUrl && { + href: updateSourceUrl, + icon: , + text: "Update-Source", + }, + sourceUrl && { + href: sourceUrl, + icon: , + text: "Source Code", + }, + ].filter(Boolean) as ButtonLinkProps[]; - return ( -
- {buttons.map((props, index) => ( - - ))} -
- ); + return ( + +
+ {buttons.map((props, index) => ( + + ))} +
+ ); } diff --git a/frontend/src/app/scripts/_components/ScriptItems/InterFaces.tsx b/frontend/src/app/scripts/_components/ScriptItems/InterFaces.tsx index 99f855f..ea4e6c0 100644 --- a/frontend/src/app/scripts/_components/ScriptItems/InterFaces.tsx +++ b/frontend/src/app/scripts/_components/ScriptItems/InterFaces.tsx @@ -5,37 +5,38 @@ import { cn } from "@/lib/utils"; import { ClipboardIcon } from "lucide-react"; const CopyButton = ({ - label, - value, + label, + value, }: { - label: string; - value: string | number; + label: string; + value: string | number; }) => ( - - {value} - handleCopy(label, String(value))} - className="size-4 cursor-pointer" - /> - + + {value} + handleCopy(label, String(value))} + className="size-4 cursor-pointer" + /> + ); export default function InterFaces({ item }: { item: Script }) { - return ( -
- {item.interface_port !== null ? ( -
-

- {"Default Interface:"} -

{" "} - + return ( +
+ {item.interface_port !== null ? ( +
+

+ {"Default Interface:"} +

{" "} + + +
+ ) : null}
- ) : null} -
- ); + ); }