Skip to content

Drop in a screenshot and convert it to clean code (HTML/Tailwind/React/Vue)

Python

add success toast after copying code

Abi Raja2303ed6d0552
diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx
index cc0d1cb8..2b962e6b 100644
--- a/frontend/src/App.tsx
+++ b/frontend/src/App.tsx
@@ -13,7 +13,7 @@ import {
FaMobile,
FaUndo,
} from "react-icons/fa";
-import copy from 'copy-to-clipboard';
+import copy from "copy-to-clipboard";
import { Button } from "@/components/ui/button";
import { Textarea } from "@/components/ui/textarea";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "./components/ui/tabs";
@@ -26,6 +26,7 @@ import { OnboardingNote } from "./components/OnboardingNote";
import { usePersistedState } from "./hooks/usePersistedState";
import { UrlInputSection } from "./components/UrlInputSection";
import TermsOfServiceDialog from "./components/TermsOfServiceDialog";
+import toast from "react-hot-toast";
function App() {
const [appState, setAppState] = useState<"INITIAL" | "CODING" | "CODE_READY">(
@@ -113,8 +114,9 @@ function App() {
setUpdateInstruction("");
}
- const handleCopyCode = useCallback(() => {
+ const doCopyCode = useCallback(() => {
copy(generatedCode);
+ toast.success("Copied to clipboard");
}, [generatedCode]);
return (
@@ -256,7 +258,9 @@ function App() {
/>
<span
title="Copy Code"
- className="flex items-center justify-center w-10 h-10 text-gray-500 hover:bg-gray-100 cursor-pointer rounded-lg text-sm p-2.5 absolute top-[20px] right-[20px]" onClick={handleCopyCode}>
+ className="flex items-center justify-center w-10 h-10 text-gray-500 hover:bg-gray-100 cursor-pointer rounded-lg text-sm p-2.5 absolute top-[20px] right-[20px]"
+ onClick={doCopyCode}
+ >
<FaCopy />
</span>
</div>