From 5a633a145a5d01a71424327ccc2339ea6d150e87 Mon Sep 17 00:00:00 2001 From: Bram Suurd Date: Wed, 6 Nov 2024 17:29:10 +0100 Subject: [PATCH] Refactor `InterFaces` component to use updated `Script` type and streamline interface/port handling for better clarity --- .../_components/ScriptItems/InterFaces.tsx | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/frontend/src/app/scripts/_components/ScriptItems/InterFaces.tsx b/frontend/src/app/scripts/_components/ScriptItems/InterFaces.tsx index e5bab0e8..e8e0e9c9 100644 --- a/frontend/src/app/scripts/_components/ScriptItems/InterFaces.tsx +++ b/frontend/src/app/scripts/_components/ScriptItems/InterFaces.tsx @@ -2,11 +2,7 @@ import { Button, buttonVariants } from "@/components/ui/button"; import handleCopy from "@/components/handleCopy"; import { cn } from "@/lib/utils"; import { ClipboardIcon } from "lucide-react"; - -interface Item { - interface?: string; - port?: number; -} +import { Script } from "@/lib/types"; const CopyButton = ({ label, @@ -24,19 +20,18 @@ const CopyButton = ({ ); -export default function InterFaces({ item }: { item: Item }) { - const { interface: iface, port } = item; +export default function InterFaces({item} : {item : Script}) { return (
- {iface || (port && port !== 0) ? ( + {item.interface_port != null ? (

- {iface ? "Interface:" : "Default Port:"} + {"Default Interface:"}

{" "}
) : null}