File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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" : {
Original file line number Diff line number Diff line change 11import { useState } from "react" ;
22import axios from "axios" ;
33import AIResponseSection from "./AIResponseSection" ;
4+ import { ToastContainer , toast } from "react-toastify" ;
5+ import "react-toastify/dist/ReactToastify.css" ;
46
57const 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 >
You can’t perform that action at this time.
0 commit comments