Skip to content

Commit 43fa829

Browse files
authored
Merge pull request #117 from nayan9617/addToastify
feat(ui): integrate toast notifications for upload feedback
2 parents af120a2 + 0e8c430 commit 43fa829

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

client/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
"react-icons": "^5.5.0",
3636
"react-markdown": "^10.1.0",
3737
"react-router-dom": "^7.6.3",
38+
"react-toastify": "^11.0.5",
3839
"tailwind-merge": "^3.3.1"
3940
},
4041
"devDependencies": {

client/src/components/AIDamageDetection.jsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import {useState } from "react";
22
import axios from "axios";
33
import AIResponseSection from "./AIResponseSection";
4+
import { ToastContainer, toast } from "react-toastify";
5+
import "react-toastify/dist/ReactToastify.css";
46

57
const AIDamageDetection = () => {
68
const [deviceInfo, setDeviceInfo] = useState({
@@ -39,16 +41,24 @@ const AIDamageDetection = () => {
3941
});
4042

4143
setAiResponse(res.data.reply); // assuming response includes a `reply` field
44+
toast.success("Analysis completed successfully!", {
45+
position: "top-right",
46+
theme: "dark",
47+
});
4248
} catch (error) {
4349
console.error('Error uploading:', error);
44-
alert('Upload failed: ' + (error?.response?.data?.message || error.message));
45-
} finally {
50+
toast.error("Upload failed. Please try again.", {
51+
position: "top-right",
52+
theme: "dark",
53+
});}
54+
finally {
4655
setIsSubmitting(false);
4756
}
4857
};
4958

5059
return (
5160
<div className="min-h-screen bg-white dark:bg-gray-900 flex flex-col px-4 pt-10 pb-20 font-sans text-gray-900 dark:text-gray-100">
61+
<ToastContainer />
5262
<div className="text-center mb-6">
5363
<h1 className="text-3xl font-extrabold text-gray-900 dark:text-white">🔍 Device Damage Detector</h1>
5464
<p className="text-sm text-gray-600 dark:text-gray-400 mt-1">AI-powered diagnostics with repair suggestions</p>

0 commit comments

Comments
 (0)