diff --git a/client/package.json b/client/package.json index d43e841..fbf0962 100644 --- a/client/package.json +++ b/client/package.json @@ -35,6 +35,7 @@ "react-icons": "^5.5.0", "react-markdown": "^10.1.0", "react-router-dom": "^7.6.3", + "react-toastify": "^11.0.5", "tailwind-merge": "^3.3.1" }, "devDependencies": { diff --git a/client/src/components/AIDamageDetection.jsx b/client/src/components/AIDamageDetection.jsx index ca9c97a..93bf6d6 100644 --- a/client/src/components/AIDamageDetection.jsx +++ b/client/src/components/AIDamageDetection.jsx @@ -1,6 +1,8 @@ import {useState } from "react"; import axios from "axios"; import AIResponseSection from "./AIResponseSection"; +import { ToastContainer, toast } from "react-toastify"; +import "react-toastify/dist/ReactToastify.css"; const AIDamageDetection = () => { const [deviceInfo, setDeviceInfo] = useState({ @@ -39,16 +41,24 @@ const AIDamageDetection = () => { }); setAiResponse(res.data.reply); // assuming response includes a `reply` field + toast.success("Analysis completed successfully!", { + position: "top-right", + theme: "dark", + }); } catch (error) { console.error('Error uploading:', error); - alert('Upload failed: ' + (error?.response?.data?.message || error.message)); - } finally { + toast.error("Upload failed. Please try again.", { + position: "top-right", + theme: "dark", + });} + finally { setIsSubmitting(false); } }; return (
+

🔍 Device Damage Detector

AI-powered diagnostics with repair suggestions