From d029ff81e6711201a63a9402076a819e189bbcdf Mon Sep 17 00:00:00 2001
From: xXJSONDeruloXx <danielhimebauch@gmail.com>
Date: Thu, 24 Jul 2025 11:03:39 -0400
Subject: update copy to clip button visual feedback

---
 src/components/SmartClipboardButton.tsx | 44 ++++++++++++++++++++++++---------
 1 file changed, 33 insertions(+), 11 deletions(-)

(limited to 'src/components/SmartClipboardButton.tsx')

diff --git a/src/components/SmartClipboardButton.tsx b/src/components/SmartClipboardButton.tsx
index 098b53d..7be3b2f 100644
--- a/src/components/SmartClipboardButton.tsx
+++ b/src/components/SmartClipboardButton.tsx
@@ -1,12 +1,24 @@
-import { useState } from "react";
+import { useState, useEffect } from "react";
 import { PanelSectionRow, ButtonItem } from "@decky/ui";
-import { FaClipboard } from "react-icons/fa";
+import { FaClipboard, FaCheck } from "react-icons/fa";
 import { getLaunchOption } from "../api/lsfgApi";
-import { showClipboardSuccessToast, showClipboardErrorToast, showSuccessToast } from "../utils/toastUtils";
+import { showClipboardErrorToast } from "../utils/toastUtils";
 import { copyWithVerification } from "../utils/clipboardUtils";
 
 export function SmartClipboardButton() {
   const [isLoading, setIsLoading] = useState(false);
+  const [showSuccess, setShowSuccess] = useState(false);
+
+  // Reset success state after 3 seconds
+  useEffect(() => {
+    if (showSuccess) {
+      const timer = setTimeout(() => {
+        setShowSuccess(false);
+      }, 3000);
+      return () => clearTimeout(timer);
+    }
+    return undefined;
+  }, [showSuccess]);
 
   const getLaunchOptionText = async (): Promise<string> => {
     try {
@@ -18,7 +30,7 @@ export function SmartClipboardButton() {
   };
 
   const copyToClipboard = async () => {
-    if (isLoading) return;
+    if (isLoading || showSuccess) return;
     
     setIsLoading(true);
     try {
@@ -26,10 +38,11 @@ export function SmartClipboardButton() {
       const { success, verified } = await copyWithVerification(text);
       
       if (success) {
-        if (verified) {
-          showClipboardSuccessToast();
-        } else {
-          showSuccessToast("Copied to Clipboard!", "Launch option copied (verification unavailable)");
+        // Show success feedback in the button instead of toast
+        setShowSuccess(true);
+        if (!verified) {
+          // Copy worked but verification failed - still show success
+          console.log('Copy verification failed but copy likely worked');
         }
       } else {
         showClipboardErrorToast();
@@ -47,10 +60,14 @@ export function SmartClipboardButton() {
       <ButtonItem
         layout="below"
         onClick={copyToClipboard}
-        disabled={isLoading}
+        disabled={isLoading || showSuccess}
       >
         <div style={{ display: "flex", alignItems: "center", gap: "8px" }}>
-          {isLoading ? (
+          {showSuccess ? (
+            <FaCheck style={{ 
+              color: "#4CAF50" // Green color for success
+            }} />
+          ) : isLoading ? (
             <FaClipboard style={{ 
               animation: "pulse 1s ease-in-out infinite",
               opacity: 0.7 
@@ -58,7 +75,12 @@ export function SmartClipboardButton() {
           ) : (
             <FaClipboard />
           )}
-          <div>{isLoading ? "Copying..." : "Copy Launch Option"}</div>
+          <div style={{ 
+            color: showSuccess ? "#4CAF50" : "inherit",
+            fontWeight: showSuccess ? "bold" : "normal"
+          }}>
+            {showSuccess ? "Copied to clipboard" : isLoading ? "Copying..." : "Copy Launch Option"}
+          </div>
         </div>
       </ButtonItem>
       <style>{`
-- 
cgit v1.2.3

