diff --git a/frontend/src/app/scripts/_components/ScriptItems/ConfigFile.tsx b/frontend/src/app/scripts/_components/ScriptItems/ConfigFile.tsx
index c484aa5..0f4f43f 100644
--- a/frontend/src/app/scripts/_components/ScriptItems/ConfigFile.tsx
+++ b/frontend/src/app/scripts/_components/ScriptItems/ConfigFile.tsx
@@ -1,10 +1,10 @@
-import CodeCopyButton from "@/components/ui/code-copy-button";
+import ConfigCopyButton from "@/components/ui/config-copy-button";
import { Script } from "@/lib/types";
export default function ConfigFile({ item }: { item: Script }) {
return (
- {item.config_path ? item.config_path : "No config path set"}
+ {item.config_path ? item.config_path : "No config path set"}
);
}
diff --git a/frontend/src/components/ui/config-copy-button.tsx b/frontend/src/components/ui/config-copy-button.tsx
new file mode 100644
index 0000000..45fc2e9
--- /dev/null
+++ b/frontend/src/components/ui/config-copy-button.tsx
@@ -0,0 +1,55 @@
+"use client";
+import { cn } from "@/lib/utils";
+import { CheckIcon, ClipboardIcon } from "lucide-react";
+import { useEffect, useState } from "react";
+import { toast } from "sonner";
+import { Card } from "./card";
+
+export default function CodeCopyButton({
+ children,
+}: {
+ children: React.ReactNode;
+}) {
+ const [hasCopied, setHasCopied] = useState(false);
+ const isMobile = window.innerWidth <= 640;
+
+ useEffect(() => {
+ if (hasCopied) {
+ setTimeout(() => {
+ setHasCopied(false);
+ }, 2000);
+ }
+ }, [hasCopied]);
+
+ const handleCopy = (type: string, value: any) => {
+ navigator.clipboard.writeText(value);
+
+ setHasCopied(true);
+
+
+ // toast.success(`copied ${type} to clipboard`, {
+ // icon: ,
+ // });
+ };
+
+ return (
+
+
+
+ {!isMobile && children ? children : "Copy Config File Path"}
+
+ handleCopy("install command", children)}
+ >
+ {hasCopied ? (
+
+ ) : (
+
+ )}
+ Copy
+
+
+
+ );
+}